Created
August 12, 2016 15:33
-
-
Save adkinss/777c546d92417370e806fbde4796d433 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
## Working bash_profile file. | |
### | |
# MacPorts | |
export PATH=/opt/local/libexec/gnubin:/opt/local/bin:/opt/local/sbin:~/bin:$PATH | |
export MANPATH=/opt/local/share/man:$MANPATH | |
export PS1="[\u@\h \W]$ " | |
test $WINDOW && PS1="[\u@\h$$WINDOW \W]\$ " | |
# Turn on color support for ls, but only if it is an interactive terminal. | |
# Requires MacPorts (sudo port install coreutils) | |
if [ "$TERM" != "dumb" ]; then | |
export LS_OPTIONS='--color=auto' | |
eval `dircolors ~/.dir_colors` | |
fi | |
# Turn on bash commandline completion. You can complete hostnames (from the | |
# /etc/hosts and ~/.ssh/known_hosts files), command options for some commands, | |
# file lists on remote servers when using "scp <hostname>:<tab tab>", etc. | |
# Requires MacPorts (sudo port install bash-completion) | |
if [ -f /opt/local/etc/bash_completion ]; then | |
. /opt/local/etc/bash_completion | |
fi | |
# $LS_OPTIONS likely enables color support. Also turn on human readable | |
# file sizes in the output (Kb, Mb, Gb, etc). Also adds a trailing character | |
# to filenames to indicate it is a directory (/) or a symbolic link (@). | |
alias ls='ls $LS_OPTIONS -hF' | |
# If SSH host keys are changing often (because of server rebuilds), turning | |
# off StrictHostKeyChecking allows you to get in despite warnings that the | |
# host key has changed without having to answer "yes/no" to the question. | |
# However, you should still run "ssh-keygen -R <hostname>" to remove the | |
# offending key from the ~/.ssh/known_hosts file. | |
alias ssh='ssh -o StrictHostKeyChecking=no' | |
# Use functions where aliases aren't powerful enough | |
function shadow_lastmod () { | |
if [ $# -eq 0 ]; then | |
expr `date +%s` / 86400 | |
else | |
perl -e "use Time::localtime; print ctime($1 * 86400)" | |
echo; echo `expr \`date +%s\` / 86400 - $1` days ago. | |
fi | |
} | |
# Converts one or more epoch time integers into a full dated time stream. | |
# You can generate an epoch time integer using Gnu Date with "date +%s". | |
# Example: $ ctime 1342317824 | |
# Output: 1342317824 = Sat Jul 14 22:03:44 2012 | |
function ctime () { | |
while [ $# -gt 0 ]; do | |
perl -e '$x = localtime('$1'); print "'$1' = $x\n"' | |
shift | |
done | |
} | |
# Allows Wireshark to be called from the command line. Also has the added | |
# benefit to allow more than one copy of Wireshark to run at the same time. | |
# http://www.wireshark.org/ (or use the MacPorts version) | |
function wireshark () { | |
/Applications/Wireshark.app/Contents/Resources/bin/wireshark 2>/dev/null & | |
} | |
# Allows DiffMerge to be called from the command line. | |
# http://www.sourcegear.com/diffmerge/ | |
function diffmerge () { | |
/Applications/DiffMerge.app/Contents/MacOS/DiffMerge $* 2>/dev/null & | |
} | |
# Dumps the entire contents of Redis to the screen. | |
# Requires MacPorts (sudo port install redis). | |
function redis () { | |
for i in `redis-cli keys '*'`; do | |
echo -n $i= | |
redis-cli get $i | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment