Skip to content

Instantly share code, notes, and snippets.

View tino's full-sized avatar

Tino de Bruijn tino

View GitHub Profile
@capocasa
capocasa / postgres-database-setup
Last active December 2, 2024 20:48
Triple-Redundant Hetzner Debian postgres setup
##### This is how to set up a triple redundant postgres.
##### Use a main box on Hetzner, a secondary small box on Hetzner in a
##### different datacenter for query replication, and a Hetzner Storage-Box
##### for file replication.
##### There will always be two copies of the data in different datacenters by the time
##### the transaction completes.
##### Here, Wireguard is used to have an internal network between the two hosts,
##### but Hetzner networks could also be used. SSH access between the two boxes
@synotna
synotna / .README.md
Last active November 22, 2015 13:39
How to use .gitgnore for Dockerfile because .dockerignore sucks

Want to exclude patterns of files at any folder depth?

Pulling your hair out because .dockerignore (Go filepath.Match) sucks?

Don't waste time with .dockerignore

Make use of tar's pattern matching together with Docker's tar support and save your sanity!

@paulirish
paulirish / bling.js
Last active February 18, 2025 14:08
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@denji
denji / golang-tls.md
Last active April 26, 2025 07:32 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
#!/bin/bash
set -x
HOST=https://www.ticketswap.nl
FISSA="$1" # Example: /53148/de-beste-singer-songwriter-van-nederland
while :
do
date
URI=$(curl -s "$HOST$FISSA" \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36' \
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active April 20, 2025 17:02
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
# bootstrap.yml
---
- hosts: newservers
vars:
- ubuntu_release: raring
- logwatch_email: <your email addy>
# crypted passwords, generated on a Linux box using:
# echo 'import crypt,getpass; print crypt.crypt(getpass.getpass(), "$6$YOURSALT")' | python -
- root_password: ''
@btimby
btimby / settings.py
Last active August 24, 2021 14:35
Use a Django database router, a TestCase mixin and thread local storage to allow unit tests to switch databases.
# Detect if executed under test
TESTING = any(test in sys.argv for test in (
'test', 'csslint', 'jenkins', 'jslint',
'jtest', 'lettuce', 'pep8', 'pyflakes',
'pylint', 'sloccount',
))
if TESTING:
# If testing, move the default DB to 'mysql' and replace it
# with a SQLite DB.
gps <- read.csv("out.csv",
header = TRUE)
library(ggmap)
mapImageData <- get_googlemap(center = c(lon = median(gps$Longitude), lat = median(gps$Latitude)),
zoom = 11,
# size = c(500, 500),
maptype = c("terrain"))
ggmap(mapImageData,
@skizzybiz
skizzybiz / .bash_profile
Created September 26, 2012 17:17
Multiline Bash command prompt with user, host, path, git status, right-aligned timestamp.
# Define colors
RESET='\[\033[00m\]'
FGBK='\[\033[0;30m\]' # foreground black
FGRD='\[\033[0;31m\]' # foreground red
FGGN='\[\033[0;32m\]' # foreground green
FGYL='\[\033[0;33m\]' # foreground yellow
FGBL='\[\033[0;34m\]' # foreground blue
FGMG='\[\033[0;35m\]' # foreground magenta
FGCY='\[\033[0;36m\]' # foreground cyan
FGGR='\[\033[0;37m\]' # foreground gray