Skip to content

Instantly share code, notes, and snippets.

Rahul Somasunderam rahulsom

Block or report user

Report or block rahulsom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rahulsom
rahulsom / setup.sh
Last active Aug 15, 2019
Setup new mac
View setup.sh
#!/bin/bash
set -e
# Install OhYourDotfiles
git clone https://github.com/DanielThomas/oh-your-dotfiles.git ~/.oh-your-dotfiles
ln -s ~/.oh-your-dotfiles/oh-your.zshrc ~/.zshrc
chsh -s /bin/zsh
# Uncomment this to switch to brew managed zsh
@rahulsom
rahulsom / json2gclass.groovy
Last active May 29, 2018
Convert JSON to Groovy Class
View json2gclass.groovy
import groovy.json.JsonSlurper
import groovy.transform.Field
def json = new JsonSlurper().parse(System.in)
if (!(json instanceof Map)) {
System.err.println "Input was not json"
System.exit 1
}
@rahulsom
rahulsom / demo.adoc
Created Jan 29, 2018
Asciidoctor source with attributes subs bug demo
View demo.adoc

Demo

This works, but is not ideal

build.gradle.kts
buildscript {
    dependencies {
@rahulsom
rahulsom / .gitignore
Last active Sep 13, 2018
Protocol Buffers as a format for FHIR data
View .gitignore
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
@rahulsom
rahulsom / .gitignore
Last active Apr 5, 2018
Shorter Pretty Printed JSON
View .gitignore
.idea
out/
.idea_modules/
*.iml
View restart-audio-daemon.sh
# All this comes from https://twitter.com/viktorklang/status/807629003385237504
function restart_audio() {
command sudo killall coreaudiod && \
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist && \
sudo launchctl load /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist || \
return
echo 'Audio daemon restarted'
}
View wordlength.groovy
/*
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)]
@rahulsom
rahulsom / sendhl7.groovy
Created Feb 22, 2016
Send HL7 Message from file to host:port
View sendhl7.groovy
@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()
@rahulsom
rahulsom / fs.css
Created Feb 12, 2016
CSS theme for Jenkins Delivery Pipeline to play well with Neo
View fs.css
body {
font-family: sans-serif;
background: #000000;
color: #fefefe;
font-size: 14px;
}
div.pipeline-loading-icon {
content: url("dark-load.gif");
}
@rahulsom
rahulsom / TypeForm.groovy
Created Sep 26, 2015
Turn TypeForm data into asciidoctor documents
View TypeForm.groovy
/**
* 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
You can’t perform that action at this time.