Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
@mrrooijen
mrrooijen / database.sslmode.require.yml
Last active February 6, 2024 21:33
SSL configurations for Rails + Postgres in either require or verify-full mode to ensure secure connections. Useful for Amazon RDS, Compose.io, etc.
production:
adapter: postgresql
encoding: unicode
sslmode: require
url: postgres://user:password@host:port/db
@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 / README.md
Last active February 11, 2023 19:44
Setting up XEN on a Hetzner Dedicated Server

Setting up XEN on a Hetzner Dedicated Server

Author: Michael van Rooijen (@mrrooijen)

DISCLAIMER: I am a programmer, not a sysadmin in my day-to-day life. I provide this guide simply as a self-reference, and as a way to contribute to the community of developers. The main motivation for writing this guide is because of the lack of properly written guides/tutorials. They were either out-dated, inaccurate, in a non-English language or simply too vague to understand (at least for me, as a programmer and not a sysadmin).

I hope this guide helps getting you up and running with your own collection of VPS's on your own Dedicated Server over at Hetzner.de.

Requirements:

@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@mrrooijen
mrrooijen / mongodb.sh
Created February 6, 2010 10:53
Simple MongoDB install script.
# Downloads MongoDB Version 1.2.2 to the Home Dir
# Extracts it and moves the contents into the /var/mongodb folder
# Creates a symlink from /var/mongodb/mongod to /usr/local/sbin
cd ~/
wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-1.2.2.tgz
tar -xf mongodb-linux-x86_64-1.2.2.tgz
mkdir -p /var/mongodb
mv mongodb-linux-x86_64-1.2.2/* /var/mongodb/
ln -nfs /var/mongodb/bin/mongod /usr/local/sbin
@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="me@example.com"
domains="example.com,*.example.com"
cloudflare_email="me@example.com"
cloudflare_api_key="me-api-key"
# END CONFIG
brew install certbot
@mrrooijen
mrrooijen / pc.txt
Created September 14, 2012 10:32
Awesome PC Build
70 EUR | Case | BitFenix Prodigy (White) | http://azerty.nl/0-1831-527460/bitfenix-prodigy.html
20 EUR | Fan Front | BitFenix Spectre 230mm (Black) | http://www.informatique.nl/444497/bitfenix-spectre-pro-bff-lpro-23030w-rp.html
15 EUR | Fan Rear | BitFenix Spectre 140mm (Black) | http://www.informatique.nl/444490/bitfenix-spectre-pro-bff-lpro-140225w-rp.html
24 EUR | Fan Top | BitFenix Spectre 120mm (Black) x2 | http://www.informatique.nl/444486/bitfenix-spectre-pro-bff-lpro-12025w-rp.html
35 EUR | Fan Controller | BitFenix Recon | http://azerty.nl/0-1087-520155/bitfenix-recon-fancontroller.html
182 EUR | Motherboard | ASUS P8Z77-I Deluxe (Blue) | http://azerty.nl/producten/product_detail/4924/510802/asus-p8z77-i-deluxe-moederbord-mini-itx-lga1155-socket-z77-usb-3-0-802-11a-b-g-n-bluetooth-gigabit-ethernet-in
@mrrooijen
mrrooijen / PostgreSQL-UTF8.sh
Created December 31, 2011 18:37
Make PostgreSQL use UTF-8 encoding instead of ASCII.
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
\c template1
VACUUM FREEZE;
UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template1';
@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)
@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