Skip to content

Instantly share code, notes, and snippets.

@andrewbolster
Created February 5, 2013 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewbolster/4713465 to your computer and use it in GitHub Desktop.
Save andrewbolster/4713465 to your computer and use it in GitHub Desktop.
Handy Dandy Aliases
# Take the last command and try it again with sudo while deleting leading spaces
alias please='sudo $(history 2 | head -n1 | perl -pe "s/^\s*\d+\s+//")
# Python compilation check without execution (parse without exec)
alias pycheck='python -m py_compile'
# Python profiling
alias pryfile='python -m cProfile -o profile.run'
# Enhanced Sudo
alias sudo='sudo env PATH=$PATH'
# Open a file from the command line using the relevant editor
alias go='gnome-do'
#!/bin/bash
# Idiot proof script to forcibly optimise execution.
application=`which $1`
# Assumes the program is called like 'pyopt accessible-script-name -someopt more options than -y oucouldshakeastickat'
python -O ${application} ${@:2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment