Skip to content

Instantly share code, notes, and snippets.

Benedict Eastaugh beastaugh

Block or report user

Report or block beastaugh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@beastaugh
beastaugh / hide_authors_tarski.php
Created Apr 15, 2013
WordPress plugin to hide post and page author names in the Tarski theme.
View hide_authors_tarski.php
<?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 Dec 3, 2012
New parser for Hatt with support for associativity and operator precedence
View hatt-parser2.hs
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 Sep 29, 2011
WordPress plugin to move Tarski's comments link from the post metadata to the end of the post.
View move_comment_link.php
@beastaugh
beastaugh / gist:1204509
Created Sep 8, 2011
What is the weakest system that proves Dedekind's categoricity theorem for second-order arithmetic?
View gist:1204509

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 Sep 1, 2011
Drop consecutive elements of a list if they're the same, e.g. "AAABBACDDD" => "ABACD"
View DropConsec.hs
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 Aug 24, 2011
Installing GHC 7.2 on Mac OS X 10.7 Lion
View installing-ghc7.2-osx10.7.md

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 Aug 22, 2011
Figure out if your Mac is running a case sensitive filesystem.
View case_sensitive.c
#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 Jul 11, 2011
Convert a file from ISO-8859-15 to UTF-8
View iso-8859-15_to_utf-8.rb
#!/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 Apr 26, 2011
Script to count how many different packages use particular licenses on Hackage.
View CountLicenses.hs
{-# 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 Apr 15, 2011
Patch to get HDBC-mysql running on GHC 7.0
View HDBC-mysql_GHC7.diff
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
You can’t perform that action at this time.