Skip to content

Instantly share code, notes, and snippets.

Michael van Rooijen mrrooijen

View GitHub Profile
@mrrooijen
mrrooijen / docker-certbot-wildcard-dns.sh
Last active Jun 7, 2018
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.
View docker-certbot-wildcard-dns.sh
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 Aug 8, 2017
JSON collection of 2-letter ISO 3166 alpha-2 code country list.
View countries.json
{
"AF": "Afghanistan",
"AX": "AlandIslands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "AmericanSamoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
@mrrooijen
mrrooijen / global_register.ex
Created Jan 2, 2017
Ensure that only one instance of a given (supervised) process exists in the cluster.
View global_register.ex
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 Dec 21, 2016
SSH config for keeping idle connections alive, and to automatically add ssh key to agent.
View ssh_config
Host *
ServerAliveInterval 60
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
@justjanne
justjanne / Price Breakdown.md
Last active Jun 6, 2020 — forked from kylemanna/price.txt
Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:
View Price Breakdown.md

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 Aug 7, 2016
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.
View gencert
#! /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 Apr 21, 2016
Destroy File Vault Key when going to standby mode. Enter standby immediately on sleep.
View cmd.sh
sudo pmset -a destroyfvkeyonstandby 1 hibernatemode 25
@mrrooijen
mrrooijen / heroku_pg_backup
Last active Apr 18, 2016
Fetches, encrypts, transfers and rotates Heroku Postgres backups to/on Amazon S3.
View heroku_pg_backup
#! /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
@mrrooijen
mrrooijen / rancher
Last active Jul 15, 2016
Dumps, compresses, encrypts, transfers, and rotates Rancher backups to/on Amazon S3.
View rancher
#! /bin/bash
# Dumps, compresses, encrypts, transfers, and rotates Rancher backups to/on Amazon S3.
# Requirements:
#
# 1. Docker
#
# $ curl -fsSL https://get.docker.com/ | sh
@mrrooijen
mrrooijen / gitlab_backup
Last active May 27, 2016
Generates, encrypts, transfers and rotates Gitlab backups to/on Amazon S3.
View gitlab_backup
#! /bin/bash
# Generates, encrypts, transfers and rotates Gitlab backups to/on Amazon S3.
# Requirements:
#
# 1. Gitlab
#
# $ apt-get update
You can’t perform that action at this time.