Skip to content

Instantly share code, notes, and snippets.

@tvdstaaij
tvdstaaij / rpi-install-cryptroot.sh
Last active October 20, 2025 13:19
Raspberry Pi headless full disk encryption with remote unlock
#!/bin/bash
# Based on guide: https://github.com/ViRb3/pi-encrypted-boot-ssh (rev cac7ac5)
#
# Some usage notes:
# - Definitions: "host" means the machine executing this script, "source" means the prebuilt Raspberry Pi OS image used as a base, "target" means the image or disk being provisioned
# - Assumes Debian host system, and execution as root. Running in a VM is highly recommended for safety reasons
# - Only tested with https://raspi.debian.net/tested-images/ Bookworm/Trixie RPi4 images as source (should also work for RPi3)
# - Assumes target with boot and root partition on one disk
# - Assumes Raspberry Pi is connected with Ethernet and DHCP (i.e. no special network configuration in initramfs)
# - After booting for the first time, you can ssh as `root` using one of the keys authorized for Dropbear

Docker Swarm with Macvlan, Consul and Autoscaling

TL;DR:

This will get you routable containers with IPs on your existing subnets, advertising to Consul. They will also be scalable and placed across a cluster of Swarm hosts. It's assumed that you are already running Consul, so if not, there are a ton of tutorials out there. It's also assumed you know how to install Docker and various Linux kernels.

Bonus: We add an autoscaling API called Orbiter (https://gianarb.it/blog/orbiter-the-swarm-autoscaler-moves).

I just want to run containers, like now, on my existing infrastructure and networks!

So you have an existing environment. You use Consul for service discovery. Life is good. Containers are now a thing and you want to work them in without having to worry about overlay networking or reverse proxies. You also don't want to add extra latency (as some naysayers could use it as fuel to kill your hopes and dreams). Lastly, you don't have a lot of time to invest in a complex orchestration tool, such a

@manufitoussi
manufitoussi / sync.html
Last active March 17, 2020 15:25
Synchronisation between iframe hash and hosting window hash. Usefull with an Ember application with routes hosted in an iframe
<!DOCTYPE html>
<html lang="fr-fr">
<head>
<meta charset="utf-8">
<title>Ember App in an iframe</title>
<style>
body {
padding:0;
@nirenjan
nirenjan / bishop.c
Created January 4, 2013 06:34
Simulate a drunken bishop walk to produce OpenSSL random art.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define XLIM 17
#define YLIM 9
#define ARSZ (XLIM * YLIM)
#define DEBUG 0
@ebouchut
ebouchut / LighttpdReverseProxyURLRewriting
Last active January 27, 2021 20:35
Lighttpd reverse-proxy to that matches an URL _and_ does URL rewriting #web #server #lighttpd
#server.modules += ( "mod_rewrite")
# Workaround to have a working reverse-proxy that matches an URL does URL rewriting in Ligghtpd.
#
# Ligtthpd 1.4.28 cannot perform both matching and URL rewriting at the same time.
# Therefore we need to define 2 proxies, one does the matching and bounce the request
# to the other one, in charge of rewriting the URL before proxying the request to the target server.
#
# More about this here:
# http://redmine.lighttpd.net/issues/164#note-9