Skip to content

Instantly share code, notes, and snippets.

View purcell's full-sized avatar

Steve Purcell purcell

View GitHub Profile
@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 / 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 / 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 / bug.org
Created February 28, 2013 11:02
org-mode html export bug

Running

// 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 / Classifier.hs
Created October 21, 2015 08:06
naive bayes
module Classifier
( Classifier(..)
, empty
, update
, union
, classify
, singleton
, scaled
, test
) where
@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 / metal.md
Last active October 4, 2015 15:37
Some music suggestions

Instrumental progressive metal

  • Blotted Science - "The Machinations of Dementia"

    Extreme complexity, particularly the drum parts.

  • Canvas Solaris - "The Atomized Dream"

  • Gordian Knot - "Gordian Knot"

@purcell
purcell / gist:2358004
Created April 11, 2012 08:43
About the dangers of including emacswiki-hosted packages in Melpa

On 6 Mar 2012, at 21:17, Donald Curtis wrote: I was talking in #emacs today and realized that because EmacsWIKI has no authentication method, anyone could put in some very bad elisp to one of the packages that we package from EmacsWIKI. Sure, for the most part we believe everyone is trustworthy, but there is no validation or verification from our end. So as a rule I am migrating some of the EL packages to personal git repositories with a small script to update them periodically. I feel like this is a better approach and something I hadn't thought about.

Yeah, that's indeed a potential concern. I've been through all the same loops, from el-get to a home-rolled periodic-downloading solution like yours, and finally figured I just wanted everything in ELPA packages. The installed code is just as risky, but I gain in terms of installation convenience. I doubt anyone expects an ELPA archive to vouch for the safety of every package it hosts.

Now, one approach would be to have a separate repo for emacswi