Skip to content

Instantly share code, notes, and snippets.

@cpinto
cpinto / gist:305094
Created February 15, 2010 23:29
dropdown with most recently clicked items
<body>
<select id="teste">
<option>item 1</option>
<option>item 2</option>
<option>item 3</option>
<option>item 4</option>
</select>
<script src="js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function()
@cpinto
cpinto / hacked up ntlm proxy tunnel
Created July 28, 2009 12:04
I use this program to wrap putty, which doesn't support NTLM auth, setting the proxy type to telnet and create a SOCKS proxy to a remote SSH server.
package ntlmptunnel;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.NTCredentials;
@cpinto
cpinto / shortener.py
Created March 11, 2009 23:24
Single line url shortener in python
# usage: gen_token(n)
# Pass this the numerical ID of an URL at the cross reference table
# and you'll get a tinyurl-like base36 string
gen_token=lambda n,cs="0123456789abcdefghijklmnopqrstuvwxyz":(lambda b=len(cs):cs[n%b]+gen_token((n-(n%b))/b))() if n else ""