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 / MyFailure.hs
Last active January 29, 2024 19:06
Segfault with profiledGHC
{-# LANGUAGE QuasiQuotes #-}
module MyFailure where
import Data.Text (Text, unpack)
import URI.ByteString
import URI.ByteString.QQ
-- | Query Parameter Representation
data OAuth2 = OAuth2
@wavewave
wavewave / build.sh
Created August 10, 2023 20:00
ghc-debug on HeapOverflow
#!/bin/bash
rm test.o
ghc -rtsopts -threaded test.hs
# run like the following
# GHC_DEBUG_SOCKET=/tmp/ghc-debug ./test +RTS -M1G
@wavewave
wavewave / A.hs
Created May 18, 2023 20:32
loading temp shared object failed in ghci
module A where
dep :: IO ()
dep = putStrLn "dep."
@wavewave
wavewave / A.hs
Created May 16, 2023 17:59
getDoc retrigger unnecessary recompilation with obscure message
module A where
irrelevant :: IO ()
irrelevant = putStrLn "irrelevant"
@wavewave
wavewave / graphApp.hs
Created June 25, 2020 19:50
HROOT graph drawing app
nix-shell ~/repo/src/HROOT/use.nix --arg "fficxxSrc" ~/repo/src/fficxx --run "ghc graphApp.hs"
./graphApp
@wavewave
wavewave / nixops-example.nix
Created June 13, 2020 16:25
kernel package examples
let
machine =
{ config, resources, pkgs, ... }:
let
kpkgs =
with pkgs;
let linux_4_19_80 = callPackage ../../nix/linux-4.19.80.nix {
kernelPatches =
@wavewave
wavewave / xmonad.hs
Created February 25, 2019 18:39
my xmonad
import Control.Concurrent
import Data.Monoid ((<>))
import XMonad hiding ( (|||) )
import XMonad.Actions.CopyWindow
import XMonad.Actions.Navigation2D
import XMonad.Actions.UpdatePointer
import XMonad.Actions.WindowBringer
import XMonad.Config.Gnome
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
module Foo where
import Foreign.C.Types (CInt(..))
import Foreign.Ptr (Ptr,FunPtr)
func :: CInt -> CInt -> CInt
func j i = j + i+1
foreign import ccall "wrapper" mkFPtr :: (CInt -> CInt) -> IO (FunPtr (CInt -> CInt))
{-# LANGUAGE ScopedTypeVariables #-}
module Foo where
import Foreign.Ptr (Ptr)
import Foreign.StablePtr (castStablePtrToPtr
,castPtrToStablePtr
,deRefStablePtr
,newStablePtr
)
@wavewave
wavewave / bazel.nix
Created July 27, 2018 23:33
nix overlay for bazel 0.15.2
{ stdenv, lib, fetchurl, jdk, zip, unzip, bash, writeScriptBin, coreutils, makeWrapper, which, python
# Always assume all markers valid (don't redownload dependencies).
# Also, don't clean up environment variables.
, enableNixHacks ? false
}:
stdenv.mkDerivation rec {
version = "0.15.2";