Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
@mrrooijen
mrrooijen / openvpn_installer
Last active June 9, 2020 13:42
Installs OpenVPN
#!/bin/bash
# OpenVPN Installer
#
# This installer was designed to work with Ubuntu 14.04. It installs
# an OpenVPN server, generates an associated OpenVPN client configuration file,
# configures a firewall, and enables automatic security updates.
#
# Once the installer finishes, the `/root/client.ovpn` file will have been generated.
# Download this file to your local machine and open it in an OpenVPN client and you'll
@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
@mrrooijen
mrrooijen / README.md
Created August 15, 2012 01:30
Heroku SSL Endpoint, RapidSSL

Heroku SSL Endpoint

Assumptions:

  • You want to enable SSL for your domain.
  • You want to go with RapidSSL.
  • Your domain name is www.domain.com during this example.
  • You want to encrypt requests for a single domain (no wildcard)
  • You want to apply this certificate to Heroku's SSL Endpoint
@mrrooijen
mrrooijen / README.md
Created October 16, 2012 22:19
Ruby Environment On Mountain Lion

Ruby Environment On Mountain Lion

A quick and easy step-by-step guide to get your Ruby environment up and running again after a fresh install of Mountain Lion. I messed up my installations a few times and figured I'd just put out a Gist once and for all to get this sucker working in one go.

The Steps

First go ahead and install either XCode to get ahold of the Command Line Tools. Or, if you prefer not to install XCode, simply download the latest version directly. This only requires you to provide your Apple ID and password to sign in. You do not need a developers license.

  1. Download the Command Line Tools
  • Or install them through XCode via the preference panel
@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 / rancher
Last active July 15, 2016 14:04
Dumps, compresses, encrypts, transfers, and rotates Rancher backups to/on Amazon S3.
#! /bin/bash
# Dumps, compresses, encrypts, transfers, and rotates Rancher backups to/on Amazon S3.
# Requirements:
#
# 1. Docker
#
# $ curl -fsSL https://get.docker.com/ | sh
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"net/http"
)
func main() {