Skip to content

Instantly share code, notes, and snippets.

View osa1's full-sized avatar

Ömer Sinan Ağacan osa1

View GitHub Profile
; ModuleID = 'hello'
define i64 @add(i64 %a, i64 %b) {
%1 = alloca i64
store i64 %a, i64* %1
%2 = alloca i64
store i64 %b, i64* %2
%3 = load i64* %1
%4 = load i64* %2
%5 = add i64 %3, %4
# Some utilities to record jump table/virtual method calls.
# Implemented commands:
# `dynamics break-from-file`: reads an objdump output from given file and adds breakpoints to
# to dynamic calls. When one of the breakpoints are hit, it records jump address without
# dropping to the GDB prompt.
# `dynamics save`: saves collected dynamic call info to the hard-coded file `breakpoint_info`.
# `dynamics print`: prints collected dynamic call info.
# `dynamics disable-hits`: disables breakpoints that are hit at least one time.
# WIP, NOT WORKING YET:
# `dynamics note`: This should be run when $eip is on a dynamic call instruction.
module Main where
import qualified Data.ByteString as B
import Data.MessagePack (Object)
import Data.Serialize (decode)
import System.IO (hGetContents)
import System.Process
main :: IO ()
main = do
-- | Spawn N threads, each one adding new elements to sets randomly
-- selected from a pool of sets.
module Main where
import Control.Concurrent
import Control.DeepSeq
import Control.Monad
import Data.IORef
import Data.Maybe
import qualified Data.Set as S
@osa1
osa1 / Main.hs
Created April 16, 2015 14:54
GHC bug
{-# LANGUAGE QuasiQuotes #-}
import Language.Haskell.Exts.QQ
main = print [hs| \x -> case x of { 0 -> True; _ -> odd (x - 1) } |]
!_TAG_FILE_SORTED 1 ~
<> tests/Properties.hs 20 ;" o
Analyse app/Options.hs 17 ;" C
Analysed Criterion/Types.hs 642 ;" C
Analysis Criterion/Analysis.hs 13 ;" m
B examples/Maps.hs 19 ;" t
BenchGroup Criterion/Types.hs 334 ;" C
Benchmark Criterion/Types.hs 331 ;" t
Benchmark Criterion/Types.hs 333 ;" C
Benchmarkable Criterion/Types.hs 123 ;" t
@osa1
osa1 / gist:2c57818e0c8e3549ff14
Created May 14, 2015 20:55
CtrlP matcher written in Haskell (uses nvim-hs)
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Neovim
import Neovim.API.Plugin
import qualified Data.ByteString as B
import Data.List (foldl', sortBy)
import Data.MessagePack
"number-theory.rkt":
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/number-theory.rkt>
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/private/number-theory/divisibility.rkt>
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/private/number-theory/modular-arithmetic.rkt>
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/private/number-theory/modular-arithmetic-base.rkt>
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/private/syntax-utils.rkt>
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/private/number-theory/number-theory.rkt>
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/private/base/base-random.rkt>
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/private/number-theory/types.rkt>
making #<path:/home/omer/racket-6.2.0.3/share/pkgs/math-lib/math/private/number-theory/small-primes.rkt>
This file has been truncated, but you can view the full file.
raco setup: version: 6.2.0.3 [3m]
raco setup: installation name: snapshot
raco setup: variants: 3m
raco setup: main collects: /home/omer/racket-6.2.0.3/collects
raco setup: collects paths:
raco setup: /home/omer/.racket/snapshot/collects
raco setup: /home/omer/racket-6.2.0.3/collects
raco setup: main pkgs: /home/omer/racket-6.2.0.3/share/pkgs
raco setup: pkgs paths:
raco setup: /home/omer/racket-6.2.0.3/share/pkgs
{-# LANGUAGE ScopedTypeVariables, TypeFamilies #-}
module Main where
import Data.Proxy
class SpecList a where
type List a :: *
slNil :: Proxy a -> List a