Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
die() {
echo "$*" >&2
exit 1
}
#
# Determine dump level based on what day it is:
#
@greyson
greyson / gist:1035217
Created June 20, 2011 06:43
What I really want.
private static abstract class MyClosure implements Runnable {
MyClosure( int x ) {
this.x = x;
}
int x;
}
/* later... somewhere in a method */
int x = 42;
handler.post( new MyClosure( x ) {
@greyson
greyson / permute_list.erl
Created April 10, 2012 08:34 — forked from baali/permute_list.erl
Permutation of List in Erlang
-module( permute_list ).
-export([ permute/1 ]).
permute( List ) ->
jumble( List, [] ).
jumble( [], Permuted_List ) ->
Permuted_List;
jumble( List, Permuted_List ) ->
Index = random:uniform( length(List) ) -1,
-module( bad_redirect_on_create ).
-export([ init/1,
allowed_methods/2,
content_types_accepted/2,
content_types_provided/2,
create_path/2,
post_is_create/2,
from_json/2,
@greyson
greyson / netwatch
Created February 2, 2014 16:04
Simple, powerful connection monitor
#!/usr/bin/python
DEFAULT_SOUNDFILE="/home/greyson/alerts/S_083772.mp3"
DEFAULT_HOST="209.18.47.61"
import os
import subprocess
import sys
import time
import re
@greyson
greyson / Sodium.FRP.State.hs
Created July 10, 2015 00:15
Event streams of stateful operations with shared accumulated state.
{-# LANGUAGE RecursiveDo #-}
module FRP.Sodium.State
( runAccum
, snapshotState
) where
import Control.Monad.State
import FRP.Sodium
type AccumE s = State (Behaviour s, Event s)
@greyson
greyson / dvorak-ctrl.nix
Created September 29, 2015 15:48
Dvorak with control for capslock.
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "dvorak-control";
src = ./blanksource;
buildInputs = [ kbd ];
installPhase = ''
mkdir -p "$out"
zcat "${kbd}/share/keymaps/i386/dvorak/dvorak.map.gz" | \
@greyson
greyson / gist:19aad812a13e6f30ba6249da303f0107
Last active December 1, 2016 17:20
config.nix - haskell override
{
haskell = super.haskell // {
packages = super.haskell.packages // {
lts = super.haskell.packages.lts.override {
overrides = self: super: {
heist = super.heist.overrideDerivation (old: {
doCheck = false;
testToolDepends = [ super.pandoc ];
});
};
This file has been truncated, but you can view the full file.
SteamVR System Report created Thu Feb 23 05:45:43 2017
<Report>
SteamVR Version: 1487744123
SteamVR Date: 2017-02-22
Steam: Public
Steam Branch: beta
Steam AppID: 250820
Tracking: lighthouse
mysql_install_db: [ERROR] unknown variable 'pid-file=/run/mysqld/mysqld.pid'
configuration.nix:
services.mysql = {
enable = true;
package = pkgs.mysql57;
initialDatabases = [
{ name = "akron"; schema = ./akron.sql; }
];