Tunnel SSH through a proxy on MacOS X Mountain Lion

Until recently my workplace allowed direct ssh traffic to pretty much anywhere.  They recently blocked this, which makes sense from a security point of view but is very inconvenient at times.  Luckily it is pretty easy to tunnel ssh through our http proxy so I can still get to external hosts and they can still monitor what I am doing.

The first step is to install Xcode if you haven’t already.  In Mountain Lion, Xcode is now available through the Mac App Store.  After you’ve installed Xcode, you’ll need to install the command line tools.  Launch Xcode and go to Preferences > Downloads to install the command line tools.

Next, download corkscrew.  The corkscrew README has more or less everything you need to know from here, but the basic procedure is to launch Terminal and then enter the following commands:

cd ~/Downloads
tar -xfv corkscrew-2.0.tar
cd corkscrew-2.0
./configure --host=apple

The configure command is the only part that varies from the README.  Without specifying the host I was getting an error “configure: error: can not guess host type; you must specify one”.  After configure is done, then run two more commands.

make
sudo make install

Next you will need to create the file ~/.ssh/config if it doesn’t already exist and add the following lines, where proxy.example.com is your proxy server and 8080 is the port it is listening on:

ProxyCommand /usr/local/bin/corkscrew proxy.example.com 8080 %h %p

If your proxy requires authentication like mine then you need to modify your ~/.ssh/config slightly.

ProxyCommand /usr/local/bin/corkscrew proxy.example.com 8080 %h %p ~/.ssh/myauth

And then also create the file ~/.ssh/myauth and put your username and password for the proxy in it.

username:password

You should also modify the permissions on myauth for a little added security.

chmod 600 ~/.ssh/myauth

Lastly, I only want to go through the proxy for external hosts.  The current setup will apply to all hosts.  You can modify the entry in the ~/.ssh/config file to apply only to a particular host or hosts.  If you only have a small number of hosts you need to access the simplest way would be to just put each entry on one line separated by whitespace.  If you want to get more advanced you can use pattern matching as described in the ssh config manpage.

Host host1.external.com host2.external.com
ProxyCommand /usr/local/bin/corkscrew proxy.example.com 8080 %h %p ~/.ssh/myauth

 

Posted in apple | Leave a comment

Reverse Scrolling on Windows 8

Somehow I managed to get a Mac Mini for my primary work desktop (even though my job is primarily Windows based).  I also have a company MacBook Air and an iMac at home.  So basically grown so used to the reverse scrolling introduced in Mac OS Lion that Windows drives me crazy now.  We’ve been evaluating Windows 8 and I’m trying to use it as my primary OS to immerse myself but I just can’t take the “normal” scrolling, especially when I’m using it on my MacBook.

There are lots of links on the internet pointing to 3rd party tools to modify this but eventually I found a better solution, editing one registry key.  That blog specifies Windows 7 but it also works on Windows 8.  In addition to “FlipFlopWheel” I also changed “FlipFlopHScroll”.

The steps, as copied from Volker Voecking’s blog are:

  1. Find the hardware ID of the mouse
    • Go to the mouse control panel
    • Select “Hardware” tab
    • Click “Properties” button
    • Select “Details” tab
    • From the drop-down list choose “Hardware IDs”
    • Save the VID*** entry ( e.g. VID_045E&PID_0039 )
  2. Find and change the corresponding configuration settings in the registry
    • Run regedit.exe
    • Open Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID
    • Here you should find an entry for the hardware ID of your mouse
    • In all sub-keys of the hardware id key look for the “DeviceParameters” key and change the “FlipFlopWheel” value from 0 to 1
  3. Make it work
    • Unplug the mouse
    • Count to five :-)
    • Plug the mouse back in
Posted in apple, windows | Leave a comment

Safari 6 Never Remember Passwords for Any Site

I never configure my browser to remember passwords for me.  I work on too many different computers to rely on my browser to remember things for me so I have my own system to keeping track of passwords.  Usually the first time I get a popup offering to remember my password on a new computer or browser I immediately go into the preferences and turn the feature off completely.

After upgrading to Mountain Lion, which included Safari 6, I couldn’t find this option.  You can choose to never remember passwords for a particular website but you are still prompted at least once for every website.  I asked google right after I upgraded and didn’t find an answer but after upgrading two more macs and living with Mountain Lion for a few weeks the popups were starting to wear on me.  Luckily by this time, google had an answer.  Apparently it the option is now under “autofill” instead of “passwords”.  If you turn off “usernames and passwords” you won’t be prompted to remember any more passwords.  Thanks google!

