Skip to content

Instantly share code, notes, and snippets.

@bxt
Last active April 4, 2019 16:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bxt/846197 to your computer and use it in GitHub Desktop.
Save bxt/846197 to your computer and use it in GitHub Desktop.
some stuff for .bashrc
# .bashrc commands by bxt
# color promt:
PS1="\@ \[\033[0;35m\]\u@\\h\[\033[0m\]:\w> "
# actually I sometimes use this one (shorter, 24h clock)
PS1=" \t \[\033[0;35m\]:\w>\[\033[0m\] "
# Change shell apps language to english:
export LANG=C
export LC_LANG=C
# ha ha
alias gn8="exit"
# check network config
alias myip="/sbin/ifconfig"
# process-finder
alias psf='ps aux | grep -v grep | grep '
# calculator
? () { echo "$*" | bc -l; }
# avoid duplicate entries in history
export HISTCONTROL=ignoredups
# save history for multiple terminals
shopt -s histappend
# make history long
export HISTSIZE=1000000 HISTFILESIZE=1000000
# ignore exit commands
declare -x HISTIGNORE=exit:gn8
# Share pwd via http on port 8000
webshare () { python -m SimpleHTTPServer $([ -z "$1" ] && echo 8000 || echo $1); }
# set my fav editor
export EDITOR=vim
# colored grep rulz
export GREP_OPTIONS='--color=auto'
# german greetings
if [ `date +%H` -lt 12 ]; then
echo "Moin. "
else
echo "Tach. "
fi
# remember DOS? ;)
alias dir='ls -la'
# list size of all files and dirs and sort
# very useful if you want to know wherer all your TB are gone...
alias imbadu="du -sk ./* | sort -n | awk 'BEGIN{ pref[1]=\"K\"; pref[2]=\"M\"; pref[3]=\"G\";} { total = total + \$1; x = \$1; y = 1; while( x > 1024 ) { x = (x + 1023)/1024; y++; } printf(\"%g%s\t%s\n\",int(x*10)/10,pref[y],\$2); } END { y = 1; while( total > 1024 ) { total = (total + 1023)/1024; y++; } printf(\"Total: %g%s\n\",int(total*10)/10,pref[y]); }'"
# Cool History Summerizer
historyawk(){ history|awk '{a[$2]++}END{for(i in a){printf"%5d\t%s\n",a[i],i}}'|sort -nr|head; }
## https://gist.github.com/87359
# handy find/grep aliases
rgrep() { fgrep -niIR "${1}" .; }
finame() { find . -iname "*${1}*"; }
# produce noise:
alias noise="cat /usr/share/icons/*/* > /dev/dsp"
## http://techfreaks4u.com/blog/posts/geekist-things-i-ever-did-in-linux/
# coin sound:
alias coin='play -q http://store.ukd1.co.uk.s3.amazonaws.com/coin.wav'
## https://gist.github.com/769923
# neat git log:
alias gitlog='git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
## http://gitimmersion.com/lab_10.html
# Create a new minor semver git tag
alias grel='git diff --name-only `git describe --tags --abbrev=0` HEAD && git tag `git describe --tags --abbrev=0 | awk '\''BEGIN {FS="."} {print $1 "." $2 "." ($3+1)}'\''` -m "autotag"'
# quickly create file backups
bu() { cp -v "$1" "$1".`date +%Y-%m-%d.%H-%M-%S`; }
# bundler
alias be='bundle exec'
# Remove weird macOS files
alias grdst='find . -type f -name .DS_Store -delete'
# You often need the path set up:
export PATH="$HOME/bin:$PATH"
@bxt
Copy link
Author

bxt commented Apr 15, 2014

Note: cd2 is another cool tool I created for bash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment