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;
@vielhuber
vielhuber / readme.txt
Last active July 18, 2024 05:38
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
@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/
@mraaroncruz
mraaroncruz / steps.md
Last active July 9, 2024 03:13
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

Simplest way (via @anhtuank7c)

Go to Telegram web and open a channel, get the ID from -[channel id] from hash in the path

https://web.telegram.org/k/#-9999999999999

@syntaqx
syntaqx / cloud-init.yaml
Last active July 23, 2024 12:16
cloud init / cloud config to install Docker on Ubuntu
#cloud-config
# Option 1 - Full installation using cURL
package_update: true
package_upgrade: true
groups:
- docker
system_info:
@joseluisq
joseluisq / README.md
Last active May 29, 2024 03:08
Install and configure Traefik as Reserver Proxy in a non-docker environment.

Traefik as Reserver Proxy in RHE/CentOS 7

Install and configure Traefik as Reserver Proxy in a non-docker environment.

Donwload and install Traefik

curl -L https://github.com/containous/traefik/releases/download/v1.7.12/traefik_linux-amd64 -o /usr/local/bin/traefik
chmod +x /usr/local/bin/traefik