Skip to content

Instantly share code, notes, and snippets.

View langston-barrett's full-sized avatar

Langston Barrett langston-barrett

View GitHub Profile
BX3QGIR/hNB3ml7ezFMW4sevkCvGCAo9cWNieg4GPtxr

Add the following to your NixOS configuration:

  virtualisation.docker.enable = true;

and

sudo nixos-rebuild switch

You may have to restart at this point. Once you have Docker installed and running,

@langston-barrett
langston-barrett / haskell-nix.rst
Last active July 5, 2022 23:34
Cabal+Nix+Spacemacs+Dante

There's a lot of conflicting information online about using Haskell, Nix, Stack, Cabal, and Spacemacs together. Here's what has worked and not worked for me.

default.nix:

{ pkgs ? import <nixpkgs> {} }:
pkgs.haskellPackages.callCabal2nix "name" ./. { }

shell.nix:

with import <nixpkgs> { };
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module Continuations where
import Control.Monad
import Text.Printf
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
@langston-barrett
langston-barrett / showstack.py
Last active July 7, 2020 16:21
Print a program's arguments, environment, and ELF aux vector with GDB
"""Print a program's arguments, environment, and ELF aux vector with GDB
Run with:
gdb-multiarch -n -q -batch -ex 'source showstack.py'
"""
from __future__ import print_function
import gdb
@langston-barrett
langston-barrett / linux-kernel-llvm-bitcode-gllvm.dockerfile
Last active March 20, 2021 22:47
Linux kernel LLVM bitcode with GLLVM in Docker
# docker build -t gllvm-linux .
# docker run --rm --workdir=/work --mount type=bind,src=$PWD,target=/work -it gllvm-linux
FROM ubuntu:20.04
# Configuration
# Newer versions of Linux require "asm-goto", which isn't in LLVM 8...
ENV KERNEL_VERSION=4.14.39
ENV LLVM_VERSION=8
# Static environment
@langston-barrett
langston-barrett / callgrind.txt
Created September 1, 2021 15:40
Souffle Callgrind report
--------------------------------------------------------------------------------
Profile data file 'test.callgrind.out' (creator: callgrind-3.16.1)
--------------------------------------------------------------------------------
I1 cache:
D1 cache:
LL cache:
Timerange: Basic block 0 - 17504446838
Trigger: Program termination
Profiled target: ./test (PID 117247, part 1)
Events recorded: Ir
# docker build -t gllvm-linux .
# docker run --rm --workdir=/work --mount type=bind,src=$PWD,target=/work -it gllvm-linux
FROM ubuntu:21.10
# Configuration
ARG LLVM_VERSION=11
ARG KERNEL_MAJOR_VERSION=5
ARG KERNEL_MINOR_VERSION=17
# Environment