Skip to content

Instantly share code, notes, and snippets.

@jandrewthompson
jandrewthompson / dock.sh
Created February 22, 2013 14:22
xrandr scripts for docking and undocking my Dell laptop. I mapped these to global keyboard shortcuts in KDE.
#!/bin/bash
xrandr --output HDMI3 --auto;
sleep 5;
xrandr --output LVDS1 --off;
sleep 5;
xrandr --output VGA1 --right-of HDMI3 --auto --primary;
@jandrewthompson
jandrewthompson / TestJooqConnection.java
Created February 26, 2013 22:29
Mocking java.sql.Connection with JOOQ file based input provider
package com.jthompson;
import java.io.File;
import java.sql.Connection;
import java.sql.ResultSet;
import lombok.extern.java.Log;
import org.jooq.tools.jdbc.MockConnection;
import org.jooq.tools.jdbc.MockDataProvider;
@jandrewthompson
jandrewthompson / randombot.hs
Created March 11, 2013 22:15
Randomness Achieved!!!!!!!!
import Data.List
import Network
import System.IO
import System.Exit
import System.Random
import Control.Arrow
import Control.Monad.Reader
import Control.Exception
import Text.Printf
import Prelude hiding (catch)
@jandrewthompson
jandrewthompson / types.hs
Created March 14, 2013 17:44
Haskell Typeclasses
import Text.Printf(printf)
data Message =
Message {msgType :: String,
msgTo :: String,
msgValue :: String}
deriving (Eq, Read)
data FooMessage =
FooMessage {msg :: Message,
@jandrewthompson
jandrewthompson / journal.sh
Created May 3, 2013 17:49
Notify me to start journaling. Open my journal if its not already open. Otherwise, send it to foreground.
#!/bin/bash
JPID=`pgrep -f journal.wiki`
#Send an alert
kdialog --title "JOURNAL" --passivepopup "Write in your journal!"
if [ -z $JPID ]
then
/usr/bin/gvim ~/Dropbox/vimwiki/journal.wiki &
@jandrewthompson
jandrewthompson / osctranslation.clj
Last active December 17, 2015 16:08
OSC translation layer
(ns oscplay.core)
(use 'overtone.osc)
(def PORT 8000)
(def mappings [{:from "/1/toggle1"
:to "/ardour/toggle1"}
{:from "/1/toggle2"
:to "/ardour/toggle2"}])
@jandrewthompson
jandrewthompson / kdiff3svn
Created September 18, 2013 19:42
Script for helping SVN and kdiff3 play nicely
#!/bin/bash
#################
# set 'merge-tool-cmd = kdiff3svn' in ~/.subversion/config
# ###############
kdiff3 $1 $2 $3 -o $4
@jandrewthompson
jandrewthompson / gist:7456194
Created November 13, 2013 20:52
Datomic: querying as of a specific db instant
(q '[:find ?food
:where [?person :person/name "John"]
[?person :favorite/food ?food]]
(d/since database #inst "2012-01-01T00:00:00.000-00:00")
)
@jandrewthompson
jandrewthompson / logind.conf
Last active August 29, 2015 14:01
Reviving power management features after kubuntu update.
##########################
# /etc/systemd/logind.conf was recently changed to intercept and
# eat power events (like laptop lid closing) BEFORE kde has a
# chance to act on them. Rendering System_Settings->Power_Management->Energy_Savings
# settings useless. The following settings should fix it.
##########################
#
#
# This file is part of systemd.
#
@jandrewthompson
jandrewthompson / gen-symbols.rkt
Created April 13, 2015 19:19
Generate Vim dictionary file for Racket symbols
#lang racket/base
;; In .vimrc, add the following config or equivalent:
;; "au FileType scheme setlocal dict+=~/.racket-dict.vim"
;;
;; Any (require ..) forms in this source file will impact symbols generated
(require racket/gui/base)
(require racket/gui)
(require racket/draw)