% mkdir example && cd example && yesod init --bare
name: Example
type: simple
% curl "https://gist.githubusercontent.com/pbrisbin/448f31288d1ebb4435d6/raw/e49cd961eee825ec35a5332472b210d1b0bbfce1/b-patch.diff" | patch
% yesod test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Usage: xdg-send ./some_file.pdf | |
# | |
# Requirements on Local, | |
# | |
# - Running sshd on port 2222 | |
# - ssh -R 2222:localhost:2222 remote.com | |
# | |
# Requirements on Remote, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Uses xdotool and slock. | |
# | |
# Note: relies on your client being in a terminal with the title/name "chat", e.g. | |
# | |
# $ urxvtc -title chat -n chat -e weechat-curses | |
# | |
### | |
set_away() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DFA where | |
import Control.Monad.State | |
type DFAState = Int | |
data Rule = Rule | |
{ fromState :: DFAState | |
, inputChars :: [Char] | |
, nextStates :: [DFAState] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance Aeson.FromJSON User where | |
parseJSON (Object u) = User | |
<$> fmap read (u .: "id") | |
<*> u .: "username" | |
<*> u .: "full_name" | |
<*> u .: "bio" | |
<*> u .: "profile_picture" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad.State | |
import Data.List | |
data Dotfile = Dotfile | |
{ dfSource :: FilePath | |
, dfPath :: FilePath | |
, dfTag :: Maybe String | |
, dfHost :: Maybe String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am pbrisbin on github. | |
* I am pbrisbin (https://keybase.io/pbrisbin) on keybase. | |
* I have a public key whose fingerprint is 7A4F 38C2 01F4 3F11 1C95 A9E5 7548 1C55 CEC8 925D | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "$1" ]; then | |
printf "usage: hdocs <identifier>\n" | |
exit 64 | |
fi | |
package="$(printf "%s" "$*" | sed 's/[ .]/-/g; s/.*/\L&/g')" | |
package_glob="*/$package-*/html/index.html" | |
if [ -e "$PWD/.cabal-sandbox" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# $ curl -o watchme.rb 'https://gist.github.com/pbrisbin/8030960/raw/watchme.rb' | |
# $ ruby ./watchme.rb | |
# | |
### | |
require 'json' | |
class GitHub | |
def initialize(username, password) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
# {a,{b,{c}} => [a, a.b, a.b.c] | |
def parse_keys(hash, keys = [], prefix = nil) | |
hash.each do |k, v| | |
key = [prefix, k].compact.join('.') | |
if v.is_a?(Hash) | |
parse_keys(v, keys, key) | |
else |