Skip to content

Instantly share code, notes, and snippets.

@nealrs
Last active July 25, 2021 04:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nealrs/ff616607bf1e03b1de04 to your computer and use it in GitHub Desktop.
Save nealrs/ff616607bf1e03b1de04 to your computer and use it in GitHub Desktop.
my oh-my-zsh config
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
#autoenv
source /usr/local/opt/autoenv/activate.sh
source ~/.autoenv/activate.sh
#tmpdir
if [ -f $(which tmpdir-tab) ]; then
. $(which tmpdir-tab)
fi
# plugins
plugins=(git ruby brew gem osx npm pip python)
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
ZSH_THEME="ys"
# add k command - https://github.com/supercrabtree/k
source ~/Documents/archives/misc/k.sh
# simple server
alias sv='open http://localhost:8000 && python -m SimpleHTTPServer'
alias serve='python -m SimpleHTTPServer'
# new atom window + start livereload server + open chrome
alias atl="atom && open /Applications/Google\ Chrome.app 'http://localhost:35729/' && livereload"
# add poncho weather script
alias p="python ~/sites/poncho\ chrome/cli/poncho.py 7ZZrr"
# get spotify info for current track
alias spot="~/Sites/SpotifyInfo/spotifyInfo all"
# Example aliases
alias zshconfig="edit ~/.zshrc"
alias ohmyzsh="edit ~/.oh-my-zsh"
# gitjk
alias gitjk="history 10 | tail -r | gitjk_cmd"
# push jekyll blog to s3
# alias jp="s3_website push"
# Set this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often to auto-update? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment following line if you want to the command execution time stamp shown
# in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
#plugins=(git)
source $ZSH/oh-my-zsh.sh
# User configuration
export PATH="/Users/neal/.rvm/gems/ruby-2.0.0-p247/bin:/Users/neal/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/neal/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/neal/.rvm/bin:/Users/neal/mygo/bin:/usr/local/git/bin:/sw/bin/:/usr/local/bin:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/bin/"
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# # Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# old bash crap
## Basic Aliases
alias sites='cd ~/sites'
alias push_pages='git push -f origin master:gh-pages'
alias DT='tee ~/Desktop/terminalOut.txt' # Pipe content to file on MacOS Desktop
alias dsclean='find . -type f -name .DS_Store -print0 | xargs -0 rm' #recursively eliminate .DS_Store files
alias rb='ruby' #shortened ruby exec
alias py='python' #shortened ruby exec
alias ngrok='/applications/ngrok'
alias dbu='/applications/dropbox_uploader/dropbox_uploader.sh'
alias bower='noglob bower'
alias echeck='python check.py' # for linked in checking scripts
alias jserve='jekyll serve --drafts --watch'
## Set Paths
export PATH="$PATH:/usr/local/bin/"
export PATH="/usr/local/git/bin:/sw/bin/:/usr/local/bin:/usr/local/:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages:$PYTHONPATH
export GOPATH=/Users/neal/mygo/
export PATH=$GOPATH/bin:$PATH
## load RVM into shell session
## Network stuff
alias myip='curl ip.appspot.com' # myip: Public facing IP Address
alias netCons='lsof -i' # netCons: Show all open TCP/IP sockets
alias flushDNS='dscacheutil -flushcache' # flushDNS: Flush out the DNS Cache
alias lsock='sudo /usr/sbin/lsof -i -P' # lsock: Display open sockets
alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP' # lsockU: Display only open UDP sockets
alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP' # lsockT: Display only open TCP sockets
alias ipInfo0='ipconfig getpacket en0' # ipInfo0: Get info on connections for en0
alias ipInfo1='ipconfig getpacket en1' # ipInfo1: Get info on connections for en1
alias openPorts='sudo lsof -i | grep LISTEN' # openPorts: All listening connections
alias showBlocked='sudo ipfw list' # showBlocked: All ipfw rules inc/ blocked IPs
alias localip='ifconfig en0 | grep inet | grep -v inet6'
## Odd Utility functions
# ii: display useful host related informaton
ii() {
echo -e "\nYou are logged on ${RED}$HOST"
echo -e "\nAdditionnal information:$NC " ; uname -a
echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Current network location :$NC " ; scselect
echo -e "\n${RED}Public facing IP Address :$NC " ;myip
#echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns
echo
}
# mcd: make and navigate into a new directory
mcd() {
mkdir -p "$1" && cd "$1";
}
## Convert quicktime mov to animated gif & upload to dropbox -- Neal Shyam [@nealrs]
## inspired by: https://gist.github.com/dergachev/4627207 & http://stackoverflow.com/questions/17650703/random-string-in-linux-by-system-time
## requires: ffmpeg, Xquartz, gifsicle (use homebrew) and Dropbox-Uploader
## if you want to use the dropbox integration, you'll need to setup Dropbox Uploader (https://github.com/andreafabrizi/Dropbox-Uploader), create a new DB app, and alias it as 'dbu' in your bash_profile.
movgif(){
# check for input file
if [ -z "$1" ]
then
echo "$(tput setaf 1)$(tput setab 7)PROPER USAGE: $ movgif input.mov [max width in pixels]$(tput sgr 0)"
kill -INT $$
fi
# check for & set maxsize
if [ ! -z "$2" ]
then
maxsize="-vf scale=$2:-1"
else
maxsize=""
fi
# set output & run conversion
out="$1_$(LC_CTYPE=C tr -cd '[:alnum:]' < /dev/urandom | fold -w8 | head -n1).gif"
ffmpeg -i $1 $maxsize -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $out
echo "$(tput setaf 2)output file: $out$(tput sgr 0)"
# upload to dropbox & get sharing link
dbu upload "$out" /
dbu share "$out"
}
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment