Skip to content

Instantly share code, notes, and snippets.

View tibbe's full-sized avatar

Johan Tibell tibbe

View GitHub Profile
@tibbe
tibbe / geopandas-2108-repro.ipynb
Last active September 20, 2021 09:48
geopandas #2108 repro.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tibbe
tibbe / ghc-clang-wrapper
Last active January 3, 2016 10:19 — forked from mzero/ghc-clang-wrapper
Strip -nodefaultlibs flag to avoid warning This removes this warning: clang: warning: argument unused during compilation: '-nodefaultlibs'
#!/bin/sh
inPreprocessorMode () {
hasE=0
hasU=0
hasT=0
for arg in "$@"
do
if [ 'x-E' = "x$arg" ]; then hasE=1; fi
if [ 'x-undef' = "x$arg" ]; then hasU=1; fi
@tibbe
tibbe / build-cabal.sh
Created April 26, 2013 21:05
Jenkins build script for Cabal and cabal-install
export GHC=$compiler
cd Cabal
which cabal
[ ! -d .cabal-sandbox ] && cabal sandbox init
cabal clean
cabal install -j --only-dependencies --enable-tests -w $compiler
cabal configure --enable-tests -w $compiler
cabal build
cabal test --test-option='--jxml=$test-suite.junit.xml' --test-option=--plain
cabal sdist
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
module Longest where
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as BC
import Data.Word (Word8)
-- using custom data type (only works for 2 elements)
data TwoQueue = Empty
@tibbe
tibbe / Main.hs
Created April 5, 2013 17:54
Program that walks the HsSyn AST to create a list of all names and their source locations. Usage: 1. Place Main.hs and Test.hs in same directory. 2. Compile and run: ghc Main.hs ./Main
{-# LANGUAGE BangPatterns, PatternGuards #-}
module Main (main) where
import Control.Monad (forM_, unless)
import Prelude hiding (id, mod)
import System.Environment (getArgs)
import System.Exit (ExitCode(ExitFailure), exitWith)
import Bag
import Digraph (flattenSCCs)
{-# LANGUAGE BangPatterns #-}
module Main
( main
) where
import Control.Applicative
import Control.Monad (mzero)
import qualified Data.Vector as V
import Data.Vector (Vector)
@tibbe
tibbe / he2015-examples.hs
Created October 29, 2015 09:51
Benchmarks from the Haskell eXchange talk on High performance programming in Haskell
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}
module Main (main) where
import Control.DeepSeq
import Criterion.Main
import GHC.Generics (Generic)
import Prelude hiding (replicate, sum)
data List = Cons Int List | Nil
@tibbe
tibbe / gist:4106836
Created November 18, 2012 18:55
Core output for Gaussian.hs
Rec {
$fUniformGaussianValuesDoubleDouble_ziggurat
:: forall g_a2D9.
RandomGen g_a2D9 =>
(Vector Double, Vector Double, Vector Word)
-> g_a2D9 -> (Double, g_a2D9)
$fUniformGaussianValuesDoubleDouble_ziggurat =
\ (@ g_a2D9)
($dRandomGen_a2Da :: RandomGen g_a2D9)
(eta_B2 :: (Vector Double, Vector Double, Vector Word))
@tibbe
tibbe / cmm.el
Created March 9, 2012 21:32
Cmm major mode that doesn't work
(defvar cmm-mode-hook nil)
(add-to-list 'auto-mode-alist '("\\.cmm\\'" . cmm-mode))
(defvar cmm-keywords
'("aborts" "align" "aligned" "also" "as" "big" "bits" "byteorder" "case"
"const," "continuation" "cut" "cuts" "else" "equal" "export" "foreign"
"goto" "if" "import" "in," "invariant" "invisible" "jump" "little" "memsize"
"pragma" "reads" "register," "return" "returns" "section" "semi" "span"
"stackdata" "switch" "target" "targets" "to," "typedef" "unicode" "unwinds"
@tibbe
tibbe / gist:927099
Created April 19, 2011 10:27
copyArray# benchmark
{-# LANGUAGE MagicHash, UnboxedTuples #-}
module Main (main) where
import Data.Time.Clock
import GHC.Exts
import GHC.IO
import GHC.Prim
import GHC.ST
bench = stToIO $ ST $ \ s ->