Skip to content

Instantly share code, notes, and snippets.

View purcell's full-sized avatar

Steve Purcell purcell

View GitHub Profile
@purcell
purcell / elpa-compare.el
Created June 27, 2012 12:42
Compare melpa and marmalade package lists
(defun elpa/package-names (archive-name)
(let* ((archive-contents (expand-file-name (concat "archives/" archive-name "/archive-contents")
package-user-dir))
(names (mapcar 'car (rest (pb/read-from-file archive-contents)))))
(sort names 'string<)))
(defun list-minus (a b)
(let ((result (copy-seq a)))
(dolist (e b)
(delq e result))
@purcell
purcell / nutty-bulgar-wheat.markdown
Created August 25, 2012 19:05
Nutty Bulgar Wheat with Herbs

Nutty Bulgar Wheat with Herbs

From Gordon Ramsay's Fast Food

Serves 4, warm or as a cold salad.

Ingredients

  • 300g bulgar wheat
@purcell
purcell / emacs-osx-srgb.patch
Last active June 19, 2018 16:34
Make Emacs on OSX treat all RGB colors as being within the sRGB color space
commit 3b63b2c6e9e93adab09eace60750ed981a8e528f
Author: Steve Purcell <steve@sanityinc.com>
Date: Sat Dec 21 11:44:12 2013 +0000
Treat hex colors as sRGB (see http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8402)
diff --git a/src/nsterm.m b/src/nsterm.m
index 733c05a..0c79186 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config focusPreferSameApp false
config focusCheckWidthMax 3000
config checkDefaultsOnLoad true
alias air 1440x900
alias dell 2560x1440
// For races on fellrunner.org.uk, produce a string pasteable into my org-mode race list
(function() {
function parseRace() {
var $ = window.jQuery;
var race = {};
race.url = window.location.href;
race.name = $(".title_races").first().text().split(" – ")[1].trim();
var parseDateTime = function(s) {
@purcell
purcell / bug.org
Created February 28, 2013 11:02
org-mode html export bug

Running

@purcell
purcell / java-wrapper-runit
Created May 12, 2013 18:26
Java programs packaged up with Tanuki Software's "Wrapper" software are horribly unreliable when run via init.d scripts. Luckily it's easy to make such a program reliably runnable with runit or daemontools.
#!/usr/bin/env ruby
wrapper_conf = "wrapper.conf"
props = ARGF.readlines.reduce(Hash.new) do |info, line|
info[$1] = $2 if line =~ /^wrapper\.(.+?)\s*=\s*(.*)\s*$/
info
end
command = [props["java.command"]]
@purcell
purcell / MontyHall.hs
Last active December 19, 2015 12:49
Monty Hall problem simulated in Haskell: see http://en.wikipedia.org/wiki/Monty_Hall_problem
module MontyHall
where
import System.Random
import Control.Monad
import qualified Data.Set as Set
data Result = Win | Lose deriving (Eq, Show)
data Door = Door Int deriving (Eq, Show, Ord)
type Doors = Set.Set Door
@purcell
purcell / *Diff*
Created August 21, 2013 16:55
Patch for thrift.el
diff -c /tmp/b/thrift.el /tmp/a/thrift.el
*** /tmp/b/thrift.el 2013-08-21 17:54:54.000000000 +0100
--- /tmp/a/thrift.el 2013-08-21 17:50:04.000000000 +0100
***************
*** 1,7 ****
! ;;; thrift.el --- Major mode for Apache Thrift files
!
! ;; Keywords: files
!
;; Licensed to the Apache Software Foundation (ASF) under one
@purcell
purcell / ensime-byte-compilation.txt
Created October 17, 2013 12:53
Ensime byte compilation warnings / errors
Compiling file /Users/steve/.emacs.d/elpa/ensime-20130904.40/ensime-auto-complete.el at Thu Oct 17 13:49:57 2013
Entering directory `/Users/steve/.emacs.d/elpa/ensime-20130904.40/'
In ensime-ac-complete-action:
ensime-auto-complete.el:148:11:Warning: reference to free variable `candidate'
In ensime-ac-enable:
ensime-auto-complete.el:322:15:Warning: assignment to free variable
`ac-delete-dups'