Skip to content

Instantly share code, notes, and snippets.

View notthetup's full-sized avatar
🔊

Chinmay Pendharkar notthetup

🔊
View GitHub Profile
@notthetup
notthetup / script-template.sh
Created December 29, 2020 07:52 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
# original post: http://blog.hostonnet.com/uninstall-gui-from-ubuntu-14-04-lts
sudo apt-get purge -y lightdm
sudo shutdown -r now
sudo apt-get clean
sudo apt-get autoclean
apt-get purge -y unity*
sudo apt-get purge -y unity*
sudo apt-get purge -y gnome-*
@notthetup
notthetup / ex33 tweak
Last active December 26, 2015 23:09 — forked from shurru/ex33 tweak
Fixed indentation for return.
numbers= []
def loopy(i):
while i<6:
print "at the top of i is %d" %i
numbers.append(i)
i = i+1
print "Numbers now", numbers
print "at the bottom of i is %d" %i
@notthetup
notthetup / gist:4213687
Created December 5, 2012 08:09 — forked from aehlke/gist:992798
zsh hooks to growl completion of long-running commands
# long-running command growler
# hooks for zsh, built on bash version at http://hints.macworld.com/article.php?story=20071009124425468
preexec_functions+='save_preexec_time'
save_preexec_time() {
export PREEXEC_CMD="$(history $HISTCMD | tail -n 1| sed 's/ *[0-9]* *//')"
export PREEXEC_TIME=$(date +'%s')
}
precmd_functions+='growl_about_long_running_commands'