Skip to content

Instantly share code, notes, and snippets.

@schmmd
schmmd / technologies.md
Last active August 29, 2015 14:14
New Technologies at AI2

New Technologies at AI2

stretch


Scala 2.11 -- Why Upgrade

left fit

@schmmd
schmmd / gist:08dadd870df5b8f067b4
Created January 23, 2015 17:19
AllenAI Organizational Header
/** Allen Institute for AI
* @author Jesse Kinkead
* @author Michael Schmitz
*/
object Unfold extends App {
def read(pos: Int, num: Int): Seq[Int] = {
val data = (0 to 100).toVector
data.drop(pos).take(num)
}
def unfold[A, B](seed: B)(f: B => Option[(B, A)]) = {
def loop(seed: B)(ls: Stream[A]): Stream[A] = f(seed) match {
case Some((b, a)) => loop(b)(a #:: ls)
case None => ls
(for (line <- Source.fromFile(file) if someCondition(x)) yield {
(synonyms.toSet, canonicalForm)
}).toMap
def all[T : RootJsonFormat](esDocConf: ESDocConf, batchSize: Int = 100): Iterator[T] =
new Iterator[T] {
var i = 0
private def read() = {
val items = read(esDocConf, i * batchSize, batchSize)
i = i + 1
items
}
private var batch = read()
@schmmd
schmmd / pre-commit
Created May 7, 2014 16:54
Scalariform Precommit
#!/bin/sh
exec scala -savecompiled "$0" $@
!#
//
// Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
// Modified 2014 AI2 <http://www.allenai.org>
//
// This script will check that the commit is correctly formatted. It only checks files that are to be committed.
// To be run this file should be at `.git/hooks/pre-commit`.
And := PatternTagger {
<string=/and|that|which/>
}
Help := PatternTagger {
<string=/(help|aid|allow|assist|enable)(s)?/>
}
EffectRel := TypePatternTagger {
// in order for
(?:<string="in"> <string="order"> <string=/for|that/> )
@schmmd
schmmd / scalaresources.md
Last active December 28, 2015 08:59
Scala Resources

Learning

Programming in Scala. Written by the author of Scala, this is the authoritative source. Martin Odersky is very thorough and concise. The first edition is available for free online.

Scala Documentation. The community and Typesafe have done a much better job about aggregating knowledge about learning Scala. There is a tutorial for Java developers and they are working on tutorials for Ruby and Python developers.

Scala for Java Refugees. I remember this blog series being helpful.

Neophyte's Guide to Scala

@schmmd
schmmd / gist:7472349
Created November 14, 2013 18:56
Upgrade OpenJDK to 1.7.0 on EC2
sudo yum install jre-1.7.0-openjdk
# I don't know what 20000 is for
sudo alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java 20000
# elect 1.7.0
update-alternatives --config java
# test it out
java -version
@schmmd
schmmd / github.md
Last active December 26, 2015 19:09
Upload to github

First make sure you have ssh access to your GitHub account. This will make all future interactions with GitHub much easier.

https://help.github.com/articles/generating-ssh-keys

Next you can:

  1. Create a new repository on github.com/vulcanhalo.

  2. If you do not yet have a git repository: