Skip to content

Instantly share code, notes, and snippets.

View infinity0's full-sized avatar
🛠️
build bridges to the stars, not battleships and sports cars

Ximin Luo infinity0

🛠️
build bridges to the stars, not battleships and sports cars
View GitHub Profile
@infinity0
infinity0 / notes.rst
Last active August 10, 2017 18:01
airgapped caff

Airgapped workflow

Basic workflow:

#  online$ CAFFDIR=$PWD caff --download ${keyids}
        echo "NEXT STEP: on your secure offline system, run XXX"
# offline$ CAFFDIR=$PWD GNUPGHOME=${secret_dir} caff --sign
        echo "NEXT STEP: on your online system, run XXX"
#  online$ CAFFDIR=$PWD caff --mail
@infinity0
infinity0 / ambient.c
Created August 25, 2017 18:43
Set ambient capabilities
/*
* Test program for the ambient capabilities
*
* You need to install libcap-ng-dev first, then compile using:
* $ gcc -lcap-ng -o ambient ambient.c && sudo setcap cap_setpcap,cap_net_raw,cap_net_admin,cap_sys_nice+eip ambient
*
* To get a shell with additional caps that can be inherited do:
*
* ./ambient /bin/bash
*/
@infinity0
infinity0 / test.ml
Last active October 13, 2021 19:49
OCaml GADTs and avoiding "type constructor would escape its scope" errors
(* GADT list that exposes the type of the head element *)
type _ hlist =
| Nil: 'a hlist
| Cons: ('a * 'b hlist) -> 'a hlist
(* let rec len = function *)
(* let rec len (type a) (l: a hlist): int = match l with *)
(* both of the above result in a "type constructor would escape its scope" error *)
(* correct version: *)
let rec len : type a. a hlist -> int = function
adapted from https://genius.com/Lowkey-fire-in-the-booth-part-2-lyrics
with corrections to split/join lines based on the actual flow of the rhythm
----
Yeah, Fire in the Booth, much anticipated Part 2
Hold tight suspense, listen -
If they don't let us dream then we won't let them sleep
. . . .
#!/bin/sh
set -e
export KERNEL=$(uname -r)
export TARGET=/lib/modules/$KERNEL/kernel/drivers/gpu/drm/nouveau/nouveau.ko
case $KERNEL in 4.1[0123].*|4.[123456789].*|3.*|2.*) echo >&2 "requires kernel >= 4.14, have $KERNEL"; exit 1;; esac
( test -d nouveau || git clone "https://github.com/skeggsb/nouveau" )
( cd nouveau && git checkout devel-clk && git reset --hard && git clean -fqdx && \
git diff 1e53ec42 -- drm/nouveau/ > k.patch )
( test -d linux || git clone -o torvalds "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git" )
( cd linux && git checkout -B nv-reclock v4.15-rc2 && git reset --hard && git clean -fqdx && \

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512

I updated Signal on 2020-05-16 and the new version now says "Device no longer registered, This is likely because you registered your phone number with Signal on a different device."

I don't know why this has happened since I still have my US number. However I can't receive SMS to it since I now live in the UK. So I'm forced to change numbers again, sigh.

My old number:

+1 650 334 8706
$ apt-file search -x ^/usr/bin/ | cut -f2 -d: | sort -u
/usr/bin/[
/usr/bin/0alias
/usr/bin/0desktop
/usr/bin/0install
/usr/bin/0launch
/usr/bin/0store
/usr/bin/0store-secure-add
/usr/bin/0xFFFF
/usr/bin/2csv
[merge]
conflictstyle = diff3
tool = kdiff3
[mergetool]
keepBackup = false
keepTemporaries = false
prompt = false
## then when you get a merge conflict, run "git mergetool" and it will run kdiff3 resolving as many conflicts automatiacyll as possible
@infinity0
infinity0 / yanging.rst
Created October 5, 2019 19:54
YangGang2020
@infinity0
infinity0 / Test.hs
Last active December 14, 2019 19:57
dependent fun
{-# LANGUAGE
AllowAmbiguousTypes
, DataKinds
, FlexibleContexts
, FlexibleInstances
, GADTs
, MultiParamTypeClasses
, PolyKinds
, RankNTypes
, ScopedTypeVariables