Skip to content

Instantly share code, notes, and snippets.

View Heimdell's full-sized avatar
🔨
Right tool for the right job

Андреев Кирилл Heimdell

🔨
Right tool for the right job
  • Ульяновск
View GitHub Profile
@Heimdell
Heimdell / README
Last active December 16, 2015 01:09
Expanding ring mem heap implementation at first approx. See README.
Ringmem is self-compacting and self-expanding heap
for homogeneous elements.
Given `Type` having ctor Type(int, string, float) typical use is:
> Ringmem<Type> heap;
> Type * ptr = heap.place(1, "lol", 4.2); // ctor is called inside
> // all hail variadic templates!
@Heimdell
Heimdell / autowire.h
Last active December 16, 2015 06:28
Compile with `g++ -std=c++11 test.c++`. Use g++ of version 4.7.2 and... patience.
#ifndef AUTOWIRE_H
#define AUTOWIRE_H
#include <map>
#include <string>
#include <stdexcept>
using namespace std;
#include "singleton.h"
#include "variant.h++"
#include <string>
#include <iostream>
using namespace std;
template <int N>
struct Loudy
@Heimdell
Heimdell / Mapper.hs
Last active December 17, 2015 10:49
Small utility library to make a type-directed binary stream parsing (when protocol has fixed-size packets). Is a subject to expansion.
{-# LANGUAGE MultiParamTypeClasses
, FlexibleContexts
, ScopedTypeVariables
, TypeFamilies
, UndecidableInstances
, FlexibleInstances #-}
import qualified Data.ByteString as B
import Data.ByteString (ByteString)
@Heimdell
Heimdell / SM.ml
Last active December 19, 2015 11:19
State machine test
type 'state machine =
{ state : 'state
; transitions : ('state transition) list
}
and 'state transition =
{ predicate : 'state -> bool
; arrow : 'state -> 'state
; name : string
@Heimdell
Heimdell / Ast.ml
Created July 10, 2013 20:01
Lambda calculus on OCaml
module Varset = Set.Make(String)
type ast =
| Var of name
| Val of int
| Fun of info * varname * ast
| App of info * ast * ast
| BIF of name * (ast -> ast)
| Now of info * ast
@Heimdell
Heimdell / Schema.hs
Last active December 20, 2015 04:49
Trying to make a parser builder
import Text.ParserCombinators.Parsec hiding (spaces, optional, many, (<|>), token)
import Control.Applicative hiding (optional)
import Data.List
mod_header =
Sequence
[ header `Called` "header"
, includes `Called` "imports"
@Heimdell
Heimdell / two-stars.out
Created August 14, 2013 10:42
Tho-star gravity system
111
11 11
11 11
2 444 1
244 4410
244 7 440
24 776640
@Heimdell
Heimdell / less-error-two-stars.out
Last active December 21, 2015 01:48
two stars with slightly uncompensated speed