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
@mrrooijen
mrrooijen / Rakefile
Created March 12, 2021 12:30 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
WIFI:S:<SSID>;T:WPA;P:<PASSWD>;;
@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 / README.md
Created May 6, 2018 04:14
How to enable SSL with Redis (Ruby Driver) on RedisLabs.

How to enable SSL with [Redis] ([Ruby Driver]) on [RedisLabs].

Typically, this is how you'd connect to Redis:

Redis.new(url: ENV["REDIS_URL"])

Where REDIS_URL uses the following format:

@mrrooijen
mrrooijen / intel-microcode-update.md
Created January 18, 2018 06:25
How to update Intel microcode on Ubuntu.

Verify the microcode version prior to updating:

dmesg | grep microcode

Update your package list and install the following packages:

apt update
apt install microcode.ctl intel-microcode

Reboot and run the following command again to verify the new microcode is in effect:

@mrrooijen
mrrooijen / linux-kernel-update.md
Last active January 18, 2018 06:23
How to update the Linux kernel.

Verify your current kernel version:

uname -r

To update the Linux kernel, select a version from the following URL:

http://kernel.ubuntu.com/~kernel-ppa/mainline/

For example v4.14.13:

@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",
# Install Docker
curl -fsSL https://get.docker.com/ | sh
# Run Rancher
docker run -d \
--name=rancher \
--restart=always \
-v /var/lib/mysql:/var/lib/mysql \
-p 8080:8080 \
rancher/server:stable
@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)