mirror of
https://github.com/cheat/cheat.git
synced 2025-09-01 17:48:30 +02:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
aa1e12625e | |||
d09353bfca | |||
81e80c87a1 | |||
3d498d5ce7 | |||
d90d509702 | |||
b46f5b2c34 | |||
e2d63e7603 | |||
67f52f8317 | |||
67134b9240 | |||
c67adb1422 | |||
c2aa5e0148 | |||
332f0bd4ee | |||
b303bc0028 | |||
02f79ddd13 | |||
71680c6586 | |||
a240413eb9 | |||
cde64e3ea4 | |||
0b0bc441c6 | |||
2aa37432cb | |||
89de3705b0 | |||
d12718b8c4 | |||
900e083b99 | |||
837e0b5b71 | |||
30d2a77a6c | |||
1a8cdf84f4 | |||
181403e7ac | |||
2c10955690 | |||
4319b8e699 | |||
57dff86a44 | |||
aa4f6daf77 |
@ -42,7 +42,7 @@ from docopt import docopt
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# parse the command-line options
|
# parse the command-line options
|
||||||
options = docopt(__doc__, version='cheat 2.2.2')
|
options = docopt(__doc__, version='cheat 2.2.3')
|
||||||
|
|
||||||
# list directories
|
# list directories
|
||||||
if options['--directories']:
|
if options['--directories']:
|
||||||
|
11
cheat/cheatsheets/cd
Normal file
11
cheat/cheatsheets/cd
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#Go to the given directory
|
||||||
|
cd path/to/directory
|
||||||
|
|
||||||
|
#Go to home directory of current user
|
||||||
|
cd
|
||||||
|
|
||||||
|
#Go up to the parent of the current directory
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
#Go to the previously chosen directory
|
||||||
|
cd -
|
@ -6,3 +6,6 @@ cp -r ~/Desktop/cruise_pics/ ~/Pictures/
|
|||||||
|
|
||||||
# Create a copy but ask to overwrite if the destination file already exists
|
# Create a copy but ask to overwrite if the destination file already exists
|
||||||
cp -i ~/Desktop/foo.txt ~/Documents/foo.txt
|
cp -i ~/Desktop/foo.txt ~/Documents/foo.txt
|
||||||
|
|
||||||
|
# Create a backup file with date
|
||||||
|
cp foo.txt{,."$(date +%Y%m%d-%H%M%S)"}
|
||||||
|
@ -36,3 +36,6 @@ curl --limit-rate 1000B -O http://path.to.the/file
|
|||||||
|
|
||||||
# Get your global IP
|
# Get your global IP
|
||||||
curl httpbin.org/ip
|
curl httpbin.org/ip
|
||||||
|
|
||||||
|
# Get only the HTTP status code
|
||||||
|
curl -o /dev/null -w '%{http_code}\n' -s -I URL
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
# Running emacs
|
||||||
|
|
||||||
|
GUI mode $ emacs
|
||||||
|
Terminal mode $ emacs -nw
|
||||||
|
|
||||||
# Basic usage
|
# Basic usage
|
||||||
|
|
||||||
Indent Select text then press TAB
|
Indent Select text then press TAB
|
||||||
|
@ -19,11 +19,11 @@ find ./path/ -name '*.txt' -exec rm '{}' \;
|
|||||||
# To find files with extension '.txt' and look for a string into them:
|
# To find files with extension '.txt' and look for a string into them:
|
||||||
find ./path/ -name '*.txt' | xargs grep 'string'
|
find ./path/ -name '*.txt' | xargs grep 'string'
|
||||||
|
|
||||||
# To find files with size bigger than 5 Mb and sort them by size:
|
# To find files with size bigger than 5 Mebibyte and sort them by size:
|
||||||
find . -size +5M -type f -print0 | xargs -0 ls -Ssh | sort -z
|
find . -size +5M -type f -print0 | xargs -0 ls -Ssh | sort -z
|
||||||
|
|
||||||
# To find files bigger thank 2 MB and list them:
|
# To find files bigger than 2 Megabyte and list them:
|
||||||
find . -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
|
find . -type f -size +200000000c -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
|
||||||
|
|
||||||
# To find files modified more than 7 days ago and list file information
|
# To find files modified more than 7 days ago and list file information
|
||||||
find . -type f -mtime +7d -ls
|
find . -type f -mtime +7d -ls
|
||||||
|
12
cheat/cheatsheets/gyb
Normal file
12
cheat/cheatsheets/gyb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# To estimate the number and the size of all mails on youremail@gmail.com
|
||||||
|
gyb --email youremail@gmail.com --action estimate
|
||||||
|
|
||||||
|
# To backup from youremail@gmail.com to your local-folder
|
||||||
|
gyb --email youremail@gmail.com --action backup --local-folder "~/MyLocalFolder/"
|
||||||
|
|
||||||
|
# To backup from youremail@gmail.com only important or starred emails to the
|
||||||
|
# default local folder GYB-GMail-Backup-youremail@gmail.com
|
||||||
|
gyb --email youremail@gmail.com --search "is:important OR is:starred"
|
||||||
|
|
||||||
|
# To restore from your local-folder to youremail@gmail.com
|
||||||
|
gyb --email youremail@gmail.com --action restore --local-folder "~/MyLocalFolder/"
|
3
cheat/cheatsheets/iconv
Normal file
3
cheat/cheatsheets/iconv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# To convert file (iconv.src) from iso-8859-1 to utf-8 and save to
|
||||||
|
# /tmp/iconv.out
|
||||||
|
iconv -f iso-8859-1 -t utf-8 iconv.src -o /tmp/iconv.out
|
@ -29,3 +29,9 @@ UPDATE tbl_name SET col1 = "example";
|
|||||||
|
|
||||||
# Basic DELETE Statement
|
# Basic DELETE Statement
|
||||||
DELETE FROM tbl_name WHERE user = 'jcole';
|
DELETE FROM tbl_name WHERE user = 'jcole';
|
||||||
|
|
||||||
|
# To check stored procedure
|
||||||
|
SHOW PROCEDURE STATUS;
|
||||||
|
|
||||||
|
# To check stored function
|
||||||
|
SHOW FUNCTION STATUS;
|
||||||
|
8
cheat/cheatsheets/perl
Normal file
8
cheat/cheatsheets/perl
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# To view the perl version:
|
||||||
|
perl -v
|
||||||
|
|
||||||
|
# Replace string "\n" to newline
|
||||||
|
echo -e "foo\nbar\nbaz" | perl -pe 's/\n/\\n/g;'
|
||||||
|
|
||||||
|
# Replace newline with multiple line to space
|
||||||
|
cat test.txt | perl -0pe "s/test1\ntest2/test1 test2/m"
|
26
cheat/cheatsheets/rcs
Normal file
26
cheat/cheatsheets/rcs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Initial check-in of file (leaving file active in filesystem)
|
||||||
|
ci -u <filename>
|
||||||
|
|
||||||
|
# Check out with lock
|
||||||
|
co -l <filename>
|
||||||
|
|
||||||
|
# Check in and unlock (leaving file active in filesystem)
|
||||||
|
ci -u <filename>
|
||||||
|
|
||||||
|
# Display version x.y of a file
|
||||||
|
co -px.y <filename>
|
||||||
|
|
||||||
|
# Undo to version x.y (overwrites file active in filesystem with the specified revision)
|
||||||
|
co -rx.y <filename>
|
||||||
|
|
||||||
|
# Diff file active in filesystem and last revision
|
||||||
|
rcsdiff <filename>
|
||||||
|
|
||||||
|
# Diff versions x.y and x.z
|
||||||
|
rcsdiff -rx.y -rx.z <filename>
|
||||||
|
|
||||||
|
# View log of check-ins
|
||||||
|
rlog <filename>
|
||||||
|
|
||||||
|
# Break an RCS lock held by another person on a file
|
||||||
|
rcs -u <filename>
|
@ -10,3 +10,7 @@ find -name *.pdf | xargs -I{} rm -rf '{}'
|
|||||||
# -n1 => One file by one file. ( -n2 => 2 files by 2 files )
|
# -n1 => One file by one file. ( -n2 => 2 files by 2 files )
|
||||||
|
|
||||||
find -name *.pdf | xargs -I{} -n1 echo '&{}='
|
find -name *.pdf | xargs -I{} -n1 echo '&{}='
|
||||||
|
|
||||||
|
# If find returns no result, do not run rm
|
||||||
|
# This option is a GNU extension.
|
||||||
|
find -name "*.pdf" | xargs --no-run-if-empty rm
|
||||||
|
@ -16,5 +16,8 @@ youtube-dl --playlist-start 5 example.com/watch?v=id&list=listid
|
|||||||
# To simulate a download with youtube-dl:
|
# To simulate a download with youtube-dl:
|
||||||
youtube-dl -s example.com/watch?v=id
|
youtube-dl -s example.com/watch?v=id
|
||||||
|
|
||||||
|
# To download audio in mp3 format with best quality available
|
||||||
|
youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 example.com/watch?v=id
|
||||||
|
|
||||||
# For all video formats see
|
# For all video formats see
|
||||||
# http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs
|
# http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs
|
||||||
|
2
setup.py
2
setup.py
@ -3,7 +3,7 @@ import os
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'cheat',
|
name = 'cheat',
|
||||||
version = '2.2.2',
|
version = '2.2.3',
|
||||||
author = 'Chris Lane',
|
author = 'Chris Lane',
|
||||||
author_email = 'chris@chris-allen-lane.com',
|
author_email = 'chris@chris-allen-lane.com',
|
||||||
license = 'GPL3',
|
license = 'GPL3',
|
||||||
|
Reference in New Issue
Block a user