The Bad Programmer

Quick How-To's

Decompile all Java classes in a directory

jad -o -r -sjava -d. “./*/.class”

JAD can be downloaded here:

Remove HTML tags with sed

sed -e ‘s/<[^>]*>//g’ foo.html

Find PID of process listening on port on Mac OS

Mac OS’s version of netstat doesn’t support the -p option. So to find the PID of the process that is listening on a particular port you can use lsof. Replace 8080 with the port you are looking for.

sudo lsof -i TCP:8080 grep LISTEN

Check TCP Send and Receive Queue Sizes on Linux


cat /proc/sys/net/core/rmem_default
cat /proc/sys/net/core/rmem_max


cat /proc/sys/net/core/wmem_max
cat /proc/sys/net/core/wmem_default

Remove all newlines from file

perl -p -e ‘s/\s+$/,/g’ filename

Enable cut and pasting from QuickLook on Mac OS

defaults write QLEnableTextSelection -bool TRUE && killall Finder