Skip to content

Instantly share code, notes, and snippets.

@markogresak
Last active August 29, 2015 14:14
Show Gist options
  • Save markogresak/c633aa55988ad63c8560 to your computer and use it in GitHub Desktop.
Save markogresak/c633aa55988ad63c8560 to your computer and use it in GitHub Desktop.
Useful commands

Perform perl regexp (because grep on OS X (still) doesn't support it):

perl -ne 'print if /[regexp]/'

Print can use capturing groups or named capturing groups:

perl -ne 'print "$1\n" if /(.*)/'

Find and open with arbitrary command:

find [path] [arguments / filters] -print0 | xargs -0 [command] [&]

Useful terminal commands (OS X):

List all files with size, sorted descending (high - low)

du -sk * | sort -n | tail -r

Start netbeans with different Look and feel

/Applications/NetBeans/NetBeans\ 7.4.app/Contents/MacOS/netbeans --laf [Nimbus | Metal]

Merge pdf files

"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o PATH/TO/YOUR/MERGED/FILE.pdf /PATH/TO/ORIGINAL/1.pdf /PATH/TO/ANOTHER/2.pdf /PATH/TO/A/WHOLE/DIR/*.pdf

change computer host name (on OS X)

sudo scutil --set HostName name-you-want
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment