Skip to content

Instantly share code, notes, and snippets.

View marufshidiq's full-sized avatar
🎯
Focusing

Ma'ruf Shidiq marufshidiq

🎯
Focusing
View GitHub Profile
@marufshidiq
marufshidiq / mrf-setup.sh
Last active February 20, 2021 04:51
Default setting for ubuntu server
#!/bin/bash
echo "set -g default-terminal \"screen-256color\"" >> ~/.tmux.conf
echo "set-option -g status-position top" >> ~/.tmux.conf
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/TTJeefwSurF8uqMhdE0142GOtUx315B8Si3SvcAaU67Frj3MI3tEA9IZqod7B+4iIUwsOeiAyAwDe/IxgAnAJ8yqUGbLMDdtfr9Vp8zFKDd89KXxsfs5DgecPVNUh7E4I783vEFUQ+CBykRAggyTeSED7eQzxMLmBpjNpqwZVwYmEQMu9DTJriJnhc9kidhwqDYDLt5vwPVwN3d3s9UZEYv2uUC+NVweDdC6UDHjyoDU3nP1skOsOmlRXP6T0HKoroC2Mdd335wS6UR5PDA4wPYGg4zIXe1uBZg9vokOYnVGyI/ctGQ/adUuHp/AMzljBcVJtp9cFL9n8ins9KednXMUekt2FMGhA69nPfICz41/A+z8qTkmF4Cgt3W4Kj/jGN68yaQ+a1OJYtqT+b2G5KR4x9riMv5ftV/gKaHMKZPFkpaKyGBqHRqx5OvXqEs/6+B0Ww1q+sNux5jm+8wwTxREM9CLtSwuh74s90tADtSFkDzd3jcJFMOdHPQ4sBM= mrfshdq@mrfshdq-X456URK" >> ~/.ssh/authorized_keys
@marufshidiq
marufshidiq / mZIP.sh
Last active April 28, 2020 09:42
ZIP multiple PDF and EXCEL
N_PDF=$(find ./PDF -type f -name "*.pdf" | wc -l)
N_EXCEL=$(find ./EXCEL -type f -name "*.xls" | wc -l)
echo '===== MRF ZIP ====='
echo 'PDF =' $N_PDF 'file'
echo 'EXCEL =' $N_EXCEL 'file'
if [ "$N_EXCEL" -ne "$N_PDF" ]
then
echo '[ERROR] PDF File and Excel File not equal'
@marufshidiq
marufshidiq / HOWTO.md
Created April 12, 2020 07:03
Backup and Restore mongodb inside docker-compose container

How to backup

docker-compose exec -T <mongodb_service_name> mongodump --archive --gzip --db <mongodb_database> > dump.gz

How to restore

docker-compose exec -T  mongorestore --archive --gzip &lt; dump.gz
#!/bin/bash
sudo mkdir /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/startup_options.conf
cat <<EOT | sudo tee -a /etc/systemd/system/docker.service.d/startup_options.conf >&/dev/null
# /etc/systemd/system/docker.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376
EOT
#!/bin/bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
sudo usermod -aG docker ${USER}
su - ${USER}
sudo usermod -aG docker ubuntu