Skip to content

Instantly share code, notes, and snippets.

Avatar
🖤

Cheng Shao TerrorJack

🖤
View GitHub Profile
View stack.yaml
compiler-check: match-exact
resolver: ghc-8.0.1.20161117
setup-info:
ghc:
linux64:
8.0.1.20161117:
url: http://downloads.haskell.org/~ghc/8.0.2-rc1/ghc-8.0.1.20161117-x86_64-deb8-linux.tar.xz
content-length: 112047972
sha1: 6a6e4c9c53c71cc84b6966a9f61948542fd2f15a
macosx:
@george-hawkins
george-hawkins / arm64.md
Last active Sep 2, 2020
Running virtualized x86_64 and emulated arm64 Ubuntu cloud images using QEMU
View arm64.md

QEMU arm64 cloud server emulation

This is basically a rehash of an original post on CNXSoft - all credit (particularly for the Virtio device arguments used below) belongs to the author of that piece.

Download the latest uefi1.img image. E.g. ubuntu-16.04-server-cloudimg-arm64-uefi1.img from https://cloud-images.ubuntu.com/releases/16.04/release/

Download the UEFI firmware image QEMU_EFI.fd from https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/

Determine your current username and get your current ssh public key:

@smeijer
smeijer / parse-es6-template.js
Last active Aug 31, 2020
ES6 template string parser
View parse-es6-template.js
function get(path, obj, fb = `$\{${path}}`) {
return path.split('.').reduce((res, key) => res[key] || fb, obj);
}
function parseTpl(template, map, fallback) {
return template.replace(/\$\{.+?}/g, (match) => {
const path = match.substr(2, match.length - 3).trim();
return get(path, map, fallback);
});
}
View Printf.hs
{-# LANGUAGE GADTs, TypeInType, DataKinds, TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeApplications #-}
import GHC.TypeLits
import GHC.Types
import Data.Singletons
import Data.Singletons.Prelude
data Format = Lit Symbol | Str | Shown Type
@Icelandjack
Icelandjack / Constraints.org
Last active Sep 8, 2020
Type Classes and Constraints
View Constraints.org

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.

@AndrasKovacs
AndrasKovacs / STLC.hs
Last active Aug 14, 2016
Lambda calculus on the type level with GHC 7.11.20151212.
View STLC.hs
{-# LANGUAGE
TypeInType, UndecidableInstances, TypeOperators, GADTs, TypeFamilies #-}
import Data.Kind
import GHC.Prim
import Data.Proxy
data Fun a b
type a ~> b = Fun a b -> Type
infixr 0 ~>
@yurydelendik
yurydelendik / !wasmllvm.md
Last active Sep 17, 2020
Using WebAssembly in LLVM
View !wasmllvm.md

NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception

Using WebAssembly in LLVM

Compiling

# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
@karpathy
karpathy / min-char-rnn.py
Last active Sep 25, 2020
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@chrisdone
chrisdone / AnIntro.md
Last active Aug 21, 2020
Statically Typed Lisp
View AnIntro.md

Basic unit type:

λ> replTy "()"
() :: ()

Basic functions:

You can’t perform that action at this time.