Skip to content

Instantly share code, notes, and snippets.

@vijaydev
Created November 24, 2010 13:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijaydev/713678 to your computer and use it in GitHub Desktop.
Save vijaydev/713678 to your computer and use it in GitHub Desktop.
Unix/Linux
Use ssh-copy-id to install your public key in a remote machine's authorized_keys. Also takes care of the permissions of the remote user's .ssh and .ssh/authorized_keys.
ssh -t reachable_host ssh unreachable_host. Enables to connect to a host unreachable from current network but reachable from reachable_host's network.
To navigate to a directory, run a command and get back: (cd /to/dir && cmd_to_run)
To rip audio out of a video file: mplayer -ao pcm -vo null -vc dummy -dumpaudio -dumpfile <out_file> <in_file>
Rsync: rsync --recursive -avz -e "ssh -p 2020" user@machine:/path dest
awk '!x[$0]++' filename => removes duplicates from the file without sorting.
update-rc.d -f service_name remove - removes a service from startup.
cat a b b | sort | uniq -u > c # c is set difference a - b
http://vim.wikia.com/wiki/Switching_case_of_characters
# select 1000 random lines from a file
awk 'BEGIN { srand() } { l[NR]=$0 } END { for(i=1;i<=1000;i++){print l[int(rand() * NR + 1)]; } }' 2011.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment