Skip to content

Instantly share code, notes, and snippets.

View aamsur-mkt's full-sized avatar

Aam S aamsur-mkt

View GitHub Profile
@aamsur-mkt
aamsur-mkt / show-uid-ubuntu.sh
Created April 28, 2020 03:37
show user id (UID) or process user id in docker (PUID)
# show laradoc PUID (process UID in docker) / Linux UID
awk -F\: '{print "Group " $1 " with GID=" $3}' /etc/group | grep laradock
@aamsur-mkt
aamsur-mkt / whitelist-jh.sh
Last active April 15, 2020 10:11
Whitelist Script
LC_parameter=$(curl $2) ssh -o SendEnv=LC_parameter $1@jh bash << 'END'
ssh es bnw reg $LC_parameter
END
@aamsur-mkt
aamsur-mkt / which-is-bin.txt
Created April 13, 2020 10:10
Find out where is bin file by its port
# where is node_exporter bin by its port (9100)
sudo fuser 9100/tcp
#Sample outputs:
#9100/tcp: 4966
sudo ls -l /proc/4966/exe
#Sample outputs:
#lrwxrwxrwx 1 ubuntu ubuntu 0 Apr 13 13:27 /proc/4966/exe -> /usr/local/bin/node_exporter
@aamsur-mkt
aamsur-mkt / install-node_exporter.txt
Last active April 13, 2020 06:39
Install node exporter v0.18.1
sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheus
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar zxvf node_exporter-0.18.1.linux-amd64.tar.gz
sudo cp node_exporter-0.18.1.linux-amd64/node_exporter /usr/local/bin/node_exporter
sudo nano /etc/systemd/system/node_exporter.service
==================================== isi node_exporter.service
@aamsur-mkt
aamsur-mkt / install-phalcon-3.4.5.sh
Created March 27, 2020 11:02
Install Phalcon 3.4.x on Php7.2
git clone https://github.com/phalcon/cphalcon
cd cphalcon/build
git checkout origin/3.4.x
sudo ./install
@aamsur-mkt
aamsur-mkt / chmod-recursively.sh
Created March 24, 2020 08:16
Chmod folder recursively
find storage/ -type d -exec chmod 775 {} \;
find storage/ -type f -exec chmod 664 {} \;
@aamsur-mkt
aamsur-mkt / fix-pecl-tar.php-line-639
Created March 23, 2020 06:57
PHP Fatal error: Cannot use result of built-in function in write context in /usr/share/php/Archive/Tar.php on line 639
Just change in Tar.php line 639
$v_att_list = & func_get_args();
to
$v_att_list = func_get_args();
@aamsur-mkt
aamsur-mkt / downgrade-redis.sh
Last active October 2, 2020 09:11
Downgrade redis to 4.3.0
sudo apt-get install php7.2-redis
# force install
sudo pecl install -f redis-4.3.0
# show current version
php --ri redis
# sometime an error appear
# PHP Fatal error: Cannot use result of built-in function in write context in /usr/share/php/Archive/Tar.php on line 639
@aamsur-mkt
aamsur-mkt / upgrade-php7.2-phalcon3.sh
Last active March 19, 2020 06:14
Upgrade Php7.0 to php7.2 with phalcon3
# ref https://ayesh.me/Ubuntu-PHP-7.2
# remove existing phalcon repo
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
rm -rf /etc/apt/sources.list.d/phalcon*
sudo apt-get update
# add ondrejphp repo
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
@aamsur-mkt
aamsur-mkt / run-as-other.sh
Created March 18, 2020 09:53
Run bash as other user
sudo -H -u syarif bash -c 'ssh-keygen'