Category Archives: Work

Script to enable/disable SOCKS proxy on Mac OS X

I’m working in a Starbucks today and, as usual on the road, 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.

Crankable widgets

The concept of transforming my tasks into “crankable widgets” helps me Get Things Done.

Imagine what it’s like to work in a factory: You are responsible for your part of the assembly line. The work may not be easy, but you know how to do it. You do it over and over. You are cranking out widgets.

Now think about your real job. It may not be like the factory at all. You create/troubleshoot/analyze things you’ve never created/troubleshooted/analyzed before. Experience helps — Phil Windley calls it “tacit knowledge” — but each particular task may be slightly new to you. Before “cranking” out each task, you must figure out exactly how to do it. Thinking must precede the doing. That’s why you’re called a knowledge worker.

If you find yourself procrastinating a task, it may be that you don’t know (exactly) how to do it. Your task needs more brain time. You must transform your task into a “crankable widget” — something you know exactly how to do.

Answering questions like these can help:

  • How do I do this task?
  • What part of this task is new to me?
  • If I were to watch a movie of myself doing this task, what would I see?
  • If I were to delegate this task to someone else, how would I describe it?

Sometimes a dreaded, procrastinated task becomes easy and even fulfilling after I’ve taken time to think about it.

(Thanks to David Allen and Merlin Mann for teaching me this concept.)

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)