Created
October 1, 2011 00:57
-
-
Save avhm/1255447 to your computer and use it in GitHub Desktop.
Proxy setup
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
# Edit proxy setup | |
alias proxyConf='mate ~/Git/hoxy/rules/rules.txt' | |
#Enable redirecting traffic through a local proxy | |
function proxyEnable() { | |
# Using configuring system preferences | |
echo "Enabling proxy..."; | |
networksetup -setwebproxy Ethernet 127.0.0.1 8080; | |
networksetup -setwebproxy Wi-Fi 127.0.0.1 8080; | |
# Ensure our proxy is enabled | |
networksetup -setwebproxystate Ethernet on; | |
networksetup -setwebproxystate Wi-Fi on; | |
} | |
function proxyDisable() { | |
# When the node instance is terminated, disable the proxy again | |
echo "Disabling proxy..."; | |
networksetup -setwebproxystate Ethernet off; | |
networksetup -setwebproxystate Wi-Fi off; | |
} | |
# Start the local proxy and configure the system to use it | |
function proxy() { | |
proxyEnable; | |
# Spawn our node instance, pass arguments if they exist | |
node ~/Git/hoxy/hoxy.js $1; | |
echo "\n"; | |
# Send a notification just in case this was a crash that i didnt notice | |
growlnotify -t 'Proxy output:' -m 'Proxy has terminated' | |
proxyDisable; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment