Skip to content

Instantly share code, notes, and snippets.

View Radiergummi's full-sized avatar
Yes of course I can implement that 🥲

Moritz Friedrich Radiergummi

Yes of course I can implement that 🥲
View GitHub Profile
import type { Client, Database } from '$lib/server/database';
import type { Insertable, Selectable } from 'kysely';
const table = 'authentication.challenge' as const;
export async function resolveCurrentChallenge(
client: Client,
identifier: string
) {
const { challenge, expires_at } = await client

Keybase proof

I hereby claim:

  • I am Radiergummi on github.
  • I am radiergummi ( on keybase.
  • I have a public key whose fingerprint is E221 7CF8 EE59 2CB0 9F03 A1C8 B315 6A31 942E 83A6

To claim this, I am signing this object:

Radiergummi / ArtisanServeFormatter.php
Last active November 7, 2023 07:22
Formatter for Laravel's artisan serve command that will preserve log output
namespace App\Support;
use DateTime;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\LineFormatter;
use Monolog\LogRecord;
Radiergummi /
Last active July 17, 2023 07:40
Docker Swarm Deployment

This is the deployment runner script we use in our BitBucket pipelines. It does the following things, in this order:

  1. Sign in to Docker Hub
    So we can download images and propagate authentication to Swarm nodes. This connects to the connection in DOCKER_HOST (defaulting to the Docker socket), so you can also run this within a deployment container - see below for more.
  2. Expand secrets and configs
    To configure services, we can use configs and secrets to let the swarm engine mount those values securely
Radiergummi / partition.ts
Created April 19, 2023 07:53
A type-preserving TypeScript helper to partition arrays.
* Partition an array into two arrays based on a predicate.
* @param array
* @param isValid
export function partition<T, V>( array: ( T | V )[], isValid: ( x: T | V ) => x is T ): [ T[], V[] ] {
return array.reduce( ( [ pass, fail ], elem ) => {
return isValid( elem ) ? [ [ ...pass, elem ], fail ] : [ pass, [, elem ] ];
}, [ [] as T[], [] as V[] ] );
Radiergummi /
Last active March 18, 2024 19:54
RabbitMQ configuration
#!/usr/bin/env sh
export DOCKER_HOST=unix:///var/run/docker.sock
docker_hosts=$(docker node ls --format '{{.Hostname}}')
# Retrieve the list of hosts from the Docker node (needs to run
# within the Swarm).
# We use this list to configure RabbitMQ statically: On every node
# in the cluster, a RabbitMQ instance is running. They are
# configured to use the Swarm node hostname as their hostname; so
This file has been truncated, but you can view the full file.
"$schema": "",
"definitions": {
"Stripe.Account": {
"description": "The Account object.",
"properties": {
"business_profile": {
"$ref": "#/definitions/Stripe.Account.BusinessProfile",
"description": "Business information about the account."
* Validates a value that isn't falsy.
* @param field
* @param message
export function required(
field?: string,
message?: string | Message<string>,
): Validator {
Radiergummi / App.vue
Last active May 2, 2023 09:51
A Vue directive to react to something being dragged on the browser window. Port of this Stack Overflow answer:
<div v-dragging="{ enter, leave }">
import './dragging.ts';
export default {
methods: {
user = www-data
group = www-data
listen =
listen.backlog = 511
;listen.allowed_clients =
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user or group is differrent than the master process user.