Skip to content

Instantly share code, notes, and snippets.

# escaping.txt
{ "value":"\u00B9"}
# url.txt
# Connected to Eduroam, IP
$ openssl s_client -connect 11:26:52
# This error means "no peer certificate available"
# Now I activate the VPN 11:32:50

Keybase proof

I hereby claim:

  • I am arthurclune on github.
  • I am arthurclune ( on keybase.
  • I have a public key whose fingerprint is C634 42B5 C6FB F195 D0CC 185A 209C 7D62 FB09 F5CB

To claim this, I am signing this object:

{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- Note: this code doesn't pass the given tests. Instead I've re-written these
-- to show what a more type-safe solution might look like.
-- See for the new test file
-- By doing this we make several of the tests redudant as they don't even type-check
module DNA
ArthurClune / gist:7060045
Last active December 25, 2015 23:49
New version of the tests for's Haskell exercise nucleotide-count_test.hs
import Test.HUnit (Assertion, (@=?), runTestTT, assertFailure, Test(..), Counts(..))
import System.Exit (ExitCode(..), exitWith)
import DNA (count, nucleotideCounts, Base(..), DNA(..))
import Data.Map (fromList)
import Data.Monoid ( (<>) )
import qualified Control.Exception as E
exitProperly :: IO Counts -> IO ()
exitProperly m = do
counts <- m
ArthurClune /
Created August 3, 2012 18:55
Code to read Squid access-log files
#!/usr/bin/env python
Code to read a squid log file
Sample usage:
f = SquidLog('access.log.1.gz')
for l in f:
print l.ts, l.remhost, l.url
"""WITH tr AS (SELECT submitted_time AS tr_from, submitted_time - interval '%(hour)s hour' AS tr_until FROM attacks WHERE id = (SELECT max(id) FROM attacks))
SELECT ident_id, count(*) AS count, max(submitted_time) AS last, min(submitted_time) AS first, (SELECT tr_from FROM tr) AS tr_from, (SELECT tr_until FROM tr) AS tr_until, now()
FROM attacks, tr WHERE submitted_time > tr_until AND submitted_time <= tr_from AND ident_id IN (%(idents)s) GROUP BY ident_id ORDER BY count DESC""" ,
{"hours" : hours, "idents" : ','.join(map(str, ident_ids) )} )
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeysP)
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.NoBorders
import XMonad.Layout.Spiral
import System.IO
For a MBP 13", intel integrated graphics.
Powersave settings:
Install mactel ppa plus macfanctl repo
Fan control:
arthur@jumpjet:~/Dropbox/rode_setup/home/bin$ more fan
ArthurClune / Sample output.txt
Created April 7, 2011 08:24
sample ldirectord.erb
real= gate
real= gate