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

Keybase proof

I hereby claim:

  • I am Radiergummi on github.
  • I am radiergummi (https://keybase.io/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
Radiergummi / ArtisanServeFormatter.php
Last active November 7, 2023 07:22
Formatter for Laravel's artisan serve command that will preserve log output
<?php
declare(strict_types=1);
namespace App\Support;
use DateTime;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\LineFormatter;
use Monolog\LogRecord;
@Radiergummi
Radiergummi / README.md
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
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, [ ...fail, elem ] ];
}, [ [] as T[], [] as V[] ] );
@Radiergummi
Radiergummi / deployment.sh
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": "http://json-schema.org/draft-07/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
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: https://stackoverflow.com/a/55392885/2532203
<template>
<div v-dragging="{ enter, leave }">
</div>
</template>
<script>
import './dragging.ts';
export default {
methods: {
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000
listen.backlog = 511
;listen.allowed_clients = 127.0.0.1
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user or group is differrent than the master process user.
@Radiergummi
Radiergummi / cloudflare_update_certificate.sh
Created February 28, 2020 15:45
Updates a custom certificate on Cloudflare from inside a Let's Encrypt renewal hook. Check the blog post at https://www.moritzfriedrich.com/posts/feature-branch-previews for more info..
#!/usr/bin/env php
<?php
// This should be the main domain your certificate is valid for. It's used for reverse
// matching the installed certificate and resolving the file path to your certificate
// files on the local file system.
$domain = 'your.domain.name.tld';
// This should be your Cloudflare zone ID. You can find it in the right sidebar on your
// Cloudflaare account dashboard.