This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
/* | |
This is our integer linked list type (Null is an empty list) | |
(it is immutable, note the consts) | |
*/ | |
typedef struct IntList_s const * const IntList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* compile with: | |
on linux: gcc -g stack_traces.c | |
on OS X: gcc -g -fno-pie stack_traces.c | |
on windows: gcc -g stack_traces.c -limagehlp | |
*/ | |
#include <signal.h> | |
#include <stdio.h> | |
#include <assert.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//usr/bin/make -s "${0%.*}" CFLAGS="-O2 -Wall -Werror" && ./"${0%.*}" "$@"; s=$?; rm ./"${0%.*}"; exit $s | |
#include <stdio.h> | |
#include <stdbool.h> | |
enum option_tag { OPTION_SOME, OPTION_NONE }; | |
#define option_type(T) { enum option_tag tag; T some; } | |
#define SOME(S) { .tag = OPTION_SOME, .some = S } | |
#define NONE() { .tag = OPTION_NONE } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ISC License | |
Copyright (c) 2016, Job Vranish | |
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
template <class T1, class T2> | |
class Either | |
{ | |
bool isLeft; | |
union | |
{ | |
T1 left; | |
T2 right; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# read abelectronics ADC Pi V2 board inputs with repeating reading from each channel. | |
# # Requries Python 2.7 | |
# Requires SMBus | |
# I2C API depends on I2C support in the kernel | |
# Version 1.0 - 06/02/2013 | |
# Version History: | |
# 1.0 - Initial Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Rank2Types | |
, RebindableSyntax | |
, ImplicitParams | |
, NoMonomorphismRestriction #-} | |
import Data.Maybe | |
import Data.Function | |
import Data.String | |
import Prelude (undefined, error, String, (++)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"arch": "arm", | |
"cpu": "cortex-m4", | |
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", | |
"disable-redzone": true, | |
"executables": true, | |
"llvm-target": "thumbv7em-none-eabi", | |
"morestack": false, | |
"os": "none", | |
"relocation-model": "static", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad | |
import Control.Monad.Error | |
instance Error (RuntimeError a) where | |
data Expr = Number Int | |
| SomethingElse | |
deriving (Show, Eq, Ord) | |
data Type = Func Type Type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
To install dependencies: | |
cabal install logict | |
cabal install stream-monad | |
-} | |
import Control.Monad.Logic |
NewerOlder