Categories
Main Tech Unix Work

Script to enable/disable SOCKS proxy on Mac OS X

I’m working in a coffee shop today. I used SSH and SOCKS to browse the Internet securely, but today I decided to take it a step further and automate the process with a shell script. Here’s the script, for what it’s worth:

#!/bin/bash
disable_proxy()
{
        networksetup -setsocksfirewallproxystate Wi-Fi off
        networksetup -setsocksfirewallproxystate Ethernet off
        echo "SOCKS proxy disabled."
}
trap disable_proxy INT

networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 9999
networksetup -setsocksfirewallproxy Ethernet 127.0.0.1 9999
networksetup -setsocksfirewallproxystate Wi-Fi on
networksetup -setsocksfirewallproxystate Ethernet on
echo "SOCKS proxy enabled."
echo "Tunneling..."
ssh -ND 9999 MYHOST.macminicolo.net

Instructions:

  1. Save this to a file. I saved it to “/Users/richard/bin/ssh_tunnel”.
  2. Make it executable and run it.
    $ chmod a+x /Users/richard/bin/ssh_tunnel
    $ /Users/richard/bin/ssh_tunnel
    
  3. It creates an SSH tunnel to my dedicated server at macminicolo.net and routes Internet traffic through that server.
  4. Hit Control-C to quit. The proxy is disabled. No need to fiddle with Network Preferences manually.

UPDATE March 18, 2011: I haven’t tried it, but Sidestep appears to be a free Mac OS X app that will enable SSH tunneling automatically when you connect to an insecure network.

Categories
Main Work

Oneness

Oneness with work is “flow”.

Flow is the mental state of operation in which the person is fully immersed in what he or she is doing, characterized by a feeling of energized focus, full involvement, and success in the process of the activity. (source)

The act of creating something, whether it be an article, a poem, a website, a computer program, or some other creative human expression, is one of my most cherished activities. … It usually takes a while for me to fully enter the highly creative flow state, but once I’m there I lose awareness of everything but the present moment and the ideas flowing through me. (source)

Oneness with surroundings is a principle of Eastern thought.

…practitioners of Eastern religions such as Buddhism and Taoism have honed the discipline of overcoming the duality of self and object as a central feature of spiritual development. (source)

The idea of overcoming duality of self and object is a key theme of Zen and the Art of Motorcycle Maintenance: An Inquiry into Values by Robert Pirsig (1974). “When you’re not dominated by feelings of separateness from what you’re working on, then you can be said to ‘care’ about what you’re doing. That is what caring really is: ‘a feeling of identification with what one’s doing.’ (ibid.)

Oneness with people is a Christian virtue.

…be of one mind, live in peace; and the God of love and peace shall be with you. (source)

And the Lord called his people Zion, because they were of one heart and one mind… (source)

Oneness with God comes through the Atonement of Jesus

The word [Atonement] describes the setting “at one” of those who have been estranged, and denotes the reconciliation of man to God. (source)

And now Father, I pray unto thee for them … that they may believe in me, that I may be in them as thou, Father, art in me, that we may be one. (source)