Skip to content

Instantly share code, notes, and snippets.

View langston-barrett's full-sized avatar

Langston Barrett langston-barrett

View GitHub Profile
extern crate alloc as b;
mod foo {
mod bar {
pub(in b::string::String::newy) extern crate alloc as e;
}
}
@langston-barrett
langston-barrett / test.sql
Created March 6, 2023 22:55
DuckDB segfault
BEGIN;
CREATE SEQUENCE path_seq;
CREATE TABLE path (
id INTEGER PRIMARY KEY DEFAULT NEXTVAL('path_seq'),
it INTEGER,
x0 TEXT NOT NULL,
x1 TEXT NOT NULL
);
CREATE INDEX path_delta_idx ON path (it);
CREATE INDEX path0_idx ON path (x0);
# 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
@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
@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 / 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
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module Continuations where
import Control.Monad
import Text.Printf
@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> { };