Skip to content

Instantly share code, notes, and snippets.

@mikusp
mikusp / a.hs
Last active February 19, 2018 06:59
PoC calling dynamic C functions in Haskell
{-# OPTIONS_GHC -ddump-simpl -ddump-stg -ddump-asm -ddump-cmm -ddump-opt-cmm -ddump-to-file #-}
{-# LANGUAGE GHCForeignImportPrim, UnliftedFFITypes, MagicHash, UnboxedTuples, RecursiveDo, GeneralizedNewtypeDeriving, BangPatterns #-}
module Main where
import Data.Coerce
import Foreign
import Foreign.C.String
import qualified System.Posix.DynamicLinker as DL
import qualified System.Posix.Signals as Sig
import qualified Control.Concurrent.Async as Async
@mikusp
mikusp / log
Created September 25, 2016 14:09
GHC 8.0.1 registered AArch64 testsuite log
This file has been truncated, but you can view the full file.
make -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt
make[1]: Entering directory '/home/alarm/clean_builds/ghc-8.0.1/testsuite/tests'
This file has been truncated, but you can view the full file.
abakus
abakusa
abakusach
abakusami
abakusem
abakusie
abakusom
abakusowi
abakusów
/* -----------------------------------------------------------------------------
*
* Module : Function
* Copyright : [2008..2014] Manuel M T Chakravarty, Gabriele Keller
* [2009..2014] Trevor L. McDonell
* License : BSD3
*
* Maintainer : Trevor L. McDonell <tmcdonell@cse.unsw.edu.au>
* Stability : experimental
*
@mikusp
mikusp / cq.c
Created January 9, 2014 15:26
Constant Q transform implemented in C using FFTW and custom build of CXSparse from SuiteSparse. Based on a MATLAB implementation presented in http://doc.ml.tu-berlin.de/bbci/material/publications/Bla_constQ.pdf .
#include <stdlib.h>
#include <math.h>
#include <complex.h>
#include "../../cxsparse/Include/cs.h"
#include <fftw3.h>
float* cq_hanning_window(int length) {
float* result = fftwf_alloc_real(length);
@mikusp
mikusp / hanoi.cpp
Created November 10, 2013 21:04
Frame-Stewart algorithm C++11 implementation
#include <iostream>
#include <tuple>
#include <stack>
#include <vector>
std::stack<int> to132(std::stack<int> s) {
int first = s.top();
s.pop();
int second = s.top();
s.pop();
@mikusp
mikusp / a.hs
Last active December 24, 2015 02:09
{-# LANGUAGE MagicHash, RecordWildCards #-}
import qualified Data.Map as Map
import Data.List
import Data.Maybe
main = print $ recognize chords [F#,B,D#,A,E]
{-- types --}
type Interval = Int