Skip to content

Instantly share code, notes, and snippets.

View tlockney's full-sized avatar

Thomas Lockney tlockney

View GitHub Profile

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:

@tlockney
tlockney / Vagrantfile
Last active August 29, 2015 13:57
This setup allows for quick hacking with an sbt console on an EC2 instance -- very useful for trying out the AWS APIs when you need to try things out. As an example, I wanted to make sure I understood how to get the various bits of meta-data that are visible only on EC2. Create the following files and run setup.sh to run everything.
Vagrant.configure("2") do |config|
config.vm.box = "dummy"
config.vm.provider :aws do |aws, override|
aws.access_key_id = "..."
aws.secret_access_key = "..."
# you'll need to create the EC2 keypair used here -- I called it vagrant for easy tracking
aws.keypair_name = "vagrant"
# you'll want to use a group that has at least SSH open
@tlockney
tlockney / Foo.java
Created June 13, 2014 01:10
A simple example where basic String concatenation in Java is really better than a StringBuilder.
public class Foo {
static final String aConstant = "a constant";
public void concatSimpleString() {
String aString = "one" + aConstant + "two";
}
public void concatWithStringBuilder() {
StringBuilder sb = new StringBuilder();
@tlockney
tlockney / .tmux.conf
Created June 18, 2014 17:07
Tmux conf for remapping the prefix key
# set the command prefix to `
set -g prefix "`"
unbind C-b
bind "`" send-prefix
@tlockney
tlockney / gist:1a0dbe6f8bd437b07d5f
Created February 8, 2015 06:55
Get a new random port
lazy val port = new ServerSocket(0).getLocalPort()
# 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 / 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
#