Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](

edmundsmith /
Created Jul 7, 2019
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust


I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

m-ou-se / replace-debian-with-arch.txt
Last active Jun 22, 2020
Instructions to replace a live Debian installation with Arch
View replace-debian-with-arch.txt
# Download latest archlinux bootstrap package, see
wget '*-x86_64.tar.gz'
# Make sure you'll have enough entropy for pacman-key later.
apt-get install haveged
# Install the arch bootstrap image in a tmpfs.
mount -t tmpfs none /mnt
cd /mnt
tar xvf ~/archlinux-bootstrap-*-x86_64.tar.gz --strip-components=1
gatlin / sat.hs
Created Feb 6, 2012
SAT Solver in Haskell
View sat.hs
-- This is going to be on Hackage soon!
{-# LANGUAGE BangPatterns #-}
-- |
-- Module : AI.Surely
-- Copyright : 2012 Gatlin Johnson
-- License : LGPL 3.0
-- Maintainer :
-- Stability : experimental
mohamed /
Last active May 24, 2020
Build Google gn build tool standalone
#!/usr/bin/env sh
set -euv
# Updated on April 2019 to reflect changes in GN
# See:
# We need a recent git
tungel / my Arch Linux cheat-sheet
Created Jul 8, 2013
I have kind of short term memory so I like to take note of what I've done. This cheat-sheet log some of the things I've done to my Arch Linux machine. Lots of these stuffs are based on my personal preference and may not be applicable to you. Also take note that: I'm not responsible if you break your machine by following any of the steps in this …
View my Arch Linux cheat-sheet
Installing Arch:
sudo vim /etc/pacman.conf
Update packages list: sudo pacman -Syy
run sudo pacman -Syu before installing any software (to update the repositories first)
* Timing issue:
- Change hardware clock to use UTC time:
sudo timedatectl set-local-rtc 0
chrisdone /
Last active Nov 2, 2019
Statically Typed Lisp

Basic unit type:

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

Basic functions:


Python Number Conversion Chart

From To Expression
raichoo / gist:01969563d1a534cf4f26
Last active Jul 19, 2017
Typed Interpreter in Haskell
View gist:01969563d1a534cf4f26
{-# OPTIONS_GHC -Wall -fno-warn-incomplete-patterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE NPlusKPatterns #-}
module Main where
Jach /
Created Sep 10, 2011
Overrides the Python integer five to be equal to four with ctypes magic
import sys
import ctypes
pyint_p = ctypes.POINTER(ctypes.c_byte*sys.getsizeof(5))
five = ctypes.cast(id(5), pyint_p)
print(2 + 2 == 5) # False
five.contents[five.contents[:].index(5)] = 4
print(2 + 2 == 5) # True (must be sufficiently large values of 2 there...)
You can’t perform that action at this time.