Skip to content

Instantly share code, notes, and snippets.

@joubin
Created July 30, 2022 05:19
Show Gist options
  • Save joubin/3d9c16b81eee544d8fa0bbef651420ec to your computer and use it in GitHub Desktop.
Save joubin/3d9c16b81eee544d8fa0bbef651420ec to your computer and use it in GitHub Desktop.
# __ .__
# _______/ |_ ___.__.| | ____
# / ___/\ __< | || | _/ __ \
# \___ \ | | \___ || |_\ ___/
# /____ > |__| / ____||____/\___ >
# \/ \/ \/
autoload -U colors && colors
PS1="%{$fg[magenta]%}┌──%{$fg[red]%}%t - %n 💀 %d$reset_color"$'\n'"%{$fg[magenta]%}└─# %{$reset_color%}"
# __ .__
# ______ ___.__._/ |_| |__ ____ ____
# \____ < | |\ __\ | \ / _ \ / \
# | |_> >___ | | | | Y ( <_> ) | \
# | __// ____| |__| |___| /\____/|___| /
# |__| \/ \/ \/
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
export PATH="/usr/local/sbin:/Users/joubin/Library/Python/3.9/bin:$PATH"
export HOMEBREW_GITHUB_API_TOKEN=c2997ed90f23d32f4918f3f62b354b3fee929885
# .__ .__
# _____ | | |__|____ ______
# \__ \ | | | \__ \ / ___/
# / __ \| |_| |/ __ \_\___ \
# (____ /____/__(____ /____ >
# \/ \/ \/
alias airport='sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'
alias grep='grep --color=auto'
alias rsyncp='rsync -avz --no-perms --no-owner --no-group --progress'
alias perm='stat -f "%p"'
alias ovftool='/Applications/VMware\ Fusion.app/Contents/Library/VMware\ OVF\ Tool/ovftool'
alias vbox='/Applications/VirtualBox.app/Contents/MacOS/VBoxManage'
alias pwdx='printf "%q\n" "$(pwd)"'
alias sublime='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
alias cdns='dns e'
alias ucd="cd '/Users/joubin/Dropbox/UC Davis Extension Course'"
alias pandocd="docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pandoc/latex:latest"
alias java8='export PATH="/usr/local/opt/openjdk@8/bin:$PATH"'
alias java11='export PATH="/usr/local/opt/openjdk@11/bin:$PATH"'
alias java15='export PATH="/usr/local/opt/openjdk@15/bin:$PATH"'
alias java16='export PATH="/usr/local/opt/openjdk@16/bin:$PATH"'
alias bb="pushd /Users/joubin/Documents/Brew && brew bundle dump --all -f && popd"
# _____ __ .__
# _/ ____\_ __ ____ _____/ |_|__| ____ ____ ______
# \ __\ | \/ \_/ ___\ __\ |/ _ \ / \ / ___/
# | | | | / | \ \___| | | ( <_> ) | \\___ \
# |__| |____/|___| /\___ >__| |__|\____/|___| /____ >
# \/ \/ \/ \/
# changes dns servers
dns(){
case $1 in
9)
dserver=9.9.9.9
;;
8)
dserver=8.8.8.8
;;
1)
dserver=1.1.1.1
;;
h)
dserver=192.168.2.1
;;
e)
dserver=empty
;;
*)
dserver=$1
;;
esac
networksetup -setdnsservers Wi-Fi $dserver
}
# Changes the macaddress of a device
setmac(){
case $1 in
random)
mac=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
;;
iphone)
mac=40:98:AD:1D:35:c3
;;
'')
mac=88:e9:fe:86:c4:f2
;;
*)
mac=$1;
;;
esac
sudo ifconfig en0 lladdr $mac
sudo ifconfig en0 down
sleep 1
sudo ifconfig en0 up
}
# returns one of the ips returned by DNS fro a host.
getip(){
nslookup $1 | grep -i address | tail -n 1 | awk 'BEGIN{FS=": "}{print $2}'
}
# returns the external ip address
myip(){
curl https://joubin.me/ip.php
}
brew_clean(){
brew update
brew upgrade
brew cleanup -s
brew doctor
brew missing
brew cleanup
mas upgrade
}
stocks(){
tmp=$(mktemp)
while true; do /usr/local/bin/ticker.sh AAPL MSFT GOOG BTC-USD > $tmp; clear; cat $tmp; sleep 5; done
}
function notes {
code --new-window ~/Documents/notes
}
function kali {
image="kalilinux/kali"
if [ "$(docker ps -q -f name=kali)" ]; then
# if running - just start a shell
docker exec -it kali bash
elif [ "$(docker ps -aq -f name=kali)" ]; then
docker start kali && docker exec -it kali bash
else
docker run -it --name kali --privileged --network host $image bash
fi
}
function msf {
image="metasploitframework/metasploit-framework"
if [ "$(docker ps -q -f name=msf)" ]; then
# if running - just start a shell
docker exec -it msf
elif [ "$(docker ps -aq -f name=msf)" ]; then
docker start msf && docker exec -it msf
else
docker run -it --name msf --privileged --network host $image
fi
}
function dthreatspec {
docker run --rm -v $(pwd):/workingdir -w threatspec $@
}
export CONTAINER_HOST=ssh://vagrant@127.0.0.1:2222/run/podman/podman.sock
export CONTAINER_SSHKEY=/Users/joubin/podman/.vagrant/machines/default/virtualbox/private_key
export GH_TOKEN="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"
export HOMEBREW_GITHUB_API_TOKEN=$GH_TOKEN
function fawk {
first="awk '{print "
last="}'"
cmd="${first}\$${1}${last}"
eval $cmd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment