Batch & Powershell

Count Lines in Powershell:

1
pip list | Measure-Object -line

Shell

Make file executable:

1
chmod +x file.command

Start a simple server:

1
python -m SimpleHTTPServer

Make a symbol link:

1
ln -s [SOURCE FILE] [DESTINATION FOLDER OR FILE]

Get counts of files with certain extension:

1
find *.jpg | wc -l

History of top most used commands:

1
2
3
history | awk '{CMD[$1]++;count++;}END { for (a in CMD)\
print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" \
| column -c3 -s " " -t | sort -nr | nl | head -n10'

Tools

Resize all photos using imagemagick:

1
convert *.jpg -resize 50%

Split pdf file using qpdf:

1
qpdf --empty --pages [SOURCE FILE] [STARTING PAGE]-[ENDING PAGE] -- [OUTPUT FILE]

Convert .tex file to .dox using pandoc:

1
pandoc -s -S [SOURCE FILE] -o [OUTPUT FILE]