Skip to content

Instantly share code, notes, and snippets.

View solidsnack's full-sized avatar

Jason Dusek solidsnack

  • Dallas, TX
  • 16:07 (UTC)
View GitHub Profile
def files_root
root = Chef::Config[:cookbook_path]
cookbook = self.cookbook_name
variant = self.recipe_name
"#{root}/#{cookbook}/files/#{variant}"
end
## Root of our file repository for this variant of the cookbook.
FILES = files_root
-- Eval in Haskell.
import Data.Word
import Language.Haskell.Interpreter
import Language.Haskell.Interpreter.Server
#!/bin/bash
function hosts_fetch {
mkdir -p ./tmp
dig heroku.com > ./tmp/dig.list
}
function hosts {
sed -n '/^;; ANSWER SECTION:$/,/^$/ {
/^heroku\.com\..*[^.0-9]\([.0-9]*\)$/ {
!/bin/bash
set -o nounset -o errexit -o pipefail
countArgs () { echo $#; }
arr=()
countArgs "${arr[@]:0}"
#!/bin/bash
set -o nounset -o errexit -o pipefail
countArgs () { echo $#; }
arr=()
countArgs "${arr[@]:0}"
module Prox.Parse where
import Control.Monad
import Data.ByteString
import Data.Word
--import Network.Socket.ByteString
import Data.Attoparsec
import Data.Attoparsec.Binary
for line in "echo start" "exec cat" "echo end"
do
echo "$line"
sleep 0.01
done | sh
## Prints:
# start
# echo end
for line in "echo start" "exec cat" "echo end"
@solidsnack
solidsnack / dns.sql
Created April 8, 2012 01:06
Postgres DOMAIN and CHECK for LDH domain names.
-- Postgres DOMAIN and CHECK for LDH domain names.
-- Derived from RFCs 1035 and 1123.
CREATE EXTENSION IF NOT EXISTS citext;
CREATE DOMAIN dns AS citext
DEFAULT '.'
CHECK ( VALUE ~ '(?xi)
^( [a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?
([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?){0,126})?
[.]?$'
@solidsnack
solidsnack / foo.pub
Created July 12, 2012 14:54
a public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCY07XfJr3b/NkjICGB7z6RMd2aXDfc/GktOAyOBnlMcvN/7uxWqSbc+jAw1jFHhuCL8Y0JgJuMFoa+uKZeQadR/+SUgr65cDyNywI6OLRXW9Bm3HuVP2J9zamRZXFErduyB36tVTOL4TqpMTi3lBzoNNzi4On3+KzSuC+GwgM9Q9L03PqxHGu3GK3/hyrx/4vMeh5hUuGU//8jyeRNC4kxICcqB2tGwJ6BXp7zQXNjgpU3E2Cw0X/O5TSOa1A5dU0U4kx/xUmdWrlvCSuXo5T9hm9RM+LBg5tDdLI5G/m3i1USFhdrJWLWNyvbk+fOkfdtfOHgG37fhmFIYUnUQlcj
@solidsnack
solidsnack / CoBash.hs
Created October 20, 2012 15:49
Coroutine interface to Bash from Haskell.
{-# LANGUAGE OverloadedStrings
, ScopedTypeVariables
, ParallelListComp
, TupleSections #-}
module CoBash where
import Control.Applicative
import Control.Concurrent
import Control.Concurrent.MVar