forked from colonelpanic/dotfiles
Tweaks, add rvm add other things to bootstrap.
This commit is contained in:
@@ -139,6 +139,7 @@ class WiFiAutoSwitcher(object):
|
||||
if 'SSID' in status_dict:
|
||||
network = self._networks.get(status_dict['SSID'])
|
||||
if network is None:
|
||||
# Don't do anything if the current network is not recognized
|
||||
return
|
||||
if not network or network.should_switch(status_dict):
|
||||
log.debug("Attempting to switch networks from {0}, ".format(
|
||||
@@ -171,12 +172,14 @@ if __name__ == '__main__':
|
||||
log_util.enable_logger(__name__)
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-n', '--network', nargs='+', type=str, action='append', dest='networks')
|
||||
network_pairs = parser.parse_args().networks
|
||||
parser.add_argument('-s', '--sleep-time', type=int, dest='sleep_time')
|
||||
args = parser.parse_args()
|
||||
network_pairs = args.networks
|
||||
for network_pair in network_pairs:
|
||||
assert len(network_pair) == 2
|
||||
auto_switcher = WiFiAutoSwitcher(
|
||||
[Network(*ssid_password) for ssid_password in network_pairs]
|
||||
)
|
||||
while True:
|
||||
time.sleep(4)
|
||||
time.sleep(args.sleep_time)
|
||||
auto_switcher.switch_if_necessary()
|
||||
|
33
dotfiles/lib/shellenv.sh
Normal file
33
dotfiles/lib/shellenv.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
source ~/.lib/shellrc/functions.sh
|
||||
function add_to_front_of_path {
|
||||
export PATH=$@:$(echo $PATH | sed "s|:*$@||g" | sed "s|^:||")
|
||||
}
|
||||
|
||||
function add_to_back_of_path {
|
||||
export PATH=$(echo $PATH | sed "s|:*$@||g" | sed "s|^:||"):$@
|
||||
}
|
||||
|
||||
add_to_back_of_path "$HOME/.local/lib/python2.6/site-packages"
|
||||
add_to_back_of_path "$HOME/.rvm/bin"
|
||||
hash brew 2>/dev/null && add_to_front_of_path "$(brew --prefix coreutils)/libexec/gnubin"
|
||||
add_to_front_of_path "/usr/local/bin"
|
||||
hash brew 2>/dev/null && add_to_front_of_path "$(brew --prefix emacs)/libexec/gnubin"
|
||||
|
||||
if is_osx; then
|
||||
export CFLAGS=-Qunused-arguments
|
||||
export CPPFLAGS=-Qunused-arguments
|
||||
add_to_back_of_path "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/"
|
||||
export JAVA_HOME="$(find /Library/Java/JavaVirtualMachines -depth 1 | head -n 1)/Contents/Home"
|
||||
# Access gnu man pages.
|
||||
hash brew 2> /dev/null && export MANPATH="$(brew --prefix)/opt/coreutils/libexec/gnuman:$MANPATH"
|
||||
else
|
||||
export JAVA_HOME="$(update-alternatives --config java | get_cols ' -1' | head -n 1)"
|
||||
is_osx && export VISUAL="which emacsclient -c -n"
|
||||
fi
|
||||
|
||||
add_to_front_of_path "$JAVA_HOME/bin"
|
||||
|
||||
add_to_back_of_path "$(dotfiles_directory)/resources/python"
|
||||
add_to_back_of_path "/usr/local/sbin"
|
||||
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
Reference in New Issue
Block a user