Skip to content

Instantly share code, notes, and snippets.

View plasticine's full-sized avatar
🐧
Hello? Is this thing on?

Justin Morris plasticine

🐧
Hello? Is this thing on?
View GitHub Profile
@sethvargo
sethvargo / README.md
Last active June 1, 2026 16:33
A simple script for installing most HashiCorp tools (with GPG verification)
@s8sg
s8sg / MountVolumeFirecracker.md
Last active February 13, 2022 23:33
Volume Mount Firecracker

Create qcow image

qemu-img create -f qcow2 file.qcow2 100M
sudo mkfs.ext4 file.qcow2

Add drive it to the MicroVM

--add-drive=file.qcow2:rw
@s8sg
s8sg / NetworkingFirecracker.md
Last active May 25, 2025 19:16
Networking with Firecracker

Create Bridge interface on the host and give internet access

sudo ip link add name br0 type bridge
sudo ip addr add 172.20.0.1/24 dev br0
sudo ip link set dev br0 up
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables --table nat --append POSTROUTING --out-interface enp3s0 -j MASQUERADE
sudo iptables --insert FORWARD --in-interface br0 -j ACCEPT

Create a tap device and link to the bridge

@carterbryden
carterbryden / AddPostgresTriggerAndFunctionForAllTables.exs
Last active February 4, 2025 19:16
Elixir Phoenix Postgresql migration to add triggers for pubsub to run on every CRUD operation on every table. If a new table is added, it'll automatically add a trigger to that table too.
defmodule MyApp.Repo.Migrations.AddPostgresTriggerAndFunctionForAllTables do
use Ecto.Migration
def up do
# Create a function that broadcasts row changes
execute "
CREATE OR REPLACE FUNCTION broadcast_changes()
RETURNS trigger AS $$
DECLARE
current_row RECORD;
@optiz0r
optiz0r / Caddyfile.tmpl
Created April 29, 2021 07:35
Caddy with Nomad + Consul
{{- range services -}}
{{- if .Name | contains "sidecar" | not -}}
{{- $groupedServices := (service .Name | byMeta "caddy_enable") -}}
{{- $enabledServices := (index $groupedServices "true" ) -}}
{{- range $enabledServices -}}
{{- $vhost := index .ServiceMeta "caddy_vhost" -}}
{{- scratch.MapSetX "vhosts" $vhost . -}}
{{- end -}}
{{- end -}}
{{- end -}}