Skip to content

Instantly share code, notes, and snippets.

View dramforever's full-sized avatar
🖤
dramming

dram dramforever

🖤
dramming
  • Scarlet Devil Mansion, Gensokyo
View GitHub Profile
@dramforever
dramforever / clkgen.txt
Last active July 13, 2022 18:30
(Partially) undocumented JH7100 registers found in headers
Register: clk_cpundbus_root_ctrl_REG_ADDR
Address: CLKGEN_BASE_ADDR + 0x0
31 24 16 8 0
| | | | |
[------<>------------------------]
'-------------------------- [25:24] (rw) clk_cpundbus_root_src
Register: clk_dla_root_ctrl_REG_ADDR
@dramforever
dramforever / Makefile
Last active March 3, 2022 09:06
Stack trace
CFLAGS += -fno-omit-frame-pointer -funwind-tables
LDFLAGS += -lunwind
.PHONY: all
all: stack-trace
.PHONY: clean
clean:
rm stack-trace
@dramforever
dramforever / nixenv.zsh
Last active March 14, 2024 17:45
nixenv
declare -A nixenv_paths
nadd() {
setopt local_options err_return pipefail
local out out_paths
for installable in "$@"; do
local with_outputs="$installable^*"
if [[ "$installable" = *"^"* ]]; then
with_outputs="$installable"
fi
> module FoldlFoldr where
Implementation of `foldl'`
> foldl' :: (b -> a -> b) -> b -> [a] -> b
> foldl' f acc [] = acc
> foldl' f acc (x : xs) =
> let acc1 = f acc x
> in acc1 `seq` foldl' f acc1 xs
@dramforever
dramforever / sdf_ascii_art.ipynb
Last active April 20, 2021 07:53
Generating ASCII art with distance fields
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env bash
set -e
nix build --no-link "$@" nixpkgs#stdenv
stdenv="$(nix eval --raw nixpkgs\#stdenv)"
store="$(nix eval --raw --expr builtins.storeDir)"
bashPath="$(dirname "$(realpath "$(type -p bash)")")"
exec bash --rcfile /proc/self/fd/19 19<<END
@dramforever
dramforever / zlm-papri.tex
Created March 25, 2021 14:57
zbalermorna papri
\documentclass{article}
\newcommand{\paper}{letterpaper}
\newcommand{\maxlines}{20}
\usepackage[vmargin=3cm,\paper]{geometry}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\usepackage{background}
@dramforever
dramforever / _info.md
Last active May 14, 2021 14:59
bachix

bachix

Generate nix.conf for Cachix in bash. Because sometimes it's just unnecessary to download cachix the binary.

@dramforever
dramforever / log.txt
Created October 4, 2020 16:19
Inverting a lookup table
sizeof(int) = 4
RAND_MAX = 2147483647
NUM = 536870911
BLOCK_LEN = 2097152
block = 4.859 s
naive = 6.024 s
1 - (block / naive) = 0.193
block = 4.637 s
naive = 5.826 s
1 - (block / naive) = 0.204