Skip to content

Instantly share code, notes, and snippets.

View wavewave's full-sized avatar

Ian-Woo Kim wavewave

  • San Francisco, CA, USA
View GitHub Profile
@wavewave
wavewave / ihaskell.nix
Created March 29, 2018 20:43
ihaskell-inline-r setup
#
# To run,
# $ nix-shell ihaskell.nix --argstr ihaskellpath (IHaskell directory)
#
# inside the shell, run
# $ ihaskell-notebook
#
{ ihaskellpath }:
let pkgs = import <nixpkgs> {};
@wavewave
wavewave / client.sh
Created March 12, 2018 20:55
Nix closure passing from local machine to cluster.
#!/bin/bash
cd /afs/cern.ch/work/i/ikim/public/heavyhiggs/lhc-analysis-collection/heavyhiggs
/afs/cern.ch/work/i/ikim/public/heavyhiggs/lhc-analysis-collection/heavyhiggs/optimize $1
@wavewave
wavewave / gist:ed533b358fbf744d98430ac46454d653
Created January 17, 2018 05:44
nixops is stuck due to cache.nixos.org
$ nixops deploy -d simplest
my-key-pair> uploading EC2 key pair ‘charon-xxx’...
testnginx..> creating EC2 instance (AMI ‘ami-xxx’, type ‘t2.micro’, region ‘us-east-1’)...
testnginx..> starting EC2 instance in zone ‘us-east-1a’ due to volume ‘vol-xxx’
testnginx..> waiting for IP address... [pending] [pending] [pending] [pending] [pending] [pending] [running] None / 10.100.1.28
testnginx..> waiting for SSH..........................
testnginx..> replacing temporary host key...
testnginx..> attaching volume ‘vol-xxx’ as ‘/dev/xvdf’... [attaching] [attached]
testnginx..> setting state version to 17.09
building all machine configurations...
@wavewave
wavewave / phabricator.nix
Created November 7, 2015 22:28 — forked from thoughtpolice/phabricator.nix
Extensive Phabricator module for NixOS (with Nginx frontend support)
/*
Example usage (in configuration.nix):
services.phabricator.enable = true;
services.phabricator.baseURI = "secure.example.org";
services.phabricator.baseFilesURI = "secure-files.example.org";
services.phabricator.extensions =
{ libphutil-scrypt = "git://github.com/haskell-infra/libphutil-scrypt.git";
libphutil-yubikey = "git://github.com/thoughtpolice/libphutil-yubikey.git";
{
packageOverrides = pkgs : rec {
nabi = with pkgs; stdenv.mkDerivation {
name = "nabi-1.0.0-iw";
src = fetchgit {
url = "http://github.com/wavewave/nabi.git";
rev = "2fc9d36e60d36cffbdc01b1b44fe4da9c9ba5901";
sha256 = "62ee6629e73b5dcf83739c786340271d58c7c99a84558a9e4e7d8e58cedb0887";
};
@wavewave
wavewave / config.nix
Created January 30, 2015 11:27
my config.nix
{
packageOverrides = pkgs: rec {
#
hepNixOverlay =
let self = pkgs.callPackage /home/wavewave/repo/src/hep-nix-overlay {};
in pkgs.recurseIntoAttrs self;
#
yesodEnv =
let hsenv = with (pkgs // pkgs.haskellPackages); ghcWithPackages
(self : [ cabalInstall
@wavewave
wavewave / push2down.hs
Created June 20, 2014 01:18
pipes: push from return value to downstream
import Control.Monad (forever)
import Pipes
import Pipes.Core
import qualified Pipes.Prelude
list2pipe :: (Monad m) => [a] -> Producer a m ()
list2pipe [] = return ()
list2pipe (x:xs) = yield x >> list2pipe xs
tuple3 :: (Monad m) => Consumer a m (a,a,a)
@wavewave
wavewave / popplerthread.hs
Created June 11, 2014 11:43
poppler worker thread design
import Control.Concurrent
import Control.Concurrent.STM
import Data.Monoid
import Graphics.Rendering.Cairo
import Graphics.UI.Gtk.Poppler.Document
import Graphics.UI.Gtk.Poppler.Page
import System.Directory
import System.FilePath
popplerGetDocFromFile :: FilePath -> IO (Maybe Document)
@wavewave
wavewave / prunetree.hs
Last active August 29, 2015 14:01
modular pruning with lazy tree
{-# LANGUAGE StandaloneDeriving #-}
import Debug.Trace
data BTree a = L
| N a (BTree a) (BTree a)
deriving instance (Show a) => Show (BTree a)
maketree :: Int -> Int -> BTree Int
@wavewave
wavewave / typetree.hs
Created May 20, 2014 03:39
Type level tree
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
import GHC.TypeLits
data Tree :: * -> * where
Leaf :: a -> Tree a
Node :: Tree a -> Tree a -> Tree a