Skip to content

Instantly share code, notes, and snippets.

View beastaugh's full-sized avatar

Benedict Eastaugh beastaugh

View GitHub Profile
@beastaugh
beastaugh / hide_authors_tarski.php
Created April 15, 2013 14:50
WordPress plugin to hide post and page author names in the Tarski theme.
<?php
/*
Plugin Name: Hide Author Names in Tarski
Plugin URI: http://tarskitheme.com/help/hooks/example-plugins/
Description: Hide post and page author names in the Tarski theme.
Author: Benedict Eastaugh
Version: 1.0
Author URI: http://extralogical.net/
*/
@beastaugh
beastaugh / hatt-parser2.hs
Created December 3, 2012 00:33
New parser for Hatt with support for associativity and operator precedence
module Data.Logic.Propositional.Parser2 where
import Data.Logic.Propositional
import Text.Parsec.Prim ((<|>), (<?>), runPT)
import Text.Parsec.Char (char, letter, spaces, string)
import Text.Parsec.Expr
parseExpr' = runPT expr ()
@beastaugh
beastaugh / move_comment_link.php
Created September 29, 2011 14:57
WordPress plugin to move Tarski's comments link from the post metadata to the end of the post.
@beastaugh
beastaugh / gist:1204509
Created September 8, 2011 20:02
What is the weakest system that proves Dedekind's categoricity theorem for second-order arithmetic?

Q. What is the weakest system that proves Dedekind's categoricity theorem for second-order arithmetic?

In his classic essay 'Was sind und was sollen die Zahlen?', Dedekind proved the categoricity of the second-order Peano axioms, i.e. that all simply infinite systems---in modern terminology, models of those axioms---are isomorphic to one another. This proof was carried out in Dedekind's informal system of set theory.

Feferman and Hellman (1995) carried out a proof of this result in their system EFSC, the "Elementary theory of Finite Sets and Classes". This system has an

@beastaugh
beastaugh / DropConsec.hs
Created September 1, 2011 10:26
Drop consecutive elements of a list if they're the same, e.g. "AAABBACDDD" => "ABACD"
module Data.List.DropConsec
( dropConsec
) where
import Data.List (dropWhile)
dropConsec :: Eq a => [a] -> [a]
dropConsec [] = []
dropConsec (x:xs) = x : dropConsec (dropWhile (== x) xs)
@beastaugh
beastaugh / installing-ghc7.2-osx10.7.md
Created August 24, 2011 21:41
Installing GHC 7.2 on Mac OS X 10.7 Lion

Installing GHC 7.2 on Mac OS X

This is a brief and bare-bones guide to getting GHC 7.2 and the cabal-install tool (the two basic things you'll need to do Haskell development) up and running on a new Mac OS X 10.7 install.

The instructions given here worked for me, but YMMV.

@beastaugh
beastaugh / case_sensitive.c
Created August 22, 2011 11:11
Figure out if your Mac is running a case sensitive filesystem.
#include <stdio.h>
#include <unistd.h>
int main(void) {
if (pathconf("/", _PC_CASE_SENSITIVE)) {
printf("The file system is case sensitive\n");
} else {
printf("The file system is case insensitive\n");
}
@beastaugh
beastaugh / iso-8859-15_to_utf-8.rb
Created July 11, 2011 08:58
Convert a file from ISO-8859-15 to UTF-8
#!/usr/bin/env ruby
file = ARGV.shift
contents = File.read(file, {:encoding => "ISO-8859-15", :mode => "rb"})
contents.encode!("UTF-8")
File.open(file, 'w') do |f|
f.write(contents)
@beastaugh
beastaugh / CountLicenses.hs
Created April 26, 2011 20:31
Script to count how many different packages use particular licenses on Hackage.
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
{-
To use this script you need to extract your local Hackage index file. If
your setup is anything like mine, you should be able to find a .tar file
containing the listing somewhere like this:
~/.cabal/packages/hackage.haskell.org/00-index.tar.gz
@beastaugh
beastaugh / HDBC-mysql_GHC7.diff
Created April 15, 2011 23:08
Patch to get HDBC-mysql running on GHC 7.0
diff -rN old-HDBC-mysql/Database/HDBC/MySQL/Connection.hsc new-HDBC-mysql/Database/HDBC/MySQL/Connection.hsc
2c2
< {-# OPTIONS -fglasgow-exts #-}
---
> {-# LANGUAGE ForeignFunctionInterface, ScopedTypeVariables, EmptyDataDecls #-}
125c125
< mysql_autocommit mysql_ 0
---
> _ <- mysql_autocommit mysql_ 0
674c674