Skip to content

Instantly share code, notes, and snippets.

@mrrooijen
mrrooijen / check.sh
Created Dec 3, 2016
View (graph of) receiving and transmitting (sending) data
View check.sh
speedometer -r eth0 -t eth0
@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 ""
View sys.go
package main
import (
"fmt"
"syscall"
)
const (
B = 1
KB = 1024 * B
@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
@mrrooijen
mrrooijen / database.sslmode.require.yml
Last active Nov 3, 2020
SSL configurations for Rails + Postgres in either require or verify-full mode to ensure secure connections. Useful for Amazon RDS, Compose.io, etc.
View database.sslmode.require.yml
production:
adapter: postgresql
encoding: unicode
sslmode: require
url: postgres://user:password@host:port/db
@mrrooijen
mrrooijen / pg_dump_restore
Last active Apr 9, 2016
Postgres Dump/Restore From/To RDS/Compose
View pg_dump_restore
export HOSTNAME_A=todo
export PORT_A=todo
export DBNAME_A=todo
export USERNAME_A=todo
export HOSTNAME_B=todo
export PORT_B=todo
export DBNAME_B=todo
export USERNAME_B=todo
View README.md

This is a shell script for backing up a configurable $path to your iCloud Drive or Dropbox folder for off-site storage. Backups are lzma compressed and gpg encrypted using your public gpg key. Additionally, backups are automatically rotated using $keep.

Prerequisites:

  • GPG public key
  • iCloud Drive or Dropbox

Procedure (assuming path=/Developer; storage=iCloud; keep=7):

  1. Creates archive of $HOME/Developer