Jun 17 2010

Use an ssh server as a secure proxy [to access U.S.-only websites, and trick Megavideo for unlimited viewing!]

While trying to watch some World Cup matches online while in Mexico, I stumbled upon many U.S.-only sites. I started reading about proxies again, and while there’s some decent proxy lists out there, you still have to hunt for a good, fast one and when I tried many of them some videos would still have trouble opening.

Instead, I found this article on using an ssh connection as a proxy to route all internet requests through it. As they say, most webhosts provide ssh access and I’ve confirmed the method works with my DreamHost ssh connection, for example. I use the -C argument to compress data, and the connection is virtually as fast as with no proxy at all.

You can change Firefox’s settings directly, as they explain, but if you want a more practical way to switch back and forth between the default settings and the proxy, you can use FoxyProxy, a Firefox extension to handle different proxies and even specify which websites use which proxy. Just make sure to check the SOCKS option to get the ssh-proxy method working:

FoxyProxy settings for ssh server

FoxyProxy settings for ssh server

So this is cool if you’re abroad and want to get to Hulu, Pandora, or any U.S.-only site, or just want to encrypt your connection. It saved me the proxy testing, and everything has worked for me so far as it would with no proxy.

Unlimited Megavideo, other restricting sites?

Even if you’re in the U.S. and can access all these sites, I have found one more bonus benefit of the proxy setup for Megavideo fans, such as myself: when you exhaust your viewing time using your default computer connection, switch to the ssh proxy. Megavideo thinks the request comes from the computer you’re ssh’d into! Exhaust the proxy’s viewing limit, then come back to your computer to keep watching :) .

All methods to trick Megavideo I’ve seen involve resetting your router, if not digging deep into the browser’s cache settings, plus I never really got them to work consistently, so this has been a great, practical solution for me.

I also feel like this would work as a workaround for other sites that make you wait (Rapidshare, etc?) so give it a try.


May 4 2010

More SVN tips

Flag a file to be ignored by SVN updates/commits

Good tip here

Use svn and git together

See this (though when they say “/opt/local/libexex/git-core” they have a typo and they mean “/opt/local/libexec/git-core”) and this


May 2 2010

Activate HTC G1 on wi-fi without a data plan SIM card

I remember somewhere in my head the CyanogenMod ROM having the option to choose a wireless network instead of an APN when you do a clean install and find yourself on the “Touch the android to begin” screen to start activating your phone, but lately I haven’t found that option anymore.

I’ve read many ways to try to do it through wi-fi, but the one that I find easiest and that has always worked for me is to connect the phone to my computer as it is on that screen, open the terminal on my computer, and then do:

adb shell
am start -a android.intent.action.MAIN -n com.android.settings/.Settings

This opens the Settings screen on the phone and then you can connect to a wireless network from there.


Mar 29 2010

Simple svn usage

I just started really using svn. This is the way I would’ve liked it explained to me:

An svn repository is like a regular server, except it keeps track of changes to the files you upload in a neat way (and much more but that’s the main idea). Once you have the repository set up (I have Dreamhost and they make it really easy) you can start uploading anything that you want to keep track of, usually a project of some sort.

You commit changes to the repository (modifying, adding, deleting stuff) in svn. svn calls every change that you commit a revision and the default revision is zero when the repo is first created and empty. I’ve only used repos as a place to upload and keep track of my projects; that’s the simplest way to use it.

Let’s say I created my repo at svn.noemartinez.com/myproject. There’s many protocols you can access your repo through, depending on the setup. Dreamhost lets you setup http/https (using “http://” prefix) users when you create the repo, but you can also access it using your existing ssh users (using “svn+ssh” prefix) for the domain.

One thing is, when you try to use the raw URLs, either http://svn.noemartinez.com/myproject or svn+ssh://svn.noemartinez.com/myproject, svn will take the username that you’re logged in with at the computer you’re using to access the repo, which is sometimes (usually) not the same as the http/ssh user you want to access the repo through. To use a the right user, the –username argument works for http (as the man page for svn says), for example

svn list --username [user] http://svn.noemartinez.com/myproject

but for ssh you have to use the syntax:

svn list svn+ssh://[user]@svn.noemartinez.com/myproject

In any case, the main svn commands you end up using for a simple project, in my opinion, are import, export, checkout, update and commit.

Usually, at the beginning you have an empty repo set up, and a bunch of files locally in a computer that you want to end up managing with svn (say, a folder called project). Initially, they are “unversioned” (meaning the svn repo is not linked to them and svn doesn’t know they’re in your computer). To import unversioned files to the repo at first, you use the import command, like this:

svn import --username [user] [path to project] http://svn.noemartinez.com/myproject

From then onwards, the folder project will be saved on the repository. However, the original project folder on the computer is still not a working copy (SVN still isn’t linked to it). To begin editing a working copy whose changes will be kept track of, you have to checkout the project from SVN now that it’s there. Use the command like this:

svn checkout --username [user] http://svn.noemartinez.com/myproject my-working-copy

So now you have a copy of the project in the folder my-working-copy that’s linked to the repo. You can go ahead and modify your project as much as you want. After some changes, or when you have something new working, for example, you’ll want to start updating the project on the repo. To do this, go to the folder you want to commit (usually the top folder, my-working-copy in this case), and use the commit command:

svn commit -m "I got a new feature working"

This submits all changes to the repository, creating a new revision of the project, and attaching the message “I got a new feature working” to this revision.

If you want to make sure your project is updated to the latest version (with all the changes all other users may have commited), use the update command:

svn update

Finally, if you ever want to have a copy of the project without all the svn information, that is, to have an unversioned copy again, use the export command, either using the repo directly, or using your working copy:

svn export --username [user] http://svn.noemartinez.com/myproject my-exported-project

or

svn export --username [user] my-working-copy my-exported-project