Skip to content

Instantly share code, notes, and snippets.

View nominolo's full-sized avatar

Thomas Schilling nominolo

  • Zürich, Switzerland
View GitHub Profile
src/irbuffer.rs:12:5: 12:19 error: the trait `core::marker::Sized` is not implemented for the type `[irbuffer::Node]` [E0277]
src/irbuffer.rs:12 buffer: [Node],
^~~~~~~~~~~~~~
src/irbuffer.rs:12:5: 12:19 note: `[irbuffer::Node]` does not have a constant size known at compile-time
src/irbuffer.rs:12 buffer: [Node],
^~~~~~~~~~~~~~
error: aborting due to previous error
@nominolo
nominolo / golden-braid-theme.el
Created February 24, 2015 07:20
Emacs config
(deftheme golden-braid
"Created 2013-09-16.")
(custom-theme-set-faces
'golden-braid
'(cursor ((t (:background "yellow" :inverse-video t))))
'(fixed-pitch ((t (:family "courier"))))
'(variable-pitch ((t (:family "helv"))))
'(escape-glyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown"))))
'(minibuffer-prompt ((t (:weight bold :foreground "yellow" :background "red"))))
@nominolo
nominolo / ghc-wrap.hs
Created May 6, 2014 10:21
Profiling GHC itself.
-- Use this file to profile GHC itself while compiling a certain file, i.e.,
-- it's equivalent to running something like the following:
--
-- ghc --make <MYTARGET> [<MYFLAG> ...] +RTS -p
--
-- Except that the standard ghc binary doesn't support the RTS option "-p".
-- Note that <MYTARGET> and <MYFLAGS> are hardcoded in the binary. If you
-- change one of these, you need to recompile this binary.
--
--

Keybase proof

I hereby claim:

  • I am nominolo on github.
  • I am nominolo (https://keybase.io/nominolo) on keybase.
  • I have a public key whose fingerprint is 5CEF 9D87 244A 9C81 7D33 D4A2 7C2A 4042 3EFB 2683

To claim this, I am signing this object:

{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Unsafe.Coerce
import Data.List ( find )
import Data.Typeable
data Hook = forall a. Hook TypeRep a
@nominolo
nominolo / outbuffer.hs
Created November 29, 2012 17:56
Buffer last N lines
{-# LANGUAGE ScopedTypeVariables #-}
-- Usage: something-with-lots-of-output | ./outbuffer <N>
--
-- Reads everything on stdin and outputs the last <N> lines. Keeps N
-- lines in memory, so don't make <N> too large.
module Main where
import Control.Exception as E
@nominolo
nominolo / lei-trace.c
Created November 28, 2012 22:08
Last-executed Iteration trace detection
/*
* Data structure for trace selection using Last Executed Iteration
* (LEI). LEI is described in "Improving Region Selection in Dynamic
* Optimization Systems" by Hiniker, Hazelwood, and Smith in MICRO'05.
*
* Copyright (c) 2012 Thomas Schilling
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
@nominolo
nominolo / RandomMWC8.hs
Created October 19, 2012 16:09
Simple, pure MWC random number generator with 256 bits of state
{-# LANGUAGE BangPatterns, MagicHash #-}
-- IMPORTANT: Assumes a 64 bit platform!
import GHC.Prim
import GHC.Word
import GHC.Types
import Data.Word
import Numeric
import Data.Bits
@nominolo
nominolo / gist:3487670
Created August 27, 2012 11:27
parallel-move
#include <stdio.h>
#include <string.h>
#include <stdint.h>
typedef uint32_t Reg;
#define RID_NONE 0x80
#define RID_MASK 0x7f
#define RID_INIT (RID_NONE|RID_MASK)
#define RID_SINK (RID_INIT-1)
@nominolo
nominolo / gist:3437538
Created August 23, 2012 15:07
Lambdachine vs GHC (microbenchmark)
$ ghc-7.0.2 -fforce-recomp -rtsopts -O2 -o ../bench-sumfromto1-100000000 tests/Bench/SumFromTo1.hs
[1 of 1] Compiling Main ( tests/Bench/SumFromTo1.hs, tests/Bench/SumFromTo1.o )
Linking ../bench-sumfromto1-100000000 ...
$ time ../bench-sumfromto1-100000000 +RTS -s -A1M
../bench-sumfromto1-100000000 +RTS -s -A1M
True
8,904,005,312 bytes allocated in the heap
550,144 bytes copied during GC