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
hello: hello.o | |
ld hello.o -o hello -s -n | |
hello.o: hello.s | |
as hello.s -o hello.o | |
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
#!/usr/bin/env node | |
const [n, u] = process.argv.slice(2); | |
const t = parseFloat(n); | |
function kelvin(value) { | |
const sunK = 5778.0; | |
const sunCodys = 1_000_000_000.0; | |
return (value / sunK) * sunCodys; |
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
#!/usr/bin/env bash | |
set -e | |
REPO_NAME="chimera-linux" | |
RELEASE="${RELEASE:-latest}" | |
LATEST_URL="https://repo.chimera-linux.org/live/$RELEASE" | |
SHA256_FILENAME="sha256sums.txt" | |
IMAGE_TAG="${REPO_NAME}:$RELEASE" | |
IMAGE_ID="$(docker image ls -q "$IMAGE_TAG")" |
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
function devopen() { | |
local workspace_folder="$(readlink -f "$1")" | |
if [ -d "$workspace_folder" ]; then | |
local wsl_path="$(wslpath -w "$workspace_folder")" | |
local path_id=$(printf "%s" "$wsl_path" | xxd -ps -c 256) | |
code --folder-uri "vscode-remote://dev-container%2B${path_id}/workspaces/$(basename "$workspace_folder")" | |
else | |
echo "Usage: devopen <directory>" 1>&2 |
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
[alias] | |
can = commit --amend --no-edit --no-verify | |
l = branch -vv | |
s = status --short --branch | |
u = remote update | |
whatadded = log --diff-filter=A | |
m = merge | |
[am] | |
threeway = true | |
[color] |
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
#!/usr/bin/env bash | |
set -e | |
VERSION="$1" | |
OS="linux" | |
ARCH="x64" | |
# ARCH="armv7l" | |
URL="https://nodejs.org/dist/v${VERSION}/node-v${VERSION}-${OS}-${ARCH}.tar.xz" |
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
// snippet based on https://github.com/tim-kos/node-retry#retrytimeoutsoptions | |
const timeouts = Array.from({length: 10}, (_, i) => { | |
const random = 1; | |
const minTimeout = 10; | |
const factor = 2; | |
const attempt = i; | |
const maxTimeout = 6000; | |
return Math.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout); | |
}); |
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
let a b c = | |
b + c | |
let d a = | |
let m = a + 1 // pretend this is opening something stateful, like a db connection | |
let x y = | |
m + y | |
x | |
// f is a bound function, a has not been executed yet | |
let f = a 2 |
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
from operator import itemgetter | |
def create_slicer(*indexes): | |
""" | |
>>> l = list(range(10)) | |
>>> create_slicer(5)(l) | |
([0, 1, 2, 3, 4], [5, 6, 7, 8, 9]) | |
>>> create_slicer(3, 7)(l) | |
([0, 1, 2], [3, 4, 5, 6], [7, 8, 9]) | |
>>> create_slicer(3, 5, 7)(l) |
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
{ | |
const RUN = 50000; | |
const FLAT_LENGTH = 9; | |
const a = [ | |
[0, 1, 2, 3], | |
4, | |
[5, 6, 7], | |
8 | |
]; | |
const perf = []; |
NewerOlder