Skip to content

Instantly share code, notes, and snippets.

View blackandred's full-sized avatar
Let's change the world

Andrew Johnson blackandred

Let's change the world
  • Non-profit, activist
  • Saskatoon, Canada
View GitHub Profile
@vbatts
vbatts / cloud-config.yaml
Last active April 21, 2024 20:24
flatcar+k3s cloud-init
#cloud-config
coreos:
units:
- name: install-opt-dir.service
content: |
[Unit]
Description=Install /opt directories
ConditionPathIsDirectory=!/opt/libexec
ConditionPathIsDirectory=!/opt/libexec.wd
@zicklag
zicklag / swarm.yml
Created August 17, 2019 19:15
Taiga Docker Swarm Stack
version: '3.5'
services:
taiga:
image: quay.io/riotkit/taiga:4.2.7
networks:
- default
- webgateway
volumes:
- media:/usr/src/taiga-back/media
@kekru
kekru / 01nginx-tls-sni.md
Last active May 6, 2024 14:59
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
@xenogenesi
xenogenesi / Makefile
Last active November 19, 2021 03:28
create self signed certificates
DOMAIN ?= mydomain.com
COUNTRY := IT
STATE := IT
COMPANY := Evil Corp.
# credits to: https://gist.github.com/fntlnz/cf14feb5a46b2eda428e000157447309
# usage:
@blackandred
blackandred / implemented-traits.php
Created July 30, 2018 06:38
PHP: Get all implemented traits recursively in parents, parents-parents, parents-...-parents
<?php declare(strict_types=1);
class SomeThing
{
private function getClassTraitNames(string $className = null): array
{
if ($className === null || !class_exists($className)) {
return [];
}

Time Travel Debugging

Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:

  • pause and step forwards or backwards
  • pause and rewind to a prior state
  • rewind to the time a console message was logged
  • rewind to the time an element had a certain style or layout
  • rewind to the time a network asset loaded
@blackandred
blackandred / ProxyController.py
Created May 31, 2018 19:55
Tornado: Redirect all traffic to external server
from tornado import web
import tornado
import tornado.httpclient
import tornado.httputil
import logging
from .BaseController import BaseHandler
logger = logging.getLogger('tornado_proxy')
@seanhandley
seanhandley / docker-compose.yml
Last active April 9, 2024 04:05
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@magiknono
magiknono / rocket-css-slack.css
Created November 1, 2017 09:12
A minimal slack theme for rocket chat
@import url('https://fonts.googleapis.com/css?family=Lato');
.global-font-family {
font-family: 'Lato', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.message {
font-size:1.1em;
line-height: 1.4em;

#Setting up Docker Machine on Raspberry PI

  1. SSH into the pi and install docker with curl -sSL https://get.docker.com | sh (If we let Machine try to install the Docker daemon it will fail.)
  2. Change the OS's ID so Docker Machine won't throw errors. sudo nano /etc/os-release and change the line that says ID=raspbian to ID=debian
  3. From a new terminal window run docker-machine create --driver generic --generic-ip-address YOUR-PIS-IP --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user pi --engine-storage-driver overlay2 MACHINE-NAME