Skip to content

Instantly share code, notes, and snippets.

@timjstewart
timjstewart / log4j.xml
Created June 10, 2013 18:45
Log config file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<!-- ================================= -->
<!-- Preserve messages in a local file -->
<!-- ================================= -->
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
<param name="blocking" value="false"/>
@timjstewart
timjstewart / newsbt
Last active December 26, 2015 02:19
Start sbt projects quickly
#! /bin/bash
# newsbt -- create a new sbt project
# Change this to generate projects using a different version of Scala
# You can override it with the -s option
scala_version=2.10.2
# I always use this namespace even though I don't own the domain name :)
# You can override it with the -n option
base_namespace=com.timjstewart
@timjstewart
timjstewart / Main.scala
Created November 7, 2013 05:49
Fun with RxScala (FRP)
package com.timjstewart
import scala.concurrent._
import rx.lang.scala._
object Main extends App {
override def main(args: Array[String]): Unit = {
def observable(n: Int) = Observable[Int] {
@timjstewart
timjstewart / overview
Last active December 27, 2015 19:39
Bash script that does high level analysis of Python, Java, and Scala source files
#! /bin/bash
#
# overview -- searches through all Java, Python, and Scala files in the current
# directory and all subdirectories and lists some basic stats about
# each file
if [ "$1" == "--help" ]
then
cat <<-HERE >&2
usage: overview [--help]
#! /bin/bash
ctags-exuberant -e -o TAGS -R
@timjstewart
timjstewart / .emacs
Last active December 28, 2015 00:39
My Emacs dotfile
;;;; Tim Stewart's Emacs dotfile
;;;; focused on Java/Scala development
;;; All that cool Emacs chrome? Get rid of it...
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;;; Theme Setup
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
@timjstewart
timjstewart / mirror
Last active December 28, 2015 06:29
Mirror files locally. Now handles gzipped files. Now alphabetizes Master Index Is a bit better at finding index.html files in the mirrored content.
#! /bin/bash
# where to put the mirrored documents
base_dir=~/docs
# the name of the master index file
master_index=${base_dir}/index.html
# download a single compressed archive and extract it to the current
# directory
@timjstewart
timjstewart / Vagrantfile
Last active December 28, 2015 11:29
Vagrant stuff
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@timjstewart
timjstewart / newscript
Created December 18, 2013 21:16
Create a new shell script using an older shell script
#! /bin/bash
if [ "$#" != "1" ]
then
echo "usage: newscript NAME" 1>&2
exit 1
fi
script_name=$1
@timjstewart
timjstewart / output.json
Created December 19, 2013 20:25
discussion service output
{
"discussionId": "1009120297",
"title": "does this work",
"rawTitle": "does this work",
"prompt": "please discuss",
"rawPrompt": "please discuss",
"responses": [
{
"responseId": "4000000001803",
"authorId": "17197812",