Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
@mrrooijen
mrrooijen / acquire-ssl-certificate.sh
Last active August 6, 2022 08:29
Script to acquire Let's Encrypt SSL certificate using DNS challenge against Cloudflare.
#! /bin/sh
email="[email protected]"
domains="example.com,*.example.com"
cloudflare_email="[email protected]"
cloudflare_api_key="me-api-key"
# END CONFIG
brew install certbot
@ityonemo
ityonemo / test.md
Last active October 25, 2024 15:24
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@mrrooijen
mrrooijen / docker-certbot-wildcard-dns.sh
Last active June 7, 2018 15:52
Command to produce a wildcard ssl certificate using the Let's Encrypt Certificate Authority. Verification is done using the DNS challenge. The resulting certificates can be found in ./ssl/live/example.com.
docker run -it --rm --name certbot \
-v $(pwd)/ssl:/etc/letsencrypt \
-v $(pwd)/ssl:/var/lib/letsencrypt \
certbot/certbot certonly \
--server https://acme-v02.api.letsencrypt.org/directory \
--manual \
--preferred-challenges dns \
-d *.example.com \
-d example.com
@mrrooijen
mrrooijen / countries.json
Last active August 8, 2017 00:29
JSON collection of 2-letter ISO 3166 alpha-2 code country list.
{
"AF": "Afghanistan",
"AX": "AlandIslands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "AmericanSamoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
@mrrooijen
mrrooijen / global_register.ex
Created January 2, 2017 15:55
Ensure that only one instance of a given (supervised) process exists in the cluster.
defmodule Party.Clock do
use GenServer
def start_link do
case GenServer.start_link(__MODULE__, [], name: {:global, __MODULE__}) do
{:ok, pid} ->
{:ok, pid}
{:error, {:already_started, pid}} ->
IO.puts("Already started!!")
Process.link(pid)
@mrrooijen
mrrooijen / ssh_config
Created December 21, 2016 02:00
SSH config for keeping idle connections alive, and to automatically add ssh key to agent.
Host *
ServerAliveInterval 60
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
@justjanne
justjanne / Price Breakdown.md
Last active October 26, 2024 16:36 — forked from kylemanna/price.txt
Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Permalink: git.io/vps

$5/mo

Provider Type RAM Cores Storage Transfer Network Price
@mrrooijen
mrrooijen / gencert
Last active August 7, 2016 02:42
SSL Certificate Generator (self-signed, requires openssl). Add both generated key- and crt files to your web server. Add crt to your local keychain and/or browser.
#! /bin/sh
if [ "$1" == "" ]; then
echo ""
echo "SSL Certificate Generator (self-signed, requires openssl)."
echo ""
echo " Usage:"
echo ""
echo " gencert <days> # Produces server.key and server.crt"
echo ""
@mrrooijen
mrrooijen / cmd.sh
Created April 21, 2016 15:11
Destroy File Vault Key when going to standby mode. Enter standby immediately on sleep.
sudo pmset -a destroyfvkeyonstandby 1 hibernatemode 25
@mrrooijen
mrrooijen / heroku_pg_backup
Last active April 18, 2016 13:17
Fetches, encrypts, transfers and rotates Heroku Postgres backups to/on Amazon S3.
#! /bin/bash
# Fetches, encrypts, transfers and rotates Heroku Postgres backups to/on Amazon S3.
# Requirements:
#
# 1. Heroku Toolbelt
#
# $ wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh