Skip to content

Instantly share code, notes, and snippets.

@rahulsom
rahulsom / FirstPass.groovy
Last active August 29, 2015 14:08
CCD Analyzer
/*
* GPars (pronounced Jeepers) is a groovy library that offers multiple concurrency models - executors, parallel
* collections, actors, message passing, etc.
* So you can choose one depending on what you need.
*
* We just happen to use parallel collections
*/
@Grab("org.codehaus.gpars:gpars:1.2.1")
import groovyx.gpars.GParsPool
@rahulsom
rahulsom / Ele.groovy
Last active November 29, 2016 13:58
Mahout with Groovy - the faster way
@Grab(group = 'org.apache.mahout', module = 'mahout-core', version = '0.9')
import org.apache.mahout.cf.taste.impl.common.FastByIDMap
import org.apache.mahout.cf.taste.impl.common.FastIDSet
import org.apache.mahout.cf.taste.impl.model.file.FileDataModel
import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender
import org.apache.mahout.cf.taste.impl.similarity.TanimotoCoefficientSimilarity
def mlDir = '/Users/rahulsomasunderam/Downloads/ml-100k'
def f = new File("$mlDir/u.data")
@rahulsom
rahulsom / MMPReactiveStompClient.podspec
Created February 28, 2015 00:02
Podspec for Reactive Sockets
Pod::Spec.new do |s|
s.name = "MMPReactiveStompClient"
s.version = "0.1.4"
s.summary = "A reactive WebSocket/STOMP client based on ReactiveCocoa"
s.description = <<-DESC
MMPReactiveStompClient is a reactive WebSocket/STOMP client library based on ReactiveCocoa and SocketRocket.
Features:
* Signal for raw WebSocket.
* Signal for STOMP frames, messages, and subscription.
@rahulsom
rahulsom / aliases.sh
Last active August 29, 2015 14:16
Get Sprint Notes from JIRA
alias releaseNotes="groovy https://gist.githubusercontent.com/rahulsom/a7da12c7956ab08fce4b/raw/release-notes.groovy"
alias sprintNotes="groovy https://gist.githubusercontent.com/rahulsom/a7da12c7956ab08fce4b/raw/sprint-notes.groovy"
@rahulsom
rahulsom / lgtm.coffee
Created April 12, 2015 03:35
Hubot lgtm script
# Description:
# When someone says LGTM, presents an image from LGTM.in
#
# Will ignore users set in HUBOT_LGTM_IGNORE_USERS (by default, none).
#
# Dependencies:
# None
#
# HUBOT_LGTM_IGNORE_USERS (optional, format: "user1|user2", default "lgtm|jira")
#
@rahulsom
rahulsom / README.md
Created June 3, 2015 14:55
Confluence Calendar for Dashing

Confluence Calendar for Dashing

This is designed to pull out .ics representations of your calendar from confluence and render upcoming events.

@rahulsom
rahulsom / TypeForm.groovy
Created September 26, 2015 23:01
Turn TypeForm data into asciidoctor documents
/**
* TypeForm.groovy
*
* Generates asciidoctor output by analyzing a TypeForm survey
*
* 1. Setup an environment variable TYPEFORM_KEY from the account page on TypeForm.
* 2. Run this script with one arg - the code for your survey, e.g. `cC5Ur1`
* 3. Use Asciidoctor output in StdOut to do whatever you need to do.
*/
import groovy.json.JsonSlurper
@rahulsom
rahulsom / fs.css
Created February 12, 2016 23:21
CSS theme for Jenkins Delivery Pipeline to play well with Neo
body {
font-family: sans-serif;
background: #000000;
color: #fefefe;
font-size: 14px;
}
div.pipeline-loading-icon {
content: url("dark-load.gif");
}
@rahulsom
rahulsom / sendhl7.groovy
Created February 22, 2016 22:39
Send HL7 Message from file to host:port
@Grab('ca.uhn.hapi:hapi-base:2.1')
@Grab('ca.uhn.hapi:hapi-structures-v26:2.1')
import ca.uhn.hl7v2.DefaultHapiContext
import ca.uhn.hl7v2.HapiContext
import ca.uhn.hl7v2.app.ConnectionData
import ca.uhn.hl7v2.llp.LowerLayerProtocol
import ca.uhn.hl7v2.llp.MinLowerLayerProtocol
import ca.uhn.hl7v2.validation.builder.support.NoValidationBuilder
def cli = new CliBuilder()
/*
This is my solution to https://www.youtube.com/watch?v=LYKn0yUTIU4
Languages are hard. General assumptions:
1. What qualifies as a letter is hard to explain in some languages like most indic languages.
My definition of what comprises a letter is what takes up on character in UTF encoding.
2. Same applies to chinese. In Chinese there's symbols for the every letter that are unicode symbols.
That makes chinese almost similar to the decimal number system.
Q1. What's the smallest number to form an english sequence of 7?
7: [323 (three hundred twenty-three), 23 (twenty-three), 11 (eleven), 6 (six), 3 (three), 5 (five), 4 (four)]