This file contains hidden or 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 -eu | |
# NB: Contains literal tabs | |
caption() { | |
python -c ' | |
from os import getenv | |
from sys import argv | |
from telegram import Bot | |
from telegram.error import BadRequest, TimedOut |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/" | |
xmlns:tns="http://www.drv.gov.ua/" | |
xmlns:s="http://www.w3.org/2001/XMLSchema" | |
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" | |
targetNamespace="http://www.drv.gov.ua/" | |
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> | |
<wsdl:types> | |
<s:schema elementFormDefault="qualified" targetNamespace="http://www.drv.gov.ua/"> |
This file contains hidden or 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 | |
# NB Depends on dict preserving the insert order (CPython >= 3.6, PyPy all) | |
from csv import DictReader | |
from datetime import datetime as DateTime | |
from os import scandir | |
from simplejsonseq import dump | |
from sys import argv, stderr, stdout | |
import ietfcsv # ietf-tab CSV dialect |
This file contains hidden or 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 -eu | |
set -o pipefail | |
TRACE=${TRACE-}; export TRACE | |
tracef() { | |
fmt=$1; shift | |
if [ -t 2 ]; then printf '\033[0K%s'"$fmt"'\r' "$TRACE" "$@" >&2; fi | |
} | |
trap 'tracef ""' EXIT |
This file contains hidden or 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 | |
from collections import deque as Deque | |
from zipstream import ZipFile | |
class Buffer: | |
def __init__(self): | |
self.queue = Deque() | |
self.finished = False |
This file contains hidden or 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 -eu | |
ENDPOINT="https://middleman.ferdinand-muetsch.de/api/messages" | |
if [ "$#" -ne 2 ]; then | |
echo "usage: $0 TOKEN ORIGIN" >&2 | |
exit 1 | |
fi | |
jq -ac --unbuffered --arg token "$1" --arg origin "$2" \ | |
'{"recipient_token": $token, "text": ., "origin": $origin}' | \ |
This file contains hidden or 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 -eu | |
po=$(printf %s *.??.po) | |
detail=false; if [ "x${1-}" = x-d ]; then detail=true; shift; fi | |
base=${1-/dev/null} | |
prev=; next=; diff= | |
trap 'rm -f "$prev" "$next" "$diff"' EXIT | |
prev=$(mktemp); next=$(mktemp); diff=$(mktemp) |
This file contains hidden or 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
.PHONY: all clean | |
all: blocked.png blocked.svg | |
clean: | |
rm -f backorder.hist ru.hist blocked.png blocked.svg | |
blocked.png blocked.svg: blocked ru.hist backorder.hist | |
./$< | |
backorder.hist: backorder.csv hist |
This file contains hidden or 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 -eu | |
# FIXME doesn't do URL decoding | |
list=; trap 'rm -f "$list"' EXIT; list=$(mktemp) | |
url=$1; path=${2-} | |
echo "DIR $path" | |
curl -sSL# -o "$list" "$url" | |
<"$list" pup 'pre img:not([alt="[DIR]"]) + a attr{href}' | tail +2 | \ |
This file contains hidden or 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 | |
from matplotlib import pyplot as plt | |
from numpy import arange | |
def find(func, iterable): | |
result = None | |
for i, elem in enumerate(iterable): | |
if func(elem): | |
assert result is None |