Skip to content

Instantly share code, notes, and snippets.

View jonathanlking's full-sized avatar

Jonathan King jonathanlking

View GitHub Profile
@jonathanlking
jonathanlking / readelf.txt
Last active September 16, 2022 20:12
Output from running `objdump --disassemble x86_64cpuid.o` and `readelf -a x86_64cpuid.o`
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: REL (Relocatable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
loadArchive: reached end of archive loading while loop
loadArchive: reading at 16473430
loadArchive: EOF while reading from '/nix/store/fhx4qrgggffsyh19q9bbz0phm1qykqbk-openssl-1.1.1h/lib/libcrypto.a'
loadArchive: done
resolveObjs: start
relocations for section 1 using symtab 9
Rel entry 0 is raw( 0x2d 0x1400000004 0xfffffffffffffffc) lookupSymbol: looking up newCAF
lookupSymbol: value of newCAF is 0x38f44ae
`newCAF' resolves to 0x38f44ae
Reloc: P = 0x4112b03d S = 0x38f44ae A = 0xfffffffffffffffc
@jonathanlking
jonathanlking / nixos-encrypted-zfs.sh
Created April 11, 2020 17:35
How I installed Encrypted ZFS root on NixOS
#!/bin/sh
# For SSH setup...
# passwd nixos
# systemctl start sshd
# FIRST STOP THE zfs-zed SERVICE
systemctl stop zfs-zed
# FORCE UNLOAD ZFS KERNEL MODULES
module Main where
import Prelude
import Concur.Core (Widget)
import Concur.React (HTML)
import Concur.React.DOM (button, text)
import Concur.React.Props (onClick)
import Concur.React.Run (runWidgetInDom)
import Effect (Effect)
module Main where
import Prelude
import Data.List
import Data.Newtype
import Data.Monoid (mempty)
-- From purescript-indexed-monad
class IxMonad m where
ipure ∷ ∀ a x. a → m x x a
@jonathanlking
jonathanlking / graph.tex
Last active June 4, 2018 07:05
PureScript nested types
\documentclass[border=2pt]{standalone}
\usepackage{csvsimple}
\begin{filecontents*}{data.csv}
Depth, Wall clock time, User time, System time, Memory (kbytes),Time
1, 0:02.17,11.23,2.13,305000,13.36
2, 0:02.32,11.51,2.42,290668,13.93
3, 0:02.27,12.02,2.06,283512,14.08
4, 0:02.32,11.91,2.34,293744,14.25
@jonathanlking
jonathanlking / Dockerfile
Created April 23, 2018 11:31
Dockerfile for Scribble (Java)
# To build: docker build -t scribble-server .
# To run: docker run -it scribble-server
FROM maven:latest
RUN git clone https://github.com/scribble/scribble-java.git \
&& cd scribble-java \
&& mvn install -Dlicense.skip=true \
&& mv scribble-dist/target/scribble-dist* /
RUN unzip scribble-dist*
RUN cp scribble-java/scribble-core/src/test/scrib/tmp/Test.scr .
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ConstraintKinds #-}
-- Leibniz idea copied from:
-- http://code.slipthrough.net/2016/08/10/approximating-gadts-in-purescript/
newtype a :~: b = Leibniz (forall f. f a -> f b)
refl :: a :~: a
@jonathanlking
jonathanlking / lens.hs
Created September 27, 2017 14:55
Lens example code from talk by SPJ
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE RankNTypes #-}
-- Lens example code from talk by SPJ
-- "Lenses: compositional data access and manipulation."
-- https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation
type Lens' s a = forall f. Functor f => (a -> f a) -> s -> f s
import Control.Monad (replicateM)
import Control.Applicative ((<$>))
import Data.List (sortBy)
import Data.Maybe (listToMaybe)
import Data.Ord (comparing)
data Token = Plus | Minus | None deriving (Show, Eq)
data Fragment a = Add a | Sub a deriving Show
newtype Solution = Solution { getSolution :: [Token] }