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
import nodeFetch from 'node-fetch'; | |
let fetchImpl; | |
if (typeof fetch !== 'undefined') { | |
fetchImpl = fetch; | |
console.log('Using browser fetch'); | |
} else { | |
console.log('Using node-fetch'); | |
fetchImpl = nodeFetch; | |
} |
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
// unofficial sqlite3 types. | |
// initially based on https://gist.github.com/mizchi/cb572eae55154ec781ced5c111621939 | |
// by GitHub user @mizchi | |
// expanded by @jbaiter to: | |
// - describe all high-level APIs and data structures as closely as possible | |
// - include docstrings based on the official documentation | |
// - Type out and document all the low-level extension and WASM↔JS glue APIs. | |
declare module "@sqlite.org/sqlite-wasm" { | |
/** Types of values that can be passed to/retrieved from SQLite. */ |
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
/* Add your header comment here */ | |
#include "sqlite3ext.h" /* Do not use <sqlite3.h>! */ | |
SQLITE_EXTENSION_INIT1 | |
#include <stddef.h> | |
#include <string.h> | |
/* =================================================================== */ | |
/* =============== Copied from sqlite/fts5_aux.c ===================== */ | |
/* =================================================================== */ | |
#ifndef UNUSED_PARAM2 |
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
{ | |
"@context": "http://iiif.io/api/presentation/3/context.json", | |
"id": "https://127.0.0.1:8080/start_fixture.json", | |
"type": "Manifest", | |
"behavior": ["paged"], | |
"rights": "http://rightsstatements.org/vocab/NoC-NC/1.0/", | |
"metadata": [ | |
{ | |
"label": { "de": ["Titel"], "en": ["Title"] }, | |
"value": { |
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.9 | |
""" Rewriting proxy to reduce cardinality of Prometheus node-exporter counter metrics. | |
This small proxy service is intended to run alongside the Prometheus | |
node-exporter, with Prometheus fetching the metrics from the proxy instead of | |
from the exporter directly. The proxy will then apply user-defined rewriting | |
rules to the metrics' labels, currently either by wholesale removal of certain | |
labels or by rewriting certain label values. If, after rewriting, there are | |
several time series with identical names and labels, they are summed to form a | |
single counter metric. |
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
import requests | |
from keycloak import KeycloakOpenID | |
# To obtain this, log into your account and select a person. | |
# The citizen ID is the last part of the URL, a UUID | |
CITIZEN_ID = None | |
# This is your authentication info | |
EMAIL = None | |
PASSWORD = None |
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
/** Merge multiple refs into a single one. | |
* | |
* Taken from https://www.davedrinks.coffee/how-do-i-use-two-react-refs/, type-hints by us | |
*/ | |
export function mergeRefs<T>( | |
...refs: (React.MutableRefObject<T> | React.Ref<T>)[] | |
): React.Ref<T> | null { | |
const filteredRefs = refs.filter(Boolean) | |
if (!filteredRefs.length) return null | |
if (filteredRefs.length === 0) return filteredRefs[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
#!/usr/bin/env python3 | |
from __future__ import annotations | |
import html | |
import sys | |
from concurrent.futures import ProcessPoolExecutor, as_completed | |
from dataclasses import dataclass | |
from enum import Enum | |
from itertools import chain | |
from multiprocessing import cpu_count |
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
String anonymizeIp(def ip) { | |
if (ip.contains(':')) { | |
try { | |
StringTokenizer tok = new StringTokenizer(ip, ':'); | |
String firstGroup = tok.nextToken(); | |
String secondGroup = tok.nextToken(); | |
String thirdGroup = tok.nextToken(); | |
return firstGroup + ":" + secondGroup + ":" + thirdGroup + ":0:0:0:0:0"; | |
} catch (Exception e) { | |
return "0:0:0:0:0:0:0:0"; |
NewerOlder