From 76cce9d58447753c4bc231aa140f8ca9e153acad Mon Sep 17 00:00:00 2001 From: Chris Lane Date: Fri, 9 Aug 2013 21:56:42 -0400 Subject: [PATCH] Added more cheat sheets. --- cheat | 59 +++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/cheat b/cheat index 9b65b0a..8bcb762 100755 --- a/cheat +++ b/cheat @@ -7,12 +7,33 @@ keyphrase = ' '.join(sys.argv[1:]) # create a dictionary of cheatsheets cheatsheets = { +########## convert ########################################################## +'convert' : ''' +To resize an image to a fixed width and proportional height: +convert original-image.jpg -resize 100x converted-image.jpg + +To resize an image to a fixed height and proportional width: +convert original-image.jpg -resize x100 converted-image.jpg + +To resize an image to a fixed width and height: +convert original-image.jpg -resize 100x100 converted-image.jpg + +To resize an image and simultaneously change its file type: +convert original-image.jpg -resize 100x converted-image.png + +To resize all of the images within a directory: +for file in original/image/path/; + do new_path=${file%.*}; + new_file=`basename $new_path`; + convert $file -resize 150 conerted/image/path/$new_file.png; +done +''', + ########## dhclient ########################################################## 'dhclient' : ''' @todo ''', - ########## find ############################################################## 'find' : ''' executable perms @@ -20,7 +41,6 @@ file not directory directory not file ''', - ########## git ############################################################### 'git' : ''' To set your identify: @@ -31,26 +51,43 @@ To enable color: git config --global color.ui true ''', - ########## ifconfig ########################################################## 'ifconfig' : ''' @todo ''', - ########## ln ################################################################ 'ln' : ''' To create a symlink: -@todo +ln -s path/to/the/target/directory name-of-symlink ''', +########## netstat ########################################################### +'netstat' : ''' +To view which users/processes are listening to which ports: +sudo netstat -lnptu +''', + +########## sockstat ########################################################## +'sockstat' : ''' +To view which users/processes are listening to which ports: +sudo sockstat -l +''', ########## ssh ############################################################### 'ssh' : ''' To execute a command on a remote server: -@todo -''', +ssh -t user@example.com 'the-remote-command' +To tunnel an x session over SSH: +ssh -X user@example.com + +To launch a specific x application over SSH: +ssh -X -t user@example.com 'chromium-browser' + +For more information, see: +http://unix.stackexchange.com/q/12755/44856 +''', ########## tar ############################################################### 'tar' : ''' @@ -70,16 +107,10 @@ To create a .bz2 archive: tar -cjvf /path/to/foo.tgz /path/to/foo/ ''', - -########## x ################################################################# -'x' : ''' -To tunnel an X application over SSH: -@todo -''', - } # print help if requested +# @todo: alphabetize key names if possible if keyphrase in ['', 'help', '--help', '-h']: print 'Usage: cheat [keyphrase]' print 'Available keyphrases:'