Skip to content

Instantly share code, notes, and snippets.

@rahulsom
rahulsom / Directions.groovy
Created May 26, 2011 03:55
Demo to use Groovy, Grape, and Google Maps API to go from coast to coast
@groovy.lang.Grapes([
@groovy.lang.Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.5.0-RC2')
])
import groovyx.net.http.*
def http = new HTTPBuilder('https://maps.googleapis.com/maps/api/directions/')
http.get(path: 'json',
query: [
@rahulsom
rahulsom / blueprint-generate.sh
Created June 13, 2011 18:03
Generate blueprint css anywhere
#!/bin/bash -e
#
# Generates Blueprint files from a blueprint-settings.yml
#
TAG_TO_USE="v1.0.1" # Master is often messy
EXEC_DIR=$(pwd)
echo "Will run in ${EXEC_DIR}"
@rahulsom
rahulsom / BlueprintTagLib.groovy
Created June 16, 2011 21:48
Grails TagLib for Blueprint
/**
* Creates blueprint taglib to use blueprint css in a nice and clean way
* For generating css, see https://gist.github.com/1023323
*/
class BlueprintTagLib {
static namespace = "blueprint"
/**
* Uses a blueprint stylesheet set
*/
def use = { attrs, body ->
@rahulsom
rahulsom / AsyncTest.groovy
Created February 3, 2012 20:04
Async Http Client Infinite length connections
@Grapes([
@Grab('com.ning:async-http-client:1.7.0'),
@Grab(group = 'log4j', module = 'log4j', version = '1.2.16')
])
import org.apache.log4j.*
import com.ning.http.client.AsyncHttpClientConfig.Builder
import com.ning.http.client.*
import groovy.json.JsonSlurper
import java.util.concurrent.ExecutorService
@rahulsom
rahulsom / AdtGenerator.groovy
Created May 17, 2012 17:18
Generating random ADT Messages
@Grapes([
@Grab(group='com.github.groovy-wslite', module='groovy-wslite', version='0.7.0'),
@Grab('ca.uhn.hapi:hapi-base:2.0-alpha1'),
@Grab('ca.uhn.hapi:hapi-structures-v26:2.0-alpha1')
])
import wslite.rest.RESTClient
import java.security.SecureRandom
import java.text.DecimalFormat
import ca.uhn.hl7v2.app.*
@rahulsom
rahulsom / ssh-tunnel.sh
Last active February 28, 2016 13:33
SSH Tunneling
#!/bin/bash
#
# SSH Tunnel Manager
#
# SSH Flags:
# f - Force to background.
# N - Execute no commands. Don't open shell.
# q - Run quietly.
# T - Don't allocate pseudo TTY.
# R - Reverse Proxy.
@rahulsom
rahulsom / Demux.groovy
Created June 21, 2012 18:14
HL7 Demuxer
@Grapes([
@Grab('ca.uhn.hapi:hapi-base:1.2'),
@Grab('ca.uhn.hapi:hapi-structures-v26:1.2'),
@Grab('ca.uhn.hapi:hapi-structures-v251:1.2'),
@Grab('ca.uhn.hapi:hapi-structures-v25:1.2'),
@Grab('ca.uhn.hapi:hapi-structures-v24:1.2'),
@Grab('ca.uhn.hapi:hapi-structures-v231:1.2'),
@Grab('ca.uhn.hapi:hapi-structures-v23:1.2'),
@Grab('ca.uhn.hapi:hapi-structures-v22:1.2'),
@Grab('ca.uhn.hapi:hapi-structures-v21:1.2')
@rahulsom
rahulsom / nettest.sh
Created June 25, 2012 02:55
MacbookPro5,1 has a serious problem with it's wireless. Apple will not acknowledge it, but here's a fix
#!/bin/sh
#
# Tests network status and resets Airport if required
#
usage() {
cat << EOF
Usage: $0 options
-h HOST host to ping
-s <ON|OFF> say out loud: on or off default: OFF
@rahulsom
rahulsom / Foo.groovy
Created July 19, 2012 16:31
Reloading Scripts in groovy, Erlang style
public class ReloadingScript {
/**
* The Class of the script
*/
Class clazz
/**
* Runs the script in a Erlang-ish loop
*
@rahulsom
rahulsom / README.md
Created December 11, 2012 17:40
Switching JVMs in Mountain Lion

Switching JVMs in Mountain Lion

Apple made it incredibly difficult to switch JVMs since Mountain Lion. This might make it slightly easier.

Installation

  1. Download jvm.sh to ~/bin
  2. Create an alias for jvm.sh to jvm in ~/.profile or ~/.zshrc or whatever