Skip to content

Instantly share code, notes, and snippets.

@hardentoo
hardentoo / kata_brainfuck.hs
Created May 22, 2018 01:11 — forked from kgadek/kata_brainfuck.hs
Brainfuck interpreter with handcrafted lenses. Catamorphism not included though :<
{-# LANGUAGE RankNTypes, RecordWildCards #-}
import Data.Char
import Data.Functor.Identity
import Control.Applicative
{-
Inspired from real-world Brainf**k, we want to create an interpreter of that language which will
support the following instructions (the machine memory or 'data' should behave like a potentially
infinite array of bytes, initialized to 0):
@hardentoo
hardentoo / mini_linux.md
Created May 20, 2018 00:15
Buildinq a minimal Linux / Busybox OS for Qemu

Buildinq a minimal Linux / Busybox OS for Qemu

This short tutorial shows how to quickly build a minimal Linux kernel, a minimal initramfs root filesystem and test them on Qemu. We explore two options for the initramfs root filesystem:

  • starting from the Busybox sources (inspired by Mitchel Humpherys),
  • using Buildroot.

We also show how to compile and test a Hello world user application and a Hello world loadable kernel module.

Common

@hardentoo
hardentoo / lisp.hs
Created May 18, 2018 02:02 — forked from Peaker/lisp.hs
Minimal Lisp in Haskell
{-# LANGUAGE OverloadedStrings #-}
{- To Run:
Load in ghci
:set -XOverloadedStrings (for convenience)
Execute repl expr -}
import Control.Applicative
import Control.Monad.State.Strict
import Data.Function
@hardentoo
hardentoo / bf.hs
Created May 18, 2018 01:50 — forked from cwvh/bf.hs
Haskell brainfuck interpreter.
{-# LANGUAGE OverloadedStrings #-}
import Data.Array.IO
import Data.Array.Base
import Control.Applicative
import Control.Monad.Loops
import Data.Either
import Data.Attoparsec.Char8
import qualified Data.ByteString.Char8 as B
import System.Environment
@hardentoo
hardentoo / SystemF.hs
Created May 14, 2018 10:51 — forked from Icelandjack/SystemF.hs
System F
-- SYSTEM F
-- http://homepages.inf.ed.ac.uk/slindley/papers/embedding-f.pdf
--
-- Type-level lambdas
-- https://gist.github.com/AndrasKovacs/ac71371d0ca6e0995541e42cd3a3b0cf
{-# language TemplateHaskell, ScopedTypeVariables, RankNTypes,
TypeFamilies, UndecidableInstances, DeriveFunctor, GADTs,
TypeOperators, TypeApplications, AllowAmbiguousTypes,
@hardentoo
hardentoo / openglsdl2.hs
Created May 13, 2018 18:17 — forked from uhef/openglsdl2.hs
Example Haskell application using SDL2 and OpenGL bindinds. Implements main rendering loop with non-blocking event polling.
module Main where
import Graphics.Rendering.OpenGL
import Graphics.UI.SDL as SDL
import System.Environment
import Foreign.C.String
import Foreign.Marshal.Alloc
import Foreign.Storable
import Data.Bits
@hardentoo
hardentoo / AMD-Radeon-GPU-Linux-setup.md
Created May 10, 2018 20:13 — forked from 9bitbear/AMD-Radeon-GPU-Linux-setup.md
AMD RX Series GPU setup for Mining

Running AMD Radeon GPUS on Ubuntu 16.04

Cards tested (so far):

Model Released
Radeon RX 550 April 2017
Radeon RX 560 April 2017
Radeon HD 7800 Series March 2012
@hardentoo
hardentoo / LICENCE SUBLIME TEXT
Created May 10, 2018 09:02 — forked from cprakashagr/LICENCE SUBLIME TEXT
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
@hardentoo
hardentoo / TypeLambdas.hs
Created May 7, 2018 07:21 — forked from AndrasKovacs/TypeLambdas.hs
Type lambdas and induction with GHC 8.4.2 and singletons
{-# language TemplateHaskell, ScopedTypeVariables, RankNTypes,
TypeFamilies, UndecidableInstances, DeriveFunctor, GADTs,
TypeApplications, AllowAmbiguousTypes,
TypeInType, StandaloneDeriving #-}
import Data.Singletons.TH
import Data.Kind
-- some standard stuff for later examples' sake
----------------------------------------------------------
-- Начинаем с простого язычка
data Expression
= Val Int
| Plus Expression Expression
eval :: Expression -> Int
eval (Val x) = x
eval (Plus x y) = eval x + eval y