This works, but is not ideal
build.gradle.kts
buildscript {
dependencies {
# 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' | |
} |
@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") |
public class ReloadingScript { | |
/** | |
* The Class of the script | |
*/ | |
Class clazz | |
/** | |
* Runs the script in a Erlang-ish loop | |
* |
/* | |
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)] |
#!/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 |
#!/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. |
@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() |
import groovy.xml.XmlUtil | |
import java.security.SecureRandom | |
import java.text.SimpleDateFormat | |
void anonymize(Reader reader, Writer writer) { | |
def xml = new XmlParser().parse(reader) | |
xml.recordTarget.patientRole.with { patientRole -> | |
patientRole.id.each { |
Hapi: 2.604747 ms per cycle | |
LightHl7Lib: 0.00451332 ms per cycle |