Skip to content

Instantly share code, notes, and snippets.

View luc-tielen's full-sized avatar

Luc Tielen luc-tielen

View GitHub Profile
@jlongster
jlongster / gist:1712455
Created January 31, 2012 19:37
traditional lisp macros
;; outlet code for implementing traditional macro expansion
;; macros
(define (expand form)
(cond
((variable? form) form)
((literal? form) form)
((macro? (car form))
(expand ((macro-function (car form)) form)))
@cjmeyer
cjmeyer / arm-none-eabi-gcc.sh
Last active May 27, 2023 07:47
Bash: Build Binutils, GCC, Newlib, and GDB for ARM EABI (Cross-compiler).
#! /usr/bin/env bash
# Target and build configuration.
TARGET=arm-none-eabi
PREFIX=/opt/arm-none-eabi-4.7.1
# Sources to build from.
BINUTILS=binutils-2.23.1
GCC=gcc-4.7.1
NEWLIB=newlib-1.20.0
@sacundim
sacundim / gist:5386823
Last active July 28, 2020 21:32
Toy instructional example of Haskell GADTs: simple dynamic types.
{-# LANGUAGE GADTs #-}
-- | Toy instructional example of GADTs: simple dynamic types.
--
-- Before tackling this, skim the GHC docs section on GADTs:
--
-- <http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#gadt>
--
-- As you read this example keep in mind this quote from the
-- docs: "The key point about GADTs is that /pattern matching
@tel
tel / PipeLog.hs
Last active January 13, 2018 10:03
Pipes-based logger
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module PipeLog where
import Control.Applicative
import Data.Functor.Identity
import Pipes
import qualified Pipes.Prelude as P
newtype LogT l m a =
@stu9458
stu9458 / Oscillateur-gpio-rtdm.c
Created November 28, 2014 09:39
That's describe the xenomai gpio module in beaglebone black
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <asm/uaccess.h>
@cb372
cb372 / jargon.md
Last active May 14, 2024 03:45
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@AndrasKovacs
AndrasKovacs / IxFix.hs
Last active December 2, 2022 06:15
Example for recursion schemes for mutually recursive data
{-# LANGUAGE
UndecidableInstances, RankNTypes, TypeOperators, TypeFamilies,
StandaloneDeriving, DataKinds, PolyKinds, DeriveFunctor, DeriveFoldable,
DeriveTraversable, LambdaCase, PatternSynonyms, TemplateHaskell #-}
import Control.Monad
import Control.Applicative
import Data.Singletons.TH
@matthewjberger
matthewjberger / instructions.md
Last active June 20, 2024 19:27
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@teamon
teamon / box.ex
Created August 25, 2017 23:09
Define elixir structs with typespec with single line of code
defmodule Box do
defmacro __using__(_env) do
quote do
import Box
end
end
@doc """
Define module with struct and typespec, in single line
@gelisam
gelisam / Main.hs
Last active January 9, 2018 23:16
Distributing a computation using Cloud Haskell
-- in response to https://twitter.com/jfischoff/status/948768178070470656
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Control.Concurrent (threadDelay)
import Control.Monad.IO.Class (liftIO)
import Data.Traversable (for)
import Text.Printf (printf)
import Control.Distributed.Process (Process, NodeId, spawn)
import Control.Distributed.Process (SendPort, newChan, sendChan, receiveChan)