Skip to content

Instantly share code, notes, and snippets.

@caingougou
caingougou / ffmpeg screen capture.sh
Created July 3, 2012 16:30
ffmpeg screen capture
ffmpeg -ss 00:00:01 -t 1 -s [width]x[height] -i [name].avi -f mjpeg [name].png
@caingougou
caingougou / make.a-z.directories.sh
Created July 6, 2012 08:27
mkdir a-z directories
mkdir $(printf '%s\n' {a..z})
@caingougou
caingougou / Ignore foreign key check.sql
Created July 20, 2012 07:35
Ignore foreign key check
SET foreign_key_checks = 0;
@caingougou
caingougou / gist:3711713
Created September 13, 2012 03:49
rsync command
rsync -vvv --checksum --archive --timeout=60 "/home/cain/Downloads/tests/" cain@127.0.0.1::qatest/
@caingougou
caingougou / vpn-setup.sh
Created October 15, 2012 09:44 — forked from harmy/vpn-setup.sh
Ubuntu VPN for poor Chinese (on AWS EC2)
#!/bin/bash -x
## original author: Oliver Nassar <onassar@gmail.com>
## credit: harmy <hack4cn@gmail.com>
## Ubuntu VPN for poor Chinese (you know de)
## Sample Usage:
##
## wget https://gist.github.com/raw/3891178/ff1702fac175eb21c513b93f51f39948be693aba/vpn-setup.sh
## chmod +x vpn-setup.sh
## sudo ./vpn-setup.sh <username> <password>
@caingougou
caingougou / empty_files.sh
Created November 22, 2012 08:49
Empty files
find . -name "[pattern]" |xargs -n1 cp /dev/null
@caingougou
caingougou / Patch a file.sh
Created December 4, 2012 07:33
Patch a file
patch -p1 -d /path/to/lib/ < somediff
# b: backup
# p: path
@caingougou
caingougou / get largest file.sh
Created January 8, 2013 03:51
Get the largest file in the folder
find . -type f | xargs ls -s | sort -rn | head
@caingougou
caingougou / check php.sh
Created January 8, 2013 03:52
check php process is still alive
ps aux|grep "/usr/bin/php"|wc -l|awk '{print $1-1}'
diff file file2 > ~/$(date '%F').diff