Posted in apple | Leave a comment

$10 Robot Platform – Part 3

I have sort of stalled out on my little robot project that I started documenting with part 1 and part 2 but I figured I’d at least throw up a post with my results.  The short version is the motors in the $10 RC car that I used as the basis for my project suck.  I’ve got some geared motors that I had ordered and orginally planned to use before I decided to try to hack the RC car that should work out better.  Apparently, geared motors are a good thing, which I discovered first hand.  I had it working okay on hardwood floors where the weeks could spin and slip a bit but in my garage with traction it was just too hard to control.  If I give it enough power to get over the inertia to start moving then it ends up moving way to fast.  I was thinking about working on the code to give it an inital burst of speed to get going and then scale back to a more controllable level but in the end I think it’s best to chalk it up to a learning experience and move on to Robot 2.0.

Anyway here are the final construction steps.

I made another bracket out of the aluminum flashing to mount a server to rotate the ping ultrasonic rangefinder so the robot can “see”.  It was just three bends and some trimming to make it fit the contour of the RC car base.  I cut the opening for the servo with a dremel tool.

 

I mounted an adafruit motor shield on top of the arduino to control the motors and the servo.  I used the servo 2 connector on the motor shield for the ping sensor.  The RC car has a holder for 4 AA batteries already so I ran those to the power on the motor shield while I used a little 9V battery box to power the arduino separately.  The 9V battery isn’t mounted securely in this picture, it’s just tucked in underneath the arduino bracket.

And that’s about it.  Everything worked more or less as expected but the motors just don’t have enough torque to move the thing unless I run them at such a high speed that it is too hard to control.  The little guy was smacking into everything in my garage before it had time to detect that something was in front of it.  Then it would go through the motions of turning until it found a clear path and run as fast as it could into the next object.

Posted in Uncategorized | Leave a comment

New Raspbian Image

I finally got around to setting up the new Raspbian image tonight. So far I’m really impressed with how well things have progressed since the debian image I had been using. There is a nice config tool to help with a lot of the initial setup stuff, although I did have to do some config.txt modifications in order to get any video at all on boot.  It even has an option to resize the partition on next boot to fill your SD card.  It’s still not what I would call “fast” for things like web browsing but for the short time I’ve been using it, it is noticeably better than the old debian image I had.  If you’re not sure about upgrading, I’d say it’s definitely worth the effort.  Of course one of the great things about the Raspberry Pi is that you can just pop in a different SD card so swapping the OS is a very minor compared to other PCs.

I also put it in it’s shiny new adafruit pi box which is very cool.  It’s a very clever design and looks cool with the board exposed and the LEDs doing their thing inside.

 

Posted in linux, raspberry pi | Leave a comment

$10 Robot Platform – Part 2

Previously I posted that I had picked up a Thunder Tumbler from CVS for $10.  This past weekend I started working on making it into a robot.  Here it is with the body off and the circuit board pulled out.  The coiled spring is the antenna.  I’m not going to use the existing circuit at all but I saved it because it might be useful for something else in the future.

I removed the front wheels because I plan to use it vertically.  The front wheels and/or the wheelie wheel are easily removed with just a few screws, which makes it very easy to customize to whatever configuration you want.  I also soldered some extensions onto the existing wires to make them easier to work with.

I don’t have a fancy laser cutter or 3d printer so I had to find a cheap and easy way to mount and arduino, sensors, etc.  I bought a 10 pack of aluminum flashing shingles for a few dollars from Home Depot and used a pair of tin snips to cut one to size.  It worked very well.

 

I used a spring loaded center punch to dent the spots where I needed to drill holes.  This keeps the drill bit from slipping away and helps you to drill precise holes with a handheld drill.

 

 

Here is the bracket I made attached to the base.  I already had the standoffs, I’ve been hoarding the leftover hardware from computer cases for decades, but you can pick them up from amazon for pretty cheap.

 

And here it is with the arduino mounted.  One of the mounting holes in the arduino is too close the surrounding components to fit a screw into.  For now I just glued a cardboard washer to the standoff to keep it from shorting anything.  I may remove the standoff completely, or look into some nylon standoffs so there is no risk of shorting anything.

So far I’m pretty happy with it.  For $10 you get a base, wheels, two motors, and a battery holder.  Not to mention the wireless transmitter and receiver which are also very hackable. The base can easily be set up for a three wheeled or four wheeled robot and there is plenty of room for mounting other stuff.  I think I may even stop by CVS and buy a few more to have around for future projects.

 

