Still writing cheat sheets. Also made trivial changes to the README.

This commit is contained in:
Chris Lane 2013-08-09 23:17:22 -04:00
parent 50b47445ad
commit 66166e3dd4
2 changed files with 37 additions and 12 deletions

View File

@ -1,7 +1,8 @@
Cheat Cheat
===== =====
- overview - overview
- obligatory xkcd - obligatory xkcd (http://xkcd.com/1168/)(Embed: http://imgs.xkcd.com/comics/tar.png)
- examples - examples
- subcommands - subcommands
- anything, really
- help - help

46
cheat
View File

@ -7,7 +7,18 @@ keyphrase = ' '.join(sys.argv[1:])
# create a dictionary of cheatsheets # create a dictionary of cheatsheets
cheatsheets = { cheatsheets = {
########## convert ########################################################## ########## bash ###############################################################
'bash' : '''
To implement a for loop:
for file in `ls .`;
do echo 'file';
echo 'found';
done
@todo: if (esp. file/directory)
''',
########## convert ###########################################################
'convert' : ''' 'convert' : '''
To resize an image to a fixed width and proportional height: To resize an image to a fixed width and proportional height:
convert original-image.jpg -resize 100x converted-image.jpg convert original-image.jpg -resize 100x converted-image.jpg
@ -22,7 +33,8 @@ To resize an image and simultaneously change its file type:
convert original-image.jpg -resize 100x converted-image.png convert original-image.jpg -resize 100x converted-image.png
To resize all of the images within a directory: To resize all of the images within a directory:
for file in original/image/path/; To implement a for loop:
for file in `ls original/image/path/`;
do new_path=${file%.*}; do new_path=${file%.*};
new_file=`basename $new_path`; new_file=`basename $new_path`;
convert $file -resize 150 conerted/image/path/$new_file.png; convert $file -resize 150 conerted/image/path/$new_file.png;
@ -31,14 +43,31 @@ done
########## dhclient ########################################################## ########## dhclient ##########################################################
'dhclient' : ''' 'dhclient' : '''
@todo To release the current IP address:
sudo dhclient -r
To obtain a new IP address:
sudo dhclient
Running the above in sequence is a common way of refreshing an IP.
''', ''',
########## find ############################################################## ########## find ##############################################################
'find' : ''' 'find' : '''
executable perms To find files by extension (ex: .jpg):
file not directory find . -iname "*.jpg"
directory not file
To find directories:
find . -type d
To find files:
find . -type f
To find files by octal permission:
find . -type f -perm 777
To find files with setuid bit set:
find . -xdev \( -perm -4000 \) -type f -print0 | xargs -0 ls -l
''', ''',
########## git ############################################################### ########## git ###############################################################
@ -51,11 +80,6 @@ To enable color:
git config --global color.ui true git config --global color.ui true
''', ''',
########## ifconfig ##########################################################
'ifconfig' : '''
@todo
''',
########## ln ################################################################ ########## ln ################################################################
'ln' : ''' 'ln' : '''
To create a symlink: To create a symlink: