Skip to content

Instantly share code, notes, and snippets.

@gardner
Last active June 23, 2017 12:22
Show Gist options
  • Save gardner/18c257e9b7cb8780c7b0f00678c3c95e to your computer and use it in GitHub Desktop.
Save gardner/18c257e9b7cb8780c7b0f00678c3c95e to your computer and use it in GitHub Desktop.
my bashrc
# find case-insensitive string within files using all cpu cores
alias f='time find . \( -name .git -o -name node_modules \) -prune -o -type f -print0 | xargs -0 -n1 -P8 grep -H'
# show which processes are listening on which ports as numbers
alias lsof="sudo lsof -iTCP -sTCP:LISTEN -P -n"
# "shell" into a docker instance
docker_ssh() {
container_id=$(docker ps | awk '{ print $1 " " $2}' | grep $1 | awk '{ print $1}')
docker container inspect $container_id | grep Image | tail -1 | awk '{ print $2 }'
echo $container_id
docker exec -i -t $container_id /bin/bash
}
alias ds=docker_ssh
## Java
export JAVA_HOME=$(/usr/libexec/java_home)
## Git
source /usr/local/etc/bash_completion.d/git-completion.bash
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-flow-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\u@\h:\w$(__git_ps1)\$ '
export CLICOLOR=1
## Network Diagnostics
alias mtr="sudo /usr/local/sbin/mtr 8.8.8.8"
## dump json from url
get_json() {
#do things with parameters like $1 such as
curl -s $1 | python -m json.tool
}
alias j=get_json
# spoof / change mac address
alias smac="sudo ifconfig en0 ether 34:36:3b:b0:0b:32"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment