Skip to content

Instantly share code, notes, and snippets.

View joehillen's full-sized avatar
🦡

Joe Hillenbrand joehillen

🦡
View GitHub Profile
import Control.Concurrent (forkIO, killThread,
threadDelay, newEmptyMVar,
tryTakeMVar, putMVar)
import Control.Monad (void, forever)
import Control.Concurrent.STM (atomically)
import Control.Monad.Trans (MonadIO(..))
import Control.Monad.Trans.Resource (MonadResource, allocate)
import Data.Conduit (GInfConduit, awaitE)
throttle :: (MonadResource m) => Int -> GInfConduit a m a
@joehillen
joehillen / bad_spellcheckers.py
Created July 11, 2013 07:40
A crappy spellchecker implementation I wrote for a job interview. I didn't get the job =P
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Written by Joe Hillenbrand <joehillen@gmail.com> 2012
All rights reserved!
"""
import string
@joehillen
joehillen / spellchecker_trie.py
Created July 11, 2013 08:08
A slightly better spellchecker using a Trie.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Written by Joe Hillenbrand <joehillen@gmail.com> 2012
All rights reserved!
"""
import sys
@joehillen
joehillen / server.hs
Last active June 1, 2022 17:56
A re-implementation of Simon Marlow's Async Haskell Chat Server using Conduits
{-# LANGUAGE OverloadedStrings, RecordWildCards, LambdaCase #-}
import Conduit
import Data.Conduit
import Data.Conduit.Network
import qualified Data.ByteString.Char8 as BS
import Data.Conduit.TMChan
import Text.Printf (printf)
import Control.Concurrent.STM
import qualified Data.Map as Map
@joehillen
joehillen / bandwidth.sh
Last active August 29, 2015 14:07
bandwidth monitor script for i3blocks
#!/bin/bash
if [ "$1" != "" ]; then
echo "Missing required argument: 'tx' or 'rx'" 1>&2
exit 1
fi
if [ "$1" != "rx" -a "$1" != "tx" ]; then
echo "Invalid argument: $1" 1>&2
echo "Usage: $0 (rx|tx)" 1>&2
exit 1
@joehillen
joehillen / quoth-the-raven.md
Last active November 20, 2015 05:37
Quoth the Raven, "Turn down for what?"

The Raven

Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore—
    While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
“’Tis some visitor,” I muttered, “tapping at my chamber door—
            Only this and nothing more.”
#!/usr/bin/env runhaskell
{-# LANGUAGE OverloadedStrings #-}
import Prelude hiding (interact)
import Data.Aeson
import Data.Text (Text)
import Data.Text.Encoding (decodeUtf8)
import qualified Data.Text as T
import qualified Data.Text.IO as TIO
@joehillen
joehillen / rotate-screen.sh
Last active August 29, 2015 14:27 — forked from rubo77/rotate-screen.sh
This script rotates the screen and touchscreen input, disables or enbles the touchpad, and dis- or enables the virtual keyboard on a Lenovo Yoga 13 or Yoga 2 Pro (source: http://askubuntu.com/q/405628/34298)
#!/bin/bash
# This script rotates the screen and touchscreen input 90 degrees each time it is called,
# also disables the touchpad, and enables the virtual keyboard accordingly
# by Ruben Barkow: https://gist.github.com/rubo77/daa262e0229f6e398766
#### configuration
# find your Touchscreen and Touchpad device with `xinput`
TouchscreenDevice='ELAN Touchscreen'
TouchpadDevice='SynPS/2 Synaptics TouchPad'
#!/bin/bash
function run {
# how we want to extract the variables from the commit message.
format_name="--format=%cn"
format_when="--format=%cr"
format_summary="--format=%s"
format_body="--format=%b"
@joehillen
joehillen / keybase.md
Created November 17, 2016 21:50
keybase.md

Keybase proof

I hereby claim:

  • I am joehillen on github.
  • I am joehillen (https://keybase.io/joehillen) on keybase.
  • I have a public key ASA3ziBYql27vBkU1YGhmcwgXcbNLbKihGplnwwZvLxu4Qo

To claim this, I am signing this object: