remove yelp.sh remove brew.sh, move stuff from functino.sh to osx.sh set solarized as the default iTerm color theme.

This commit is contained in:
Ivan Malison 2014-10-27 21:24:15 -07:00
parent 607d515ee0
commit b7639346e1
6 changed files with 166 additions and 321 deletions

@ -1 +1 @@
Subproject commit c46c2aa8f5606ee6941ab4842b1ab56492666cfd
Subproject commit a7d48a261318561bf2df61f1a90d8998246d0e60

View File

@ -1,138 +0,0 @@
function get_brew() {
hash make &>/dev/null
if [ $? -ne 0 ]
then
echo "Make not found. Please install xcode developer tools."
return -1
fi
hash brew &>/dev/null && echo "Homebrew found!" || ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew update
}
function brew_install_items() {
for package_install_string in $@;
do
package_args=$package_install_string
if is_zsh;
then
# Horrible hack to induce word splitting.
eval "package_args=($package_install_string)"
fi
brew install $package_args;
done
}
# htop wont display all process information if the owner is not root
function fix_brew_htop() {
sudo chmod 777 $(readlink -f `which htop`)
sudo chown root $(readlink -f `which htop`)
sudo chmod 6555 `which htop`
}
function do_the_brew() {
ESSENTIAL=(
"emacs" \
"tmux" \
"python --with-brewed-openssl" \
"htop" \
"greadlink" \
"zsh" \
"make" \
"macvim --override-system-vim --custom-system-icons --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-perlinterp --enable-cscope" \
)
# `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
# core utilities (those that come with OS X are outdated)
BASICS=(
"findutils" \
"coreutils" \
"binutils" \
"diffutils" \
"ed --default-names" \
"gawk" \
"gnu-indent --default-names" \
"gnu-sed --default-names" \
"gnu-tar --default-names" \
"gnu-which --default-names" \
"gnutls --default-names" \
"grep --default-names" \
"gzip" \
"watch" \
"wdiff --with-gettext" \
"wget --enable-iri" \
)
SHOULD_INSTALL=(
"nmap" \
"readline" \
"netcat" \
"reattach-to-user-namespace" \
"daemonize" \
"ngrep" \
"gist" \
"gawk" \
"pstree" \
"ack" \
"hub" \
"tig" \
"heroku" \
"scala" \
"sbt" \
"node" \
"npm" \
)
MISC=("file-formula" \
"less" \
"openssh --with-brewed-openssl" \
"perl518" \
"rsync" \
"svn" \
"unzip" \
)
install_items=()
OPTIND=1
while getopts "uebsmah" OPTCHAR;
do
case $OPTCHAR in
u)
brew upgrade
;;
e)
install_items=("${install_items[@]}" "${ESSENTIAL[@]}")
fix_brew_htop
;;
b)
install_items=("${install_items[@]}" "${BASICS[@]}")
;;
s)
install_items=("${install_items[@]}" "${SHOULD_INSTALL[@]}")
;;
m)
install_items=("${install_items[@]}" "${MISC[@]}")
;;
a)
install_items=("${install_items[@]}" "${ESSENTIAL[@]}" "${BASICS[@]}" "${SHOULD_INSTALL[@]}" "${MISC[@]}")
;;
h)
do_the_brew_help
return
;;
esac
done
echo "Installing the following packages:"
for ((i = 0; i < ${#install_items[@]}; i++)); do printf '\t%s\n' "${install_items[$i]}"; done;
brew update
brew_install_items ${install_items}
brew cleanup
}
function do_the_brew_help() {
echo "do_the_brew Usage:
-a install all packages.
-u upgrade brew packages.
-e install essential packages
-b install GNU basics including replacements for non GNU versions included in OSX.
-s install a wider range of packages.
-m install very non-essential packages.
-h display this help message.
"
}

View File

@ -11,6 +11,11 @@ function _emacs {
\emacs --daemon="$server_name"
fi
emacsclient $* --server-file="$server_name"
if hash reattach-to-user-namespace 2> /dev/null; then
reattach-to-user-namespace emacsclient $* --server-file=$server_name
else
emacsclient $* --server-file=$server_name
fi
}
function _emacs_daemon_exists {

View File

@ -0,0 +1,77 @@
function set_global_osx_ssh_port {
set_osx_ssh_port $1 /System/Library/LaunchDaemons/ssh.plist
}
function set_osx_ssh_port {
sudo sed -i -n "/SockServiceName/{p;n;s/>.*</>$1</;};p" $2; echo "SSH Port $1. Restart service for changes to take effect."
}
function enable_access_for_assistive_devices {
local bundle_identifier=$(/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' "$1/Contents/Info.plist")
local where_clause="where service='kTCCServiceAccessibility' and client='$bundle_identifier'"
local search_string="SELECT * from access ${where_clause};"
local values_string="VALUES('kTCCServiceAccessibility','$bundle_identifier',0,1,1,NULL)"
if test -z $(sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' $search_string);
then
local sql_string="INSERT INTO access $values_string;"
else
local sql_string="UPDATE access set allowed = 1 ${where_clause};"
fi
echo $sql_string
sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' $sql_string
}
function as_user {
local user="$1"
local user_pid=$(ps -axj | awk "/^$user / {print \$2;exit}")
local command="sudo /bin/launchctl bsexec $user_pid sudo -u '$user' $2"
echo "Running:"
echo "$command"
eval $command
}
function as_current_user {
as_user "$(whoami)" "$*"
}
function reload_user_agent {
as_current_user /bin/launchctl unload "$1"
as_current_user /bin/launchctl load "$1"
}
function reload_root_agent {
as_user 'root' "/bin/launchctl unload '$1'"
as_user 'root' "/bin/launchctl load '$1'"
}
function brew_for_multiple_users() {
sudo chgrp -R admin /usr/local
sudo chmod -R g+w /usr/local
sudo chgrp -R admin /Library/Caches/Homebrew
sudo chmod -R g+w /Library/Caches/Homebrew
}
function swap_audio() {
test -z $(SwitchAudioSource -c | grep HDMI) && SwitchAudioSource -s HDMI || SwitchAudioSource -s "Built-in Output"
}
function ss() {
osascript -e "tell application \"/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app\" to activate"
}
function set_modifier_keys_for_vendor_product_id() {
local mapping="<dict><key>HIDKeyboardModifierMappingDst</key><integer>$3</integer><key>HIDKeyboardModifierMappingSrc</key><integer>$2</integer></dict>"
echo $mapping
defaults -currentHost write -g com.apple.keyboard.modifiermapping.$1-0 -array-add "$mapping"
}
function set_modifier_keys_on_all_keyboards() {
for vendor_product_id in $(get_keyboard_vendor_id_product_id_pairs | tr " " "-"); do
set_modifier_keys_for_vendor_product_id $vendor_product_id 0 2; echo $vendor_product_id;
done;
}
function get_keyboard_vendor_id_product_id_pairs() {
ioreg -n IOHIDKeyboard -r | grep -e 'class IOHIDKeyboard' -e VendorID\" -e Product | gawk 'BEGIN { RS = "class IOHIDKeyboard" } match($0, /VendorID. = ([0-9]*)/, arr) { printf arr[1]} match($0, /ProductID. = ([0-9]*)/, arr) { printf " %s\n", arr[1]} '
}

View File

@ -1,88 +0,0 @@
alias i="ipython tools/interactive.py"
alias apperror="tools/scribereader -e prod -f apperror | tools/pretty_error_log"
alias environ=". ~/.pgconf-$USER/environ.sh"
alias ym="cd ~/pg/yelp-main"
alias live="cd /nail/live/yelp"
alias sb="sandbox -vv --minimal"
function fix_environment_script() {
sed -i 's/export YELP_CONFIG:yelp_conn:replication_delay_params.*$//' $YELP_SANDBOX_ROOT/environment.sh
}
function get_sandbox_identifier() {
echo $YELP_SANDBOX_ROOT | gawk 'match($0, /pgconf-.*-(.*)/, matched) {print matched[1]}'
}
function is_proddb() {
python 2>/dev/null - <<END
import os
import sys
import yaml
def is_proddb_from_topology_info(topology_info):
for cluster_info in topology_info['topology']:
if cluster_info['cluster'] == 'primary':
return cluster_info['entries'][0]['host'] != '127.0.0.1'
def is_proddb_from_topology_filename(topology_filename):
with open(topology_filename) as topology_file:
return is_proddb_from_topology_info(yaml.load(topology_file))
def is_proddb():
try:
topology_filename = os.environ.get('TOPOLOGY_FILE')
if topology_filename:
return is_proddb_from_topology_filename(topology_filename)
return False
except:
pass
sys.exit(0 if is_proddb() else 1)
END
}
function sandbox_prompt_info() {
local sandbox_string=''
if is_proddb
then
sandbox_string="proddb "
fi
if [ "$YELP_IN_SANDBOX" ];
then
sandbox_string=$sandbox_string"sandbox-$(get_sandbox_identifier)"
elif [ ! -z "$(env | grep yelp | head)" ] && git branch 1>/dev/null 2>/dev/null;
then
sandbox_string="no sandbox"
fi
echo $sandbox_string
}
function bash_sandbox_color() {
if [ $YELP_IN_SANDBOX ]
then
sandbox_color='\e[0;33m'
else
sandbox_color='\e[0;31m'
fi
}
function zsh_sandbox_color() {
if [ $YELP_IN_SANDBOX ]
then
sandbox_color="%{$FG[149]%}"
else
sandbox_color="%{$FG[001]%}"
fi
echo $sandbox_color
}
function colored_sandbox_string() {
if [ is_zsh ];
then
sandbox_color=$(zsh_sandbox_color)
else
sandbox_color=$(bash_sandbox_color)
fi
echo "$sandbox_color$(sandbox_prompt_info)%{$reset_color%}"
}

View File

@ -5218,11 +5218,11 @@
<key>MaxVertically</key>
<false/>
<key>NSColorPanelMode</key>
<string>1</string>
<key>NSColorPickerSlidersDefaults</key>
<string>1</string>
<string>7</string>
<key>NSFontPanelAttributes</key>
<string>1, 0</string>
<key>NSNavLastRootDirectory</key>
<string>~/dotfiles</string>
<string>~</string>
<key>NSQuotedKeystrokeBinding</key>
<string></string>
<key>NSRepeatCountBinding</key>
@ -5246,32 +5246,21 @@
<array/>
<key>NSTableView Sort Ordering KeyBingingTable</key>
<array/>
<key>NSToolbar Configuration Terminal Toolbar</key>
<dict>
<key>TB Display Mode</key>
<integer>1</integer>
<key>TB Icon Size Mode</key>
<integer>1</integer>
<key>TB Is Shown</key>
<integer>0</integer>
<key>TB Size Mode</key>
<integer>1</integer>
</dict>
<key>NSToolbar Configuration com.apple.NSColorPanel</key>
<dict>
<key>TB Is Shown</key>
<integer>1</integer>
</dict>
<key>NSWindow Frame NSColorPanel</key>
<string>1180 103 231 329 0 0 1440 877 </string>
<string>427 356 222 309 0 0 1920 1057 </string>
<key>NSWindow Frame Preferences</key>
<string>401 365 924 485 0 0 1440 900 </string>
<string>491 152 924 485 0 0 1920 1080 </string>
<key>NSWindow Frame SUStatusFrame</key>
<string>528 562 384 129 0 0 1440 878 </string>
<key>NSWindow Frame UKCrashReporter</key>
<string>99 294 592 584 0 0 1440 878 </string>
<string>768 697 384 129 0 0 1920 1058 </string>
<key>NSWindow Frame iTerm Window 0</key>
<string>4 446 717 431 0 0 1440 877 </string>
<string>757 309 585 401 0 0 1920 1057 </string>
<key>NSWindow Frame iTerm Window 1</key>
<string>474 103 1264 896 0 0 1920 1057 </string>
<key>New Bookmarks</key>
<array>
<dict>
@ -5284,146 +5273,146 @@
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.12941177189350128</real>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.12156862765550613</real>
<real>0.15575926005840302</real>
<key>Red Component</key>
<real>0.11372549086809158</real>
<real>0.0</real>
</dict>
<key>Ansi 1 Color</key>
<dict>
<key>Blue Component</key>
<real>0.40000000596046448</real>
<real>0.14145714044570923</real>
<key>Green Component</key>
<real>0.40000000596046448</real>
<real>0.10840655118227005</real>
<key>Red Component</key>
<real>0.80000001192092896</real>
<real>0.81926977634429932</real>
</dict>
<key>Ansi 10 Color</key>
<dict>
<key>Blue Component</key>
<real>0.18039216101169586</real>
<real>0.38298487663269043</real>
<key>Green Component</key>
<real>0.16470588743686676</real>
<real>0.35665956139564514</real>
<key>Red Component</key>
<real>0.15686275064945221</real>
<real>0.27671992778778076</real>
</dict>
<key>Ansi 11 Color</key>
<dict>
<key>Blue Component</key>
<real>0.25490197539329529</real>
<real>0.43850564956665039</real>
<key>Green Component</key>
<real>0.23137255012989044</real>
<real>0.40717673301696777</real>
<key>Red Component</key>
<real>0.21568627655506134</real>
<real>0.32436618208885193</real>
</dict>
<key>Ansi 12 Color</key>
<dict>
<key>Blue Component</key>
<real>0.70588237047195435</real>
<real>0.51685798168182373</real>
<key>Green Component</key>
<real>0.71764707565307617</real>
<real>0.50962930917739868</real>
<key>Red Component</key>
<real>0.70588237047195435</real>
<real>0.44058024883270264</real>
</dict>
<key>Ansi 13 Color</key>
<dict>
<key>Blue Component</key>
<real>0.87843137979507446</real>
<real>0.72908437252044678</real>
<key>Green Component</key>
<real>0.87843137979507446</real>
<real>0.33896297216415405</real>
<key>Red Component</key>
<real>0.87843137979507446</real>
<real>0.34798634052276611</real>
</dict>
<key>Ansi 14 Color</key>
<dict>
<key>Blue Component</key>
<real>0.35294118523597717</real>
<real>0.56363654136657715</real>
<key>Green Component</key>
<real>0.40784314274787903</real>
<real>0.56485837697982788</real>
<key>Red Component</key>
<real>0.63921570777893066</real>
<real>0.50599193572998047</real>
</dict>
<key>Ansi 15 Color</key>
<dict>
<key>Blue Component</key>
<real>1</real>
<real>0.86405980587005615</real>
<key>Green Component</key>
<real>1</real>
<real>0.95794391632080078</real>
<key>Red Component</key>
<real>1</real>
<real>0.98943418264389038</real>
</dict>
<key>Ansi 2 Color</key>
<dict>
<key>Blue Component</key>
<real>0.40784314274787903</real>
<real>0.020208755508065224</real>
<key>Green Component</key>
<real>0.74117648601531982</real>
<real>0.54115492105484009</real>
<key>Red Component</key>
<real>0.70980393886566162</real>
<real>0.44977453351020813</real>
</dict>
<key>Ansi 3 Color</key>
<dict>
<key>Blue Component</key>
<real>0.45490196347236633</real>
<real>0.023484811186790466</real>
<key>Green Component</key>
<real>0.7764706015586853</real>
<real>0.46751424670219421</real>
<key>Red Component</key>
<real>0.94117647409439087</real>
<real>0.64746475219726562</real>
</dict>
<key>Ansi 4 Color</key>
<dict>
<key>Blue Component</key>
<real>0.7450980544090271</real>
<real>0.78231418132781982</real>
<key>Green Component</key>
<real>0.63529413938522339</real>
<real>0.46265947818756104</real>
<key>Red Component</key>
<real>0.5058823823928833</real>
<real>0.12754884362220764</real>
</dict>
<key>Ansi 5 Color</key>
<dict>
<key>Blue Component</key>
<real>0.73333334922790527</real>
<real>0.43516635894775391</real>
<key>Green Component</key>
<real>0.58039218187332153</real>
<real>0.10802463442087173</real>
<key>Red Component</key>
<real>0.69803923368453979</real>
<real>0.77738940715789795</real>
</dict>
<key>Ansi 6 Color</key>
<dict>
<key>Blue Component</key>
<real>0.71764707565307617</real>
<real>0.52502274513244629</real>
<key>Green Component</key>
<real>0.7450980544090271</real>
<real>0.57082360982894897</real>
<key>Red Component</key>
<real>0.54117649793624878</real>
<real>0.14679534733295441</real>
</dict>
<key>Ansi 7 Color</key>
<dict>
<key>Blue Component</key>
<real>0.7764706015586853</real>
<real>0.79781103134155273</real>
<key>Green Component</key>
<real>0.78431373834609985</real>
<real>0.89001238346099854</real>
<key>Red Component</key>
<real>0.77254903316497803</real>
<real>0.91611063480377197</real>
</dict>
<key>Ansi 8 Color</key>
<dict>
<key>Blue Component</key>
<real>0.58823531866073608</real>
<real>0.15170273184776306</real>
<key>Green Component</key>
<real>0.59607845544815063</real>
<real>0.11783610284328461</real>
<key>Red Component</key>
<real>0.58823531866073608</real>
<real>0.0</real>
</dict>
<key>Ansi 9 Color</key>
<dict>
<key>Blue Component</key>
<real>0.37254902720451355</real>
<real>0.073530435562133789</real>
<key>Green Component</key>
<real>0.57647061347961426</real>
<real>0.21325300633907318</real>
<key>Red Component</key>
<real>0.87058824300765991</real>
<real>0.74176257848739624</real>
</dict>
<key>Automatically Log</key>
<false/>
@ -5432,11 +5421,11 @@
<key>Background Color</key>
<dict>
<key>Blue Component</key>
<real>0.12941177189350128</real>
<real>0.15170273184776306</real>
<key>Green Component</key>
<real>0.12156862765550613</real>
<real>0.11783610284328461</real>
<key>Red Component</key>
<real>0.11372549086809158</real>
<real>0.0</real>
</dict>
<key>Background Image Is Tiled</key>
<false/>
@ -5455,11 +5444,11 @@
<key>Bold Color</key>
<dict>
<key>Blue Component</key>
<real>0.7764706015586853</real>
<real>0.56363654136657715</real>
<key>Green Component</key>
<real>0.78431373834609985</real>
<real>0.56485837697982788</real>
<key>Red Component</key>
<real>0.77254903316497803</real>
<real>0.50599193572998047</real>
</dict>
<key>Character Encoding</key>
<integer>4</integer>
@ -5472,20 +5461,20 @@
<key>Cursor Color</key>
<dict>
<key>Blue Component</key>
<real>0.7764706015586853</real>
<real>0.51685798168182373</real>
<key>Green Component</key>
<real>0.78431373834609985</real>
<real>0.50962930917739868</real>
<key>Red Component</key>
<real>0.77254903316497803</real>
<real>0.44058024883270264</real>
</dict>
<key>Cursor Text Color</key>
<dict>
<key>Blue Component</key>
<real>0.12941177189350128</real>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.12156862765550613</real>
<real>0.15575926005840302</real>
<key>Red Component</key>
<real>0.11372549086809158</real>
<real>0.0</real>
</dict>
<key>Cursor Type</key>
<integer>2</integer>
@ -5506,11 +5495,11 @@
<key>Foreground Color</key>
<dict>
<key>Blue Component</key>
<real>0.7764706015586853</real>
<real>0.51685798168182373</real>
<key>Green Component</key>
<real>0.78431373834609985</real>
<real>0.50962930917739868</real>
<key>Red Component</key>
<real>0.77254903316497803</real>
<real>0.44058024883270264</real>
</dict>
<key>Guid</key>
<string>3314520D-1E49-4605-AFCE-EA48A596636F</string>
@ -5852,20 +5841,20 @@
<key>Selected Text Color</key>
<dict>
<key>Blue Component</key>
<real>0.7764706015586853</real>
<real>0.56363654136657715</real>
<key>Green Component</key>
<real>0.78431373834609985</real>
<real>0.56485837697982788</real>
<key>Red Component</key>
<real>0.77254903316497803</real>
<real>0.50599193572998047</real>
</dict>
<key>Selection Color</key>
<dict>
<key>Blue Component</key>
<real>0.25490197539329529</real>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.23137255012989044</real>
<real>0.15575926005840302</real>
<key>Red Component</key>
<real>0.21568627655506134</real>
<real>0.0</real>
</dict>
<key>Semantic History</key>
<dict>
@ -6007,6 +5996,8 @@
<string>/Users/imalison</string>
</dict>
</array>
<key>NoSyncNeverRemindPrefsChangesLost</key>
<true/>
<key>OnlyWhenMoreTabs</key>
<true/>
<key>OpenArrangementAtStartup</key>
@ -6071,7 +6062,7 @@
<key>SUHasLaunchedBefore</key>
<true/>
<key>SULastCheckTime</key>
<date>2014-10-24T09:47:01Z</date>
<date>2014-10-27T21:23:05Z</date>
<key>SavePasteHistory</key>
<false/>
<key>Show Toolbelt</key>
@ -6100,8 +6091,6 @@
</array>
<key>TripleClickSelectsFullWrappedLines</key>
<false/>
<key>UKCrashReporterLastCrashReportDate</key>
<real>1404793472</real>
<key>URLHandlersByGuid</key>
<dict/>
<key>UseBorder</key>
@ -6125,6 +6114,6 @@
<key>findRegex_iTerm</key>
<false/>
<key>iTerm Version</key>
<string>1.0.0.20140629</string>
<string>2.0.0.20141022</string>
</dict>
</plist>