Skip to content

Instantly share code, notes, and snippets.

View tlockney's full-sized avatar
💭
Looking for what's next.

Thomas Lockney tlockney

💭
Looking for what's next.
View GitHub Profile
# transform a java property file into valid shell variables
awk 'BEGIN{FS=OFS="="}{gsub(/\#.*/,"")}{gsub(/\./,"_",$1)}{sub(/..*/,"\"&\"",$2)}1' $1
class Sub extends Super {
@Override
public void foo(java.util.Map<Object,Object> bar) {}
}
@tlockney
tlockney / ImplicitExample.scala
Created February 23, 2011 03:49
Here's a very simplified example of hiding an implicit in a companion object
// initial version
import scala.collection.immutable.TreeSet
class TreeMember[A] {
// some really important stuff here, of course! ;~)
}
class Main {
implicit val treeOrder = new Ordering[TreeMember[A]] {
def compare(a: TreeMember[A], b: TreeMember[A]) = {
// elided for simplicity's sake
}
@tlockney
tlockney / quick-haskell-emacs.applescript
Created November 11, 2011 01:39
Set up a frame for trying out simple haskell snippets
(defun make-quick-haskell-frame ()
"Creates a new frame running haskell-mode."
(make-frame '((name . "Quick Haskell")
(width . 120)
(height . 40)))
(select-frame-by-name "Quick Haskell")
(switch-to-buffer "Haskell")
(haskell-mode))
@tlockney
tlockney / gist:1964541
Created March 3, 2012 05:21
Install htop via Homebrew
# I always forget you can install homebrew formulas using direct URLs
brew install https://raw.github.com/adamv/homebrew-alt/master/unmaintained/htop.rb
@tlockney
tlockney / hack.sh
Created April 7, 2012 00:20 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
val javaRuntimeOptions = Seq(
"-Xmx2048M",
"-XX:+UseConcMarkSweepGC",
"-XX:+CMSClassUnloadingEnabled",
"-XX:MaxPermSize=512M",
"-Xshare:off",
"-Dcom.sun.management.jmxremote.port=9998",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false",
"-Djava.rmi.server.hostname=%s".format(hostname),
@tlockney
tlockney / akka-docs.sh
Last active January 8, 2017 12:26
Akka docs on your Kindle!
# This only works with the current master branch of Akka
# Setup the necessary deps
brew install python
# adjust this depending on the latest version of Python that brew installed
export PATH=`brew --prefix python`/bin:/usr/local/share/python:$PATH
pip install sphinx
@tlockney
tlockney / actor.scala
Created June 12, 2013 17:24
While immutable data structures are preferable in Scala, it's not always obvious how to utilize them inside of an Akka actor when you need the actor to be stateful. Thankfully, Akka provides some help here, by use of the become method, which is designed to update the behavior of an actor. Scala supports closures, so we can pass the new state in …
import akka.actor.Actor
// Following the common Akka pattern of defining the messaging
// protocol in the companion object
object SampleActor {
case object GetState
case class UpdateState(key: String, value: String)
}
class SampleActor extends Actor {

Keybase proof

I hereby claim:

  • I am tlockney on github.
  • I am tlockney (https://keybase.io/tlockney) on keybase.
  • I have a public key whose fingerprint is 7598 1B8B E5C7 2B03 80D2 E966 D594 D4EC ED46 8B80

To claim this, I am signing this object: