Skip to content

Instantly share code, notes, and snippets.

@jaytaylor
jaytaylor / PlayParameterReader.scala
Created July 11, 2011 21:52
Nice ParaNameReader for the Play! Framework v.1.2.2
package PlayParameterReader
/**
* @author Jay Taylor <outtatime@gmail.com>
*
* @date 2011-05-23
*/
import scala.collection.JavaConversions._
@jaytaylor
jaytaylor / .tmux.conf
Created August 30, 2011 01:53
TMux Configuration
# Make it use C-a, similar to screen..
unbind C-b
unbind l
set -g prefix C-a
bind-key C-a last-window
# Reload key
bind r source-file ~/.tmux.conf
set -g default-terminal "screen-256color"
@jaytaylor
jaytaylor / .vimrc
Created September 20, 2011 19:14
Better Tab/Shift-Tab for block indentation
" Paste this into your .vimrc to make tab/shift-tab work on blocks of text just like in a fancy GUI IDE
map <Tab> >gb
map <S-Tab> v<gv<ESC>0I<ESC>l
imap <S-Tab> <ESC>v<gv<ESC>0I
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
@jaytaylor
jaytaylor / output.txt
Created October 4, 2011 00:44
swagger build problems
Buildfile: /Users/jtaylor/klout/perks/swagger-core/build.xml
clean:
[echo] deleting build files
[echo] deleting libs handled by ivy
resolve:
[ivy:retrieve] :: Ivy 2.1.0-rc2 - 20090704004254 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: file = /Users/jtaylor/klout/perks/swagger-core/ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: wordnik#swagger-core;working@secretcode
@jaytaylor
jaytaylor / StringExtras.scala
Created October 4, 2011 18:02
Pythonic Scala Strings
class StringExtras(string: String) { def % (args: Any*) = String.format(string, args.toArray.asInstanceOf[Array[Object]]: _*) }
implicit def stringExtras(string: String) = new StringExtras(string)
"%s, %s" % ("hello", "world")
@jaytaylor
jaytaylor / mysql-fast-loader.sh
Created October 20, 2011 19:38
Copies MySQL database to ramdisk then runs supplied shell script or command. The ramdisk version of the database is then copied back to the filesystem. Speeds up IO-intensive operations (e.g. loading heavily indexed tables.)
#!/usr/bin/env bash
##
# @author Jay Taylor <outtatime@gmail.com>
#
# @date 2011-10-20
#
# @description Copies MySQL database to ramdisk then runs supplied shell script
# or command. The ramdisk version of the database is then copied back to the
# filesystem. Speeds up IO-intensive operations (e.g. loading heavily indexed
@jaytaylor
jaytaylor / etc.init.openvpn.conf
Created November 3, 2011 19:02
Make OpenVPN run automatically as a service on Ubuntu. This includes an Upstart job and an expect script to automate OpenVPN private key password entry
# openvpn
#
description "OpenVPN - virtual private network daemon(s)"
author "Jay"
version "1.0.0"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
@jaytaylor
jaytaylor / CryptUtil.scala
Created November 10, 2011 17:16
Scala Port of Java Encryption Utility class originally found at http://bytebar.blogspot.com/2008/08/aes-encryption-in-java.html
import javax.crypto.{Cipher, SecretKeyFactory, SecretKey}
import javax.crypto.spec.{PBEKeySpec, SecretKeySpec}
import java.lang.{Long => JLong}
import java.security.MessageDigest
import java.security.spec.KeySpec
import java.util.Arrays
/**
* @author Jay Taylor <jay@klout.com>
* @date 2011-11-09
@jaytaylor
jaytaylor / log4j-force-utc-timestamp.properties
Created November 21, 2011 19:20
log4j force UTC timestamp
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.A1.layout.ConversionPattern=[%d{ISO8601}{GMT}] %-4r [%t] %-5p %c %x - %m%n
@jaytaylor
jaytaylor / curl_request_async.inc.php
Created February 24, 2012 05:27
Asynchronous HTTP requests for PHP
<?php
/**
* @author Jay Taylor [@jtaylor]
*
* @date 2012-02-23
*
* @description Originally found on SO:
* http://stackoverflow.com/questions/962915/how-do-i-make-an-asynchronous-get-request-in-php
*/