Skip to content

Instantly share code, notes, and snippets.

View wenkokke's full-sized avatar

Wen Kokke wenkokke

View GitHub Profile
@wenkokke
wenkokke / witch.sh
Created March 2, 2014 14:27
Small bash script that determines by which packages a Brew package is used.
#!/bin/bash
if [[ -z "$1" ]]; then
echo "usage: witch [package name]"
else
# iterate over all installed packages
for pkg in $( brew list ); do
@wenkokke
wenkokke / prover9_makefile.patch
Created August 24, 2014 10:18
Fixes for one of the Prover9 Makefiles.
--- ./provers.src/Makefile 2013-11-24 18:48:09.000000000 +0100
+++ ./provers.src/Makefile 2013-11-24 18:49:38.000000000 +0100
@@ -63,25 +63,25 @@
$(MAKE) prover9
prover9: prover9.o $(OBJECTS)
- $(CC) $(CFLAGS) -lm -o prover9 prover9.o $(OBJECTS) ../ladr/libladr.a
+ $(CC) $(CFLAGS) -o prover9 prover9.o $(OBJECTS) ../ladr/libladr.a -lm
fof-prover9: fof-prover9.o $(OBJECTS)
@wenkokke
wenkokke / prover9_add_server.patch
Created August 27, 2014 13:17
Patch for Prover9 which adds a server-mode.
diff -bur ./ladr/parse.c ./ladr/parse.c
--- ./ladr/parse.c 2009-03-17 18:04:29.000000000 +0100
+++ ./ladr/parse.c 2014-08-21 03:46:12.000000000 +0200
@@ -554,7 +554,7 @@
c = getc(fp);
- if (c == EOF)
+ if (c == EOF || c == (unsigned char)EOF)
eof = TRUE;
@wenkokke
wenkokke / Apply.hs
Last active August 29, 2015 14:05
An implementation of an "apply" type-class which allows for overloading "function application".
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
@wenkokke
wenkokke / lastmd.hs
Last active August 29, 2015 14:07
A (probably very unidiomatic) Shake script which renders the last modified Markdown to a PDF using Pandoc/LaTeX.
{-# LANGUAGE DeriveDataTypeable #-}
import Control.Applicative ((<$>))
import Control.Monad (filterM)
import Data.Foldable (or)
import Data.List (isSuffixOf,maximumBy)
import Data.Ord (comparing)
import Data.Traversable (traverse)
import Development.Shake
import Development.Shake.FilePath
@wenkokke
wenkokke / dropbox.sh
Last active August 29, 2015 14:16
Bash command for Dropbox Share...
DROPBOX_SIZE_LIMIT=3000
DROPBOX_FOLDER="$HOME/Dropbox"
DROPBOX_SHARED_INDEX="$DROPBOX_FOLDER/Shared/.index"
function share {
current=`du -s $DROPBOX_FOLDER | cut -f1`
# with no arguments, echo current usage
if [ "$#" -eq 0 ]; then
@wenkokke
wenkokke / Unlit.lhs
Last active August 29, 2015 14:21
A simple script for converting literate code to code.
> {-# LANGUAGE OverloadedStrings, RecordWildCards, TupleSections, DeriveFunctor #-}
> module Unlit where
> import Control.Arrow (first,second)
> import Data.List (foldl')
> import Data.Text (Text)
> import qualified Data.Text as T
> import qualified Data.Text.IO as T
@wenkokke
wenkokke / agda2_compute_toplevel.hs
Last active September 3, 2015 10:50
Script which loads a given file into Agda and prints the normalised form of a given expression.
module agda2_compute_toplevel where
import Control.Concurrent (forkIO)
import Data.List (isPrefixOf)
import System.Environment (getEnv)
import System.FilePath (splitSearchPath)
import System.IO
import System.Process
import Text.Printf (printf)
@wenkokke
wenkokke / HTCG.hs
Last active December 21, 2015 06:29
An attempt to encode Hybrid Type-Logical Categorial Grammar in Haskell... which fails horribly, as I can't use closed type families in the current release of GHC. I'll have another go at it in November.
{-# LANGUAGE TypeFamilies, TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances, FlexibleContexts #-}
{-# LANGUAGE RankNTypes, ExistentialQuantification #-}
{-# LANGUAGE UndecidableInstances, NoMonomorphismRestriction #-}
{-# LANGUAGE FunctionalDependencies #-}
import Prelude hiding (and)
@wenkokke
wenkokke / CCG.lagda
Last active December 21, 2015 13:09
An attempt to encode Combinatory Categorial Grammar in Agda... which isn't as pretty as I'd like, but this is probably due to CCG. ^^
# Encoding CCGs in Agda.
Bla bla bla.
First attempt using type system to check validity of sentences. But sentences may be ambiguous, and
type raising cannot be properly handled due to the implementation of Agda implicits.
Since this blog post is literate Agda, we'll have some administrive business to get out of the way.
\begin{code}