Skip to content

Instantly share code, notes, and snippets.

@oscarrenalias
oscarrenalias / AutoHotkey.ahk
Created March 24, 2012 19:59
Remap some keys in a Russian keyboard using AutoHotkey in Windows
º::<
ª::>
<^>!º::\
<^>!.::{
<^>!-::}
@oscarrenalias
oscarrenalias / gist:1480742
Created December 15, 2011 11:12
How to check if a string is actually a number without attempting to convert it first, in Scala
//
// Compile and run:
// scalac isnumber.scala
// scala IsNumber
//
// this is the class that provides the isNumber method when called on java.lang.String
class ExtendedString(s:String) {
def isNumber: Boolean = s.matches("[+-]?\\d+.?\\d+")
}
@oscarrenalias
oscarrenalias / gist:1394536
Created November 25, 2011 22:11
Command to create an SSH tunnel
ssh -i key.pem -v -2 -C -D 4567 -N user@server
-2: force SSH v2 protocol
-C: enable compression
-D <port>: use given local port
-N: do not run any command in the remote server
-v: verbose mode
@oscarrenalias
oscarrenalias / nodeserver.js
Created October 29, 2011 12:37
A very simple Node.js static file server, based on lightnode (https://github.com/ngspinners/lightnode)
//
// A very simple Node.js static file server and Ajax proxy, based on lightnode (https://github.com/ngspinners/lightnode)
//
// Requirements:
// Node.js
// npm for the installation of modules
// lightnode (installed via npm)
//
// How to use, with all dependencies in place:
// node nodeserver.js [/path/to/the/root/folder]
@oscarrenalias
oscarrenalias / nodeproxy.js
Created October 29, 2011 11:43
A very simple Node HTTP proxy that proxies requests to the server given in the GET or POST URL. Heavily inspired by http://www.catonmat.net/http-proxy-in-nodejs/.
//
// How to use:
//
// 1. Start node:
// node nodeproxy.js
// 2. Send a URL like this:
// http://localhost:8080/http://www.google.com
//
// Watch www.google.com come through your local HTTP proxy.
//
@oscarrenalias
oscarrenalias / pom.xml
Created October 4, 2011 17:33 — forked from lobster1234/pom.xml
Maven pom.xml compatible with Scala 2.9.1 with updated dependency versions. This is needed because the archetype:generate for scala-archetype-simple will be 2.8 and the tests will fail with 2.9.1.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.manish</groupId>
<artifactId>scala-simple</artifactId>
<version>1.0-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>My wonderfull scala app</description>
<inceptionYear>2010</inceptionYear>
<licenses>
<license>