Skip to content

Instantly share code, notes, and snippets.

@rahulsom
rahulsom / setup.sh
Last active November 4, 2021 20:25
Setup new mac
#!/bin/bash
set -e
# Install OhYourDotfiles
cd $HOME
git clone https://github.com/DanielThomas/oh-your-dotfiles.git .oh-your-dotfiles
ln -s ~/.oh-your-dotfiles/oh-your.zshrc ~/.zshrc
@rahulsom
rahulsom / json2gclass.groovy
Last active February 9, 2022 00:08
Convert JSON to Groovy Class
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 January 29, 2018 05:08
Asciidoctor source with attributes subs bug demo

Demo

This works, but is not ideal

build.gradle.kts
buildscript {
    dependencies {
@rahulsom
rahulsom / .gitignore
Last active July 21, 2022 13:17
Protocol Buffers as a format for FHIR data
# 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 April 5, 2018 21:49
Shorter Pretty Printed JSON
.idea
out/
.idea_modules/
*.iml
@rahulsom
rahulsom / restart-audio-daemon.sh
Created December 10, 2016 19:09
Restart Audio Daemon
# 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'
}
/*
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 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()
@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 / 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