Skip to content

Instantly share code, notes, and snippets.

@ericvanjohnson
ericvanjohnson / gist:4597880
Created January 22, 2013 19:55
Rsync over SSH using SUDO on the remote server
rsync -ave "ssh" --rsync-path="sudo rsync" USER@REMOTE_SERVER:/remote/file/path/ /local/file/path
@kixorz
kixorz / aws_autoscaling_cron.rb
Created March 20, 2013 22:41
Running cron jobs in AWS Auto Scaling group is tricky. When you deploy the same code and configuration to all instances in the group, cron job would run on all of them. You may not want that. This script detects the first instance in the group and allows only this instance to run the job. IAM user used by this script needs to have permissions to…
#!/usr/bin/env ruby
require 'syslog'
require 'net/http'
require 'aws-sdk'
Syslog.open
AWS.config({
:access_key_id => '<iam user key>',
:secret_access_key => '<iam user secret>'
@lukearmstrong
lukearmstrong / nginx-vhost-php.conf
Created October 25, 2013 14:18
Example vhost config for Nginx (PHP)
server {
listen 80;
server_name .example.co.uk.dev;
access_log /usr/local/var/log/nginx/example.co.uk-access.log;
error_log /usr/local/var/log/nginx/example.co.uk-error.log error;
root /var/www/example.co.uk/public;
index index.php index.html;
@macmladen
macmladen / IPtables and csf.md
Last active January 30, 2025 03:32
Handling firewall blocking and unblocking, iptables, csf
@sirkirby
sirkirby / curlWinCMDSlackNotification.bat
Created September 22, 2015 19:37
Send a slack notification from a windows command prompt using curl
curl -k -g -X POST -d "payload={\"text\":\"my important bot notification\", \"channel\":\"#monitoring\", \"username\":\"computer-bot\", \"icon_emoji\":\":computer:\"}" https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XxXxXxXxXXXxxXXXxxx
@vielhuber
vielhuber / readme.txt
Last active November 8, 2024 10:47
MySQL: Import/export backup/restore dump mysqldump on command line #sql
// export
mysqldump -h localhost --port 3306 -u username -p"password" --routines database > dump.sql
// import
mysql -h localhost --port 3306 -u username -p"XXX" --default-character-set=utf8 database < dump.sql
// import with progress
pv dump.sql | mysql -h localhost --port 3306 -u username -p"XXX" --default-character-set=utf8 database
// note when using passwords with "$": escape passwords needed
cat ~/.ssh/id_rsa.pub | ssh -i aws.pem ubuntu@ip_address "cat - >> ~/.ssh/authorized_keys"
@tiagocardosos
tiagocardosos / clear_binary_log_mysql.txt
Last active March 5, 2024 12:18
MySQL Clear Binary Log
Can I Remove MySQL Binary Log Yes, as long as the data is replicated to Slave server, it’s safe to remove the file. It’s recommend only remove MySQL Binary Log older than 1 month.
Besides, if Recovery of data is the main concern, it’s recommend to archive MySQL Binary Log.
There are several ways to remove or clean up MySQL Binary Log, it’s not recommend to clean up the file manually, manually means running the remove command.
Remove MySQL Binary Log with RESET MASTER Statement Reset Master statement is uses for new database start up during replication for Master and Slave server. This statement can be used to remove all Binary Log.
To clean up Binary Log on Master Server
@1duo
1duo / centos.install.cmake.from.source.md
Last active April 26, 2025 17:18
Install CMake on CentOS 7.

Download CMake from: https://cmake.org/download/

wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz

Compile from source and install

tar zxvf cmake-3.*
@chipulaja
chipulaja / how-to-running-docker-on-android.md
Last active February 3, 2024 19:30
how to running docker on android [termux]

Sesuaikan kode binary dengan arsistektur Android anda, kebetulah arsistektur HP android saya adalah aarch64 (s9 plus) untuk memilih kode binari anda bisa lihat di https://download.docker.com/linux/static/stable/

Berikut adalah cara installnya

$ curl https://download.docker.com/linux/static/stable/aarch64/docker-18.03.1-ce.tgz | tar -xz
$ mv docker/* ~/../usr/bin/