Monday, October 18, 2021

Hide shadow or margin under react native header

 In old <5 react native you could just hide using shadowOpacity (iOS) or elevation (Android). This is not anymore valid in React >= 6.

For this you need to use headerShadowVisible for both iOS and Android.


An example is below:

<Stack.Navigator screenOptions={{
        headerStyle: {
            backgroundColor: Colors.light.tint,
            
        },
        headerShadowVisible: false,
        headerTintColor: Colors.light.background,
        headerTitleAlign: "left",
        headerTitleStyle: {
            fontWeight: 'bold',
        }
    }}>

Sunday, October 17, 2021

tabBarOptions - deprecated in React Native 6 - No overload matches this call.

Fix by using screenOptions as described below:

<MainTab.Navigator
      initialRouteName="TabOne"
      screenOptions={{
        tabBarActiveTintColor: Colors[colorScheme].background,
        tabBarStyle:{
          backgroundColor: Colors[colorScheme].tint,
        }
      }}>

Fix Error: EMFILE: too many open files

Exact error is this:

 Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:203:21)

 

To fix it, please just install watchman on your Linux/OS X system:
 

brew install watchman

Saturday, October 16, 2021

Fix watchman install ERROR: The following formula cannot be installed from bottle and must be built from source

To overcome this issue on Mac OS X, simple install the Command Line Tools using the below command:


  xcode-select --install

Saturday, October 9, 2021

Automatic renew letsencrypt SSL certificate every 3 months

1. Create a simple script to renew and restart Apache httpd server:

[user@scripts]# cat renew-easy-certificates.sh


certbot certonly --webroot -w /var/www/html/easybiny/price -d price.easybiny.com
certbot certonly --webroot -w /var/www/html/easybiny/prod -d easybiny.com
service httpd restart

 

2. Open crontab scheduler

crontab -e 

 

3. Add the following under crontab scheduler:

0 0 1 */3 * sh /path/scripts/renew-easy-certificates.sh

This runs every 3 months on the first day of each month at 00:00. Certificates are now automatically renewed.

Wednesday, October 6, 2021

Fix npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/abbrev'

 Run the following command and it works just fine (tested on OS X) :

sudo npm install --unsafe-perm -g expo-cli

 

For uninstallting expo-cli, following command can be used:

sudo npm uninstall --unsafe-perm -g expo-cli --save

Verify if node.js is installed

 From a terminal, run the following command. It shall tell node.js installed version:


MacBook-Pro ~ % node -v

v14.18.0

Sunday, May 16, 2021

Loop timeout delay in Browser Console

Below code will iterate from 1 to 10 with a delay of 1 second (1000 ms) between each iteration.

function loopFinish() {
   console.log('All is complete');
}
for(let i = 1; i < 11; i++) {
   setTimeout(()=>{
      console.log("Iteration number: "+i);   
      if(i === 10){
         setTimeout(loopFinish, 1000);
      }
   },i * 1000);
}

 Output would  be in the console browser:


Iteration number: 1
Iteration number: 2
Iteration number: 3
Iteration number: 4
Iteration number: 5
Iteration number: 6
Iteration number: 7
Iteration number: 8
Iteration number: 9
Iteration number: 10
All is complete

 

Monday, May 10, 2021

Royal TSX Items do not show and only "Filtered by: Favorites" show up

 As per:

https://support.royalapps.com/support/solutions/articles/17000065344-where-are-my-documents-stored-

Follow those simple steps to solve it:

You accidentally activated "Show only Favorites" but don't have any favorites
Solution: Disable "Show only Favorites" by clicking the yellow star button in the bottom left corner of the navigation panel (sidebar)

 

 

Saturday, May 1, 2021

Cisco VPN connection slow on Archer C80 TP Link router

 All I needed to do is to update router firmware to latest version available - in my case this is 1.5.7:


Advanced -> System -> Firmware Upgrade



 

Please also note that for VPN to work, following need to be checked:

 




Wednesday, April 28, 2021

Lets encrypt - Add multiple domains to one certificate

 It's very simple, just use the following command to generate the certificate with as many domains as needed (two in the below example):

certbot certonly --webroot -w /var/www/html/easybiny/price -d price.easybiny.com -d www.price.easybiny.com

Thursday, February 25, 2021

Integrate sendmail Linux EC2 and AWS SES

 1. Configure AWS SES Service as per instructions below:

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-set-up.html


2. Install sendmail

sudo yum install sendmail

sudo yum install m4

sudo yum install sendmail-cf


3. Follow the below steps from AWS:

https://docs.aws.amazon.com/ses/latest/dg/send-email-sendmail.html


4. Test by running the following command:

echo "Subject: sendmail test" | sendmail -f sender@domain.com  -v destination@domain.com

Wednesday, February 24, 2021

Linux - See Top memory consumers

1. Simple way to do it is to run following command:

top -o %MEM
 
2. Output below
[root@ip-x-x-x-x xinetd.d]# top -o %MEM
top - 15:24:13 up 8:02, 1 user, load average: 0.01, 0.31, 0.25
Tasks: 107 total, 1 running, 66 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.3 id, 0.3 wa, 0.0 hi, 0.0 si, 0.2 st
KiB Mem : 472500 total, 227492 free, 185308 used, 59700 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 274136 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2275 mysql 20 0 1771192 65264 0 S 0.0 13.8 0:09.53 mysqld
1384 root 20 0 65632 12376 12000 S 0.0 2.6 0:00.66 systemd-journal
2833 apache 20 0 1923848 10644 152 S 0.0 2.3 0:05.61 httpd
2572 apache 20 0 2050504 9232 108 S 0.0 2.0 0:05.78 httpd
2571 apache 20 0 1921608 9196 72 S 0.3 1.9 0:05.60 httpd
2573 apache 20 0 1917128 8064 88 S 0.0 1.7 0:05.63 httpd
2258 root 20 0 398704 7360 896 S 0.0 1.6 0:01.19 httpd 
 
3. As per above, we can see that mysql process is the top memory eater. 

Install Telnet on AWS Linux 2 Server

 1. 

yum -y install telnet


2. 

yum clean all


3. 

rm -rf /var/cache/yum

4. Test:

[root@ip-x-x-x-x xinetd.d]# telnet
telnet>