Skip to content

Instantly share code, notes, and snippets.

View wfrisch's full-sized avatar

Wolfgang Frisch wfrisch

View GitHub Profile
@wfrisch
wfrisch / md_render.sh
Created July 15, 2024 07:18
md_render: live update for Markdown → HTML using Pandoc
#!/bin/bash
set -eo pipefail
markdown_file=$1
[ -e "$markdown_file" ] || {
echo "usage: $0 MARKDOWN_FILE"
exit 1
}
html_file="$(mktemp)"
@wfrisch
wfrisch / idlib_openSUSE:Factory.csv
Created May 8, 2024 19:12
idlib openSUSE:Factory 2024-05-08
Package Revision Library git describe
openSUSE:Factory/0ad 12 curl curl-7_53_0-14-g93cce24
openSUSE:Factory/0ad 12 lua v5-3-5
openSUSE:Factory/0ad 12 mbedtls mbedtls-2.1.7-63-gc4cb493
openSUSE:Factory/0ad 12 zlib v1.2.8
openSUSE:Factory/Botan 64 botan 2.19.2-7-ga336896
openSUSE:Factory/DSView 2 minizip-ng 0^20181101.252588f6a78bd7656f4e03d1b236695b3182ff7d
openSUSE:Factory/EternalTerminal 22 minizip-ng 0^20181101.252588f6a78bd7656f4e03d1b236695b3182ff7d
openSUSE:Factory/EternalTerminal 22 zlib v1.2.11
openSUSE:Factory/Fragments 14 curl curl-8_1_1-13-gc4bd61d
@wfrisch
wfrisch / idlib_openSUSE:Factory.csv
Created May 8, 2024 19:12
idlib openSUSE:Factory 2024-05-08
openSUSE:Factory/0ad 12 curl curl-7_53_0-14-g93cce24
openSUSE:Factory/0ad 12 lua v5-3-5
openSUSE:Factory/0ad 12 mbedtls mbedtls-2.1.7-63-gc4cb493
openSUSE:Factory/0ad 12 zlib v1.2.8
openSUSE:Factory/Botan 64 botan 2.19.2-7-ga336896
openSUSE:Factory/DSView 2 minizip-ng 0^20181101.252588f6a78bd7656f4e03d1b236695b3182ff7d
openSUSE:Factory/EternalTerminal 22 minizip-ng 0^20181101.252588f6a78bd7656f4e03d1b236695b3182ff7d
openSUSE:Factory/EternalTerminal 22 zlib v1.2.11
openSUSE:Factory/Fragments 14 curl curl-8_1_1-13-gc4bd61d
openSUSE:Factory/Fragments 14 nghttp2 v1.44.0-266-g6a099ee
@wfrisch
wfrisch / gist:40c049743d00c6c02e077ec650059d81
Created April 17, 2024 12:14
idlib small vs. full index
17M idlib.sqlite
216M idlib-big.sqlite # every file in every commit in all branches
$ ./identify.py -d idlib.sqlite -s cmake-3.29.2 |sort
curl curl-8_5_0-248-g066ed4e51
libuv v1.44.0-5-gbae2992c
xz v5.3.1alpha-65-g7136f173
zlib v1.2.12-30-ga9e14e8
zstd 0^20210512.c730b8c5a38b9e93efc0c3639e26f18f14b82f95
@wfrisch
wfrisch / idlib.log
Created April 15, 2024 15:12
openSUSE:Factory idlib (excerpt)
### openSUSE:Factory/0ad (rev 11)
- curl curl-7_52_1-140-g13e3a18b3
- zlib v1.2.7.3-1-ge8fee0e
### openSUSE:Factory/EternalTerminal (rev 22)
- zlib v1.2.11
### openSUSE:Factory/Fragments (rev 14)
- curl curl-8_1_0-22-g54ce13d3f
- zlib v1.2.13
@wfrisch
wfrisch / Vagrantfile
Created February 7, 2024 10:18
vagrant-libvirt config for opensuse/Tumbleweed.aarch64
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
@wfrisch
wfrisch / http-serve-incomplete-responses.py
Created February 1, 2024 09:15
Deliberately broken HTTP server that responds with either a) false Content-Length or b) broken chunked encoding
#!/usr/bin/env python3
"""
Deliberately broken HTTP server that responds with either
- false Content-Length
- broken chunked encoding
both triggering ChunkedEncodingError in clients using `python-requests`:
- ChunkedEncodingError: Connection broken: IncompleteRead
- ChunkedEncodingError: Connection broken: InvalidChunkLength
"""
@wfrisch
wfrisch / http-serve-incomplete-chunks.py
Created January 24, 2024 11:26
HTTP server that sends incomplete chunks, triggering ChunkedEncodingError in python-requests clients. Reproducer for https://github.com/thp/urlwatch/issues/725
#!/usr/bin/env python3
"""
Minimal HTTP server that sends incomplete chunks,
triggering ChunkedEncodingError in python-requests clients.
Reproducer for https://github.com/thp/urlwatch/issues/725
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@wfrisch
wfrisch / sqlite-list-non-standard-pragmas.py
Created June 13, 2023 10:52
sqlite: list non-standard pragmas in a database file
#!/usr/bin/env python3
import sys
import sqlite3
# Function to get the list of PRAGMA settings
def get_pragma_list(connection):
cur = connection.cursor()
cur.execute('PRAGMA pragma_list;')
return [row[0] for row in cur.fetchall()]
@wfrisch
wfrisch / cpp
Last active February 7, 2024 10:26
join a container from C/C++
/* Example on how to join the namespaces of containerized process */
#include <iostream>
#include <cstdint>
#include <sched.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
using namespace std;