Skip to content

Instantly share code, notes, and snippets.

View nhibberd's full-sized avatar

Nick Hibberd nhibberd

  • Renterra
  • San Francisco
View GitHub Profile
@nhibberd
nhibberd / keybase.md
Created July 23, 2021 01:09
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@nhibberd
nhibberd / update.sh
Last active January 8, 2020 00:02
Wireguard update script
#!/bin/sh -eu
TEMPLATE_DIR=${TEMPLATE_DIR:-/tmp}
: ${ROOT:=/etc/config}
: ${ENV:=$(cat /etc/config/env)}
: ${REGION:=$(cat /etc/config/region)}
: ${SUBNET:=$(cat /etc/config/subnet)}
: ${PREFIX:?"s3 location"}
@nhibberd
nhibberd / ghc.md
Created February 20, 2018 19:32
ghc installation on linux

Install GHC 8.0.1 (Linux)

Note: The extra environment variables are only required during the build/install phase.

$ wget https://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-x86_64-deb8-linux.tar.xz
$ tar ghc-8.0.1-x86_64-deb8-linux.tar.xz
$ cd ghc-8.0.1
$ export CONF_CC_OPTS_STAGE2=-fno-PIE
$ export CONF_GCC_LINKER_OPTS_STAGE2=-no-pie
@nhibberd
nhibberd / maybet.hs
Created September 22, 2015 04:59
MaybeT
lookupEnv :: IO (Maybe String)
lookupEnvT :: MaybeT IO String
foo :: IO (Maybe (String, String))
foo = do
a <- lookupEnv "yay"
b <- lookupEnv "yay"
pure $ do
aa <- a

Version

#if MIN_VERSION_process(1,2,0)
#if MIN_VERSION_base(4,7,0)

Host os

#if defined(darwin_HOST_OS)
#if defined(linux_HOST_OS)
@nhibberd
nhibberd / gist:1a528b59c471df741b53
Created December 24, 2014 04:32
TestingTemporaries
case class TestingTemporaries(buffer: java.util.concurrent.ConcurrentLinkedQueue[LocalPath])
object TestingTemporaries {
val registered: java.util.concurrent.atomic.AtomicReference[TestingTemporaries] =
new java.util.concurrent.atomic.AtomicReference[TestingTemporaries]
def localPath: RIO[LocalPath] = ResultT.io {
if (registered.compareAndSet(null, TestingTemporaries(new java.util.concurrent.ConcurrentLinkedQueue)))
Runtime.getRuntime.addShutdownHook(new Thread(new Runnable {
@nhibberd
nhibberd / gist:8ac9eaec4fecd0d7f7ed
Last active August 29, 2015 14:05
Generating ctags for scala project [+emacs]

Generate ctags for scala project

Add ctags plugin to sbt

~/.sbt//plugins/plugins.sbt

addSbtPlugin("net.ceedubs" %% "sbt-ctags" % "0.1.0")
Loading scala sources with ctags

~/.ctags

@nhibberd
nhibberd / gist:9d78576aab943cdb0f6c
Created June 23, 2014 00:41
Zsh case insensitivity auto complete
## case-insensitive (uppercase from lowercase) completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
## case-insensitive (all) completion
#zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
## case-insensitive,partial-word and then substring completion
#zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
CREATE TABLE test (
id SERIAL PRIMARY KEY,
test TEXT,
status CHARACTER VARYING (20) DEFAULT 'queued'
);
CREATE OR REPLACE RULE "new_test" AS
ON INSERT TO test
DO NOTIFY "new_test";
data Test =
Test {
_id :: Text
, _data :: Text
} deriving (Show, Eq)
makeLenses ''Test
z :: Test -> Text
z a =