Created
January 24, 2012 03:34
-
-
Save abackstrom/1667628 to your computer and use it in GitHub Desktop.
Adam's Environment
This file contains hidden or 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
# | |
# adam's .bashrc file. | |
# | |
# | |
# See also: | |
# | |
# - [Subversion: Missing Features](http://sixohthree.com/972/subversion-missing-features) | |
# only run if we have an interactive shell. | |
[ -z "$PS1" ] && return | |
# fixes incorrect wrapping in screen(1) | |
shopt -s checkwinsize | |
# directory name (i.e. .., public_html) performs cd (missing in 10.7) | |
#shopt -s autocd | |
export HISTCONTROL=ignoreboth:erasedups | |
export HISTIGNORE="h:top:ls:ll:lld:p:tsocks:pwsafe *" | |
export HISTSIZE=10000 | |
shopt -s histappend cmdhist | |
export EDITOR=vim | |
export LESS=-S | |
export GIT_PAGER='less -R' | |
# iTerm2 tab names | |
setlabel fsck | |
# grep history with "h string" | |
h() | |
{ | |
if [ -z "$*" ]; then | |
history 20 | |
else | |
history | grep "$*" | |
fi | |
} | |
# brew install keychain (ssh-agent manager) | |
eval `keychain --eval --timeout 480 id_dsa --host fsck` | |
# brew install autojump ("j" shortcut to jump to directories) | |
. /usr/local/etc/autojump | |
alias cdweb=". ~/prog/cdweb/cdweb.sh" | |
# escape sequences supported by iTerm2 | |
function setlabel { echo -ne "\033]1;$1\007"; } | |
function settitle { echo -ne "\033]2;$1\007"; } | |
function growl { echo -ne "\033]9;$1\007"; } # some_long_process.sh ; growl "command complete" | |
# | |
# web server commands | |
# | |
function startweb() { sudo apachectl start ; } | |
function stopweb() { sudo apachectl stop ; } | |
function restartweb() { stopweb ; startweb ; } | |
function startdb() { mysql.server start "$*" ; } | |
function stopdb() { mysql.server stop ; } | |
function restartdb() { stopdb ; startdb ; } | |
# brew install dnsmasq (http://sixohthree.com/1679/better-local-dev-hostnames-with-dnsmasq) | |
function startdns() { sudo launchctl start uk.org.thekelleys.dnsmasq ; } | |
function stopdns() { sudo launchctl stop uk.org.thekelleys.dnsmasq ; } | |
function restartdns() { stopdns ; startdns ; } | |
function startall() { startweb ; startdb ; } | |
function stopall() { stopweb ; stopdb ; } | |
function restartall() { stopall ; startall ; } | |
# brew install ack (betterthangrep.com); support color escape sequences in pager | |
alias pack='ack --pager="less -R"' | |
# | |
# programmable completion. see also: http://sixohthree.com/867/bash-completion | |
# | |
# complete arguments to a command using files in a directory | |
# Example: "edsite <TAB>" to list (and then edit) nginx conf files | |
_adam_compgen() | |
{ | |
local cur dir | |
cur=${COMP_WORDS[COMP_CWORD]} | |
dir=$1 | |
COMPREPLY=( $( compgen -f "$dir/$cur" | cut -b $(( ${#dir} + 2 ))- ) ) | |
} | |
# `edsite example.com` to vi /etc/nginx/sites-available/example.com | |
edsite() | |
{ | |
vim "/etc/nginx/sites-available/$1" | |
} | |
# tab-complete arguments to edsite using files in sites-available | |
_edsite() | |
{ | |
_adam_compgen /etc/nginx/sites-available | |
} | |
complete -F _edsite edsite | |
# a2edsite is a built-in; add completion | |
_a2edsite() | |
{ | |
_adam_compgen /etc/apache2/sites-available | |
} | |
complete -F _a2edsite a2edsite | |
# | |
# ssh shortcuts to hosts. http://wiki.sixohthree.com/wiki/SSH | |
# | |
alias o='exec o' # simulate screen (local screen, one ssh connection per window) | |
alias p='exec p' # auto-screen | |
alias t='exec t' # auto-tmux |
This file contains hidden or 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
set mark-symlinked-directories on | |
set completion-ignore-case on | |
set show-all-if-ambiguous on | |
set visible-stats on |
This file contains hidden or 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
#!/bin/sh | |
# | |
# `cdweb` to create a datestamped directory in public_html | |
# for futzing with web stuff | |
# | |
DATE=$(date +%Y/%m/%d) | |
DIR=$HOME/public_html/$DATE | |
if [ ! -d "$DIR" ]; then | |
mkdir -p "$DIR" | |
fi | |
if [ -h ~/today ]; then | |
rm -f ~/today | |
fi | |
ln -s "$DIR" ~/today | |
echo http://static.bwerp.net/~adam/$DATE/ | |
cd $DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment