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 / ATLAS2011.yaml
Last active August 29, 2015 13:56
atlas2011 yaml description
Name: ATLAS2011
Class: TopLevel
Description: ATLAS 2011 detector description
Reference: arXiv:xxxx.yyyy
Comment: extracted the efficiencies from the plot 3,4,5 in the reference
ValidationInfo: Validated on 2014/02
Object:
Electron:
Import: Electron_Loose_ATLAS
Photon:
@wavewave
wavewave / typelittest.hs
Created May 18, 2014 20:20
Haskell type-level literal test (ghc 7.8.2)
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExplicitForAll #-}
import GHC.TypeLits
data Proxy (a :: Nat) = Proxy
@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
@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 / 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 / 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 / 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 / test.cpp
Created October 20, 2011 17:44
IORef Int <-> Ptr CInt in FFI
#include "test.h"
void mutateint( int* p )
{
(*p) = 10 ;
}
@wavewave
wavewave / button.hs
Created December 25, 2011 10:29
gtk2hs: button example
import Graphics.UI.Gtk
import Control.Monad.Trans
main :: IO ()
main = do
putStrLn "file open test"
initGUI
window <- windowNew
@wavewave
wavewave / fileopen.hs
Created December 25, 2011 10:31
gtk2hs: fileChooserDialog example
import Graphics.UI.Gtk
import Control.Monad.Trans
import System.Directory
main :: IO ()
main = do
putStrLn "file open test"
initGUI