Skip to content

Instantly share code, notes, and snippets.

View Gurkengewuerz's full-sized avatar
🎯
Focusing

Niklas Gurkengewuerz

🎯
Focusing
View GitHub Profile
@pirate
pirate / docker-compose-backup.sh
Last active March 31, 2024 00:51
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@kekru
kekru / 01nginx-tls-sni.md
Last active April 1, 2024 02:29
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active April 7, 2024 19:40
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 19, 2024 08:10
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@jampekka
jampekka / activity.py
Created April 2, 2017 20:56
/r/place activity animated heatmap
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
import pyximport; pyximport.install()
from pixcount import pixcount
import scipy.ndimage
data = np.load('diffs.npy')
ts = data[:,0]
frames = 1000
@LindaLawton
LindaLawton / GoogleAuthenticationCurl.sh
Last active August 8, 2023 14:08
Curl bash script for getting a Google Oauth2 Access token
# Tutorial https://www.daimto.com/how-to-get-a-google-access-token-with-curl/
# YouTube video https://youtu.be/hBC_tVJIx5w
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=http://127.0.0.1&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
@MartinEnders
MartinEnders / spamfilter-setup-postfix-dovecot.md
Last active January 29, 2022 21:27
Setup of spamfilter and sieve for postfix and dovecot

Packetinstallation

aptitude install spamassassin razor pyzor rsyslog
aptitude install amavisd-new
aptitude install dovecot-sieve dovecot-lmtpd
aptitude install clamav clamav-daemon
# restart freshclam and clamav-daemon when error messages occour:
# [FAIL] Clamav signatures not found in /var/lib/clamav ... failed!
@benkulbertis
benkulbertis / cloudflare-update-record.sh
Last active March 4, 2024 11:27
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@fumiyas
fumiyas / dovecot-ldap.conf.ext
Created October 15, 2012 11:08
Dovecot: Example config for maildir++ quota and so on
uris = ldap://a.ldap.example.jp/ ldap://b.ldap.example.jp/
ldap_version = 3
base = ou=%d,dc=example,dc=jp
scope = subtree
auth_bind = yes
pass_filter = (uid=%n)
pass_attrs = mailQuota=userdb_quota_rule=*:bytes=%$
user_filter = (uid=%n)