This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eo pipefail | |
SOCKFILE="$HOME/Library/Application Support/Playbit/vconsole0.sock" | |
while [ $# -gt 0 ]; do case "$1" in | |
-h|-help|--help) cat <<END | |
Connect a terminal to Playbit | |
Usage: $0 [--help | <sockfile>] | |
<sockfile> defaults to $SOCKFILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cc -std=c11 miniast.c -o miniast && ./miniast | |
#include "xcommon.h" | |
ASSUME_NONNULL_BEGIN | |
typedef enum AKind { | |
AKindInt, // 123 | |
AKindAdd, // + | |
AKindSub, // - | |
AKindMul, // * | |
} AKind; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Usage: | |
# sh build-fontkit.js.sh [<outfile>] | |
# <outfile> defaults to ./fontkit-VERSION.js | |
# | |
# This script builds fontkit.js for a web browser as an ES module script. | |
# Use the result like this: | |
# <script type="module"> | |
# import fontkit from "./fontkit-2.0.2.js" |
- https://github.com/rsms/move (2011)
- https://github.com/rsms/hue (2012)
- https://github.com/rsms/sol (2012)
- https://github.com/rsms/lum (2013)
- https://github.com/rsms/saturate (2013)
- https://github.com/rsms/rxlang (2014)
- https://github.com/rsms/coxlang (2016)
- https://github.com/rsms/co (2017)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Documentation and guides: | |
# https://docs.kernel.org/admin-guide/cgroup-v2.html | |
# https://lore.kernel.org/lkml/20160812221742.GA24736@cmpxchg.org/T/ | |
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_monitoring_and_updating_the_kernel/using-cgroups-v2-to-control-distribution-of-cpu-time-for-applications_managing-monitoring-and-updating-the-kernel | |
# remove if already exists | |
[ -e /sys/fs/cgroup/test1 ] && rmdir /sys/fs/cgroup/test1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ash | |
# list installed packages sorted by file size | |
apk info -e -s \* >/tmp/apksize | |
awk 'NR % 3 == 1' /tmp/apksize | cut -d ' ' -f 1 > /tmp/apkname | |
awk 'NR % 3 == 2' /tmp/apksize > /tmp/apksize2 | |
while read -r n unit; do | |
B=$n | |
case "$unit" in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Common terminology found in across literature and implementations: | |
Page | |
Region of memory. Usually 4096, 8192 or 16384 bytes | |
Page Frame | |
Same as a Page but when talking about physical memory. Same size as a Page. | |
Page Table | |
Per virtual address space table mapping virtual addresses to Pages. | |
Page Directory | |
Like Page Table and is often the same thing. The first level of Page Tables. | |
PTE - Page Table Entry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math, random, os.path | |
from perlin_noise import PerlinNoise | |
from math import pi as PI | |
def pathtext(text, pos, size, wght, opsz=32, **kwargs): | |
t = FormattedString( | |
font="Inter.var.ttf", fontSize=size, align="center", | |
#openTypeFeatures={}, | |
fontVariations={"wght":wght,"opsz":opsz}, **kwargs) | |
t.append(text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find the latest version of this script here: | |
// https://gist.github.com/rsms/a8ad736ba3d448100577de2b88e826de | |
// | |
const EM = 2048 | |
interface FontInfo { | |
familyName :string | |
styleName :string | |
unitsPerEm :int | |
ascender :int |
NewerOlder