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
--[[ | |
dot2tex — convert "dot2tex" code blocks to "tikz" code blocks | |
Should be followed by diagram-generator.lua or diagram.lua in the filter chain. | |
"dot2tex" must be installed into $PATH or it's executable filename should be | |
provided in $DOT2TEX or dot2tex_path option. | |
Copyright: (c) 2024 vftdan (https://github.com/Vftdan) | |
License: MIT | |
]] |
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
// Copyright (c) 2024, vftdan | |
// SPDX-License-Identifier: MIT | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <limits.h> | |
#define DEBUG_PRINT_VALUE(x, fmt) fprintf(stderr, #x " = " fmt "\n", x); fflush(stderr) |
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 | |
# owncast-chat2ass.sh | |
# Copyright (c) 2023 vftdan (https://github.com/Vftdan) | |
TimeToSeconds() { | |
date -d "$1" +'%s.%N' | |
} | |
TimespanSeconds() { | |
printf '%s\n' "$(TimeToSeconds "$2") - $(TimeToSeconds "$1")" | bc |
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
scriptencoding utf-8 | |
let b:keymap_name = "sunskribo" | |
lmapclear <buffer> | |
function! s:get_any_var(name, default) | |
let l:g = get(g:, a:name, a:default) | |
let l:b = get(b:, a:name, l:g) | |
return get(w:, a:name, l:b) | |
endfunction |
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 python3 | |
import sys | |
def unquote(s): | |
if len(s) < 2: | |
return s | |
if s[0] == '"' and s[-1] == '"': | |
return s[1:-1] | |
return s |
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 | |
# Should work both in bash and dash + GNU coreutils. Probably works in other POSIX shells & coreutils. | |
if [ $# -ne 2 ]; then \ | |
echo "Usage: $0 <old_dir> <new_dir>" >&2 | |
exit 1 | |
fi | |
# Output dir must not be descendor of input dir! | |
in_dir="$(realpath "$1")" |
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
run: main main.js | |
@echo "=== Native ===" | |
./main | |
@echo | |
@echo "=== Emscripten ===" | |
node ./main.js | |
main: main.cpp | |
g++ -std=c++11 main.cpp -o main | |
main.js: main.cpp | |
em++ -std=c++11 main.cpp -o main.js |
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 | |
for i in $(seq 32); do \ | |
cat > /var/lib/AccountsService/users/nixbld"$i" <<EOF | |
[User] | |
SystemAccount=true | |
EOF | |
done |
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
Key | Old Code | New Code | |
---|---|---|---|
BUTTON0 | -100 | key.mouse.left | |
BUTTON1 | -99 | key.mouse.right | |
BUTTON2 | -98 | key.mouse.middle | |
BUTTON3 | -97 | key.mouse.4 | |
BUTTON4 | -96 | key.mouse.5 | |
BUTTON5 | -95 | key.mouse.6 | |
BUTTON6 | -94 | key.mouse.7 | |
BUTTON7 | -93 | key.mouse.8 | |
NONE | 0 | key.keyboard.unknown |
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 fractions import Fraction, gcd | |
from itertools import product as cartprod | |
def memo(f): | |
cache = {} | |
def g(*argv, **kwargs): | |
args = (argv, tuple(sorted(kwargs.items()))) | |
if args in cache: | |
#print("Using {0} |-> {1}".format(args, cache[args])) | |
return cache[args] | |
else: |
NewerOlder