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 | |
eval_on_ztncui () { | |
# shellcheck disable=1090 | |
(source ~/containers/ztncui.sh && ztncui-compose exec -T ztncui bash -c "$1"); return $? | |
} | |
# Arguments are escaped, last argument gets the address of the server prepended, auth token is added to the header | |
curl_on_ztncui () { | |
# shellcheck disable=2016 |
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 raspberrypi_os:latest as backend | |
RUN export DEBIAN_FRONTEND="noninteractive" && \ | |
apt clean && apt update && \ | |
apt install autoconf \ | |
automake \ | |
libtool \ | |
libevent-dev \ | |
libcurl4-openssl-dev \ | |
libgtk2.0-dev \ |
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
pdfpages () { | |
if [[ $# -ne 1 ]]; then | |
echo "$FUNCNAME: expected one argument, got $#" | |
return 1 | |
fi | |
local filename="$1" | |
while read line; do | |
if [[ "$line" =~ ^Pages:" "+([0-9]+)$ ]]; then | |
echo "${BASH_REMATCH[1]}" | |
return 0 |
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
# Append this to your "~/.bashrc" file | |
if LINK="$(~/cdlink.sh ~/SeaDrive)"; then | |
cd "$LINK" | |
echo Changed base path to "${LINK@Q}" | |
fi |
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 typing import Iterator, Tuple, Dict, Any, Iterable, Union, cast | |
from sympy import plot as splot | |
from sympy.plotting.plot import Plot | |
from matplotlib import pyplot | |
from itertools import filterfalse | |
from more_itertools import unzip | |
import random | |
import colorsys | |
Curve = Tuple[Any, Dict[str, Any]] |
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
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Compile plugins", | |
"type": "shell", | |
"command": "${config:sourcepawnLanguageServer.sourcemod_home}/../spcomp64", | |
"args": [ |
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.8 | |
from typing import TypeVar, Iterator | |
""" | |
https://docs.python.org/3/library/stdtypes.html#iterator-types | |
This is considered broken by the iterator protocol, however I think | |
that what's considered broken is to continue to _yield values_, where | |
with this we emphasize the fact that if ``StopIteration`` is raised | |
once, the iterator _should not be used_ further. Those are two | |
different things. |
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.8 | |
from ipaddress import IPv6Network, IPv6Address | |
from typing import Optional, Tuple | |
from base64 import b32encode | |
# from https://github.com/zerotier/ZeroTierOne/blob/91b16310ea47a6de96edb488a61494f8ed8c139c/node/InetAddress.cpp#L427 | |
def mk6plane(nwid: int, nodeid: int | |
) -> Tuple[IPv6Network, IPv6Network, IPv6Address]: | |
""" | |
Given a ZeroTier node and network ID, return |
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.8 | |
# different from the re module (https://pypi.org/project/regex/ ) | |
from ast import parse | |
from json import dumps | |
from typing import Any, List, NoReturn, TextIO, Tuple | |
import regex | |
import json | |
import sys | |
import argparse |
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/bash | |
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" | |
# https://stackoverflow.com/a/26827443 | |
# shellcheck disable=SC2030,SC2034,SC2031 | |
split_output() { | |
local -n array="$1" || return $?; | |
# shellcheck disable=SC1090 | |
. <({ | |
err="$({ out="$("${@:2}")"; ret=$?; } 2>&1; |