Posted in arduino, robots | Leave a comment

$10 Robot Platform

I was at a CVS drugstore yesterday and I noticed a radio controlled car for only $10.  I’m currently waiting for delivery of a battery holder, two motors, two wheels, a caster, and some motor mounts from sparkfun, and needless to say, they cost more than $10 combined.  So I figured I’d give it a shot and buy one.

The car is a Thunder Tumbler and it has terrible reviews on Amazon which is unsurprising.  As an RC car it is pretty awful.  The joysticks aren’t analog so the motors are on full speed or off.  It’s nearly impossible to steer and it pretty much always does wheelies and spins out.  I suppose that is the “tumbler” part of the name but the cheap plastic parts don’t hold up well to the abuse.

None of that really matters to me though because I plan to strip it down and just use the motors and base at much slower speeds.  It even has a nice little removable battery tray.  I don’t have any plans for the remote control or the existing motor control circuit but I will keep them around, they seem to be built with an RX-2B/TX-2B pair of chips and it could be fun/useful for some future project needing a simple wireless controller.  I’m just going to remove the existing electronics and control the motors with an adafruit motor shield.

After a little googling this morning, I find that I’m not the first person to have this idea.  You can see working examples here and here although I think I will try to use mine vertically, standing up on the wheelie wheel more like R2-D2.

Posted in arduino, robots | 2 Comments

Robocalypse

I’ve vaguely known about Arduino for a long time now but, to me, it’s been almost just background noise on the internet.  I’ve just never really given it any attention until recently.  People invariably compare the Raspberry Pi to the Arduino and there is lots of talk about using the GPIO header for many Arduino-like tasks.  Eventually the constant Arduino noise penetrated my thick skull and I started to look into it and all I can say is it’s amazing.  Things have progressed so far since I dropped out from studied electrical engineering at Michigan Tech.  I’ve forgotten most of what little I managed to learn in my first pass at college, but it hardly matters.  Arduino makes it easy and all the heavy lifting has already been done by people that actually got up and went to their classes.

Even as recently as ten years ago I had a friend (okay not that recent but time flies when you get old) that claimed he wanted to build a robot and, at the time, it seemed pretty unlikely to me that he could pull it off (no offense Russ) but now it’s crazy easy and cheap.  There is even a contest underway to build a robot for under $10.

Anyway, the point is, this Raspberry Pi of mine is likely to combine with an Arduino and I do my part to bring on the inevitable robocalypse.

Posted in arduino, raspberry pi, robots | Leave a comment

Raspberry PI HDMI to VGA adapter

Update:  It seems that the cable mentioned in this post may be unsafe for your Raspberry Pi.  Use at your own risk!

I’ve been using a cheap HDMI to DVI cable from monoprice to connect my raspi to my old Samsung monitor that usually is the second display for my iMac.  This worked fine except I had to give up my dual screen goodness that I had really come to enjoy.  The Samsung monitor also has a VGA input and it is easy to switch between two computers if one is hooked to each.  Originally it didn’t seem feasible to connect the raspi using the VGA input because converting HDMI to requires more than just a simple cable.  The raspi doesn’t output analog in its HDMI port so you need some sort of “active” conversion box to translate the digital HDMI to analog VGA and the general consensus on the raspberrypi.org forums was that this would probably not be cheap.  However there were some reports that a company called “Neewer” made a cheap cable that did the trick.  Apparently it has some sort of chip hidden in the dongle that does the conversion.  I ordered one from Amazon for about $15 and am happy to report that it works great.   The only thing I needed to do was modify my config.txt to set the resolution of my monitor.

config_hdmi_boost=4
disable_overscan=1
hdmi_drive=2
hdmi_group=2
hdmi_mode=58

The first two lines I had configured previously to get the HDMI-DVI cable working.  The next two lines I just copied from the wiki page about HDMI to VGA converters.  They may not have been necessary but I haven’t tried it without them.  The last line is the one that sets the resolution.  You can look up the hdmi mode value from the wiki.

 

 

Posted in raspberry pi | 4 Comments

More Raspbery Pi Display Tweaks

This is hardly worth posting but I’m trying to make a point of documenting everything I do with my Raspberry Pi early on so…

After I got the display working with the HDMI boost adjustment I’ve been pretty much ignoring the black border around the screen.  This is intentionally blank to correct for the overscan settings on televisions.  On my DVI monitor is serves no purpose but to waste screen space.  It is easily fixed by adding another entry to the config.txt file in the boot partition:  disable_overscan=1

 

Posted in Uncategorized | Leave a comment