Skip to content

Instantly share code, notes, and snippets.

View thumphries's full-sized avatar

Tim Humphries thumphries

View GitHub Profile
@thumphries
thumphries / xdefaults2iterm.pl
Created October 8, 2012 03:27
Convert your terminal colours / Xdefaults to iTerm2 color scheme
#!/usr/bin/perl -w
# Convert .Xdefaults or similar terminal colors to iTerm2 scheme
# Only supports simple hex colors, no funny stuff
use strict;
print <<eof;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@thumphries
thumphries / Getting.hs
Created October 4, 2017 12:38
Simulating first-class patterns by combining prisms into `Getting First`
{-# LANGUAGE TemplateHaskell #-}
module Lens where
import Control.Lens
import Data.Monoid (First, (<>))
data FooBar =
Foo (Either Int Bool)
| Bar (Maybe Bool)
@thumphries
thumphries / client.hs
Last active May 11, 2018 04:17
Example of a redirect vulnerability
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
import Control.Applicative
import Control.Lens
import Control.Monad
import Data.ByteString (ByteString)
import qualified Data.ByteString.Lazy as BSL
import qualified Data.IORef as IORef
build/
node_modules/