Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am j18e on github.
  • I am j18e (https://keybase.io/j18e) on keybase.
  • I have a public key ASBTWHuLkz_4no8CmGB_kFkwI3duTnfDtl9GK2ui74ImLgo

To claim this, I am signing this object:

@j18e
j18e / traefik-dynamic.yml
Created April 6, 2020 11:02
Traefik Forward Auth
http:
routers:
# http_catchall redirects all incoming traffic from http to https
http_catchall:
entrypoints:
- "http"
middlewares:
- "https_redirect"
rule: "HostRegexp(`{any:.+}`)"
service: "noop"
@j18e
j18e / remove-from-git-history.sh
Created November 14, 2019 14:55
Remove file(s) from git history
#!/bin/bash -eu
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch src/images/my_large_photos_*.jpg' \
--prune-empty --tag-name-filter cat -- --all
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"strings"
"sync"
"time"
@j18e
j18e / docker-compose.yml
Last active January 17, 2023 01:19
Unifi controller behind Traefik reverse proxy in Docker
version: '3'
services:
unifi:
restart: always
hostname: unifi
container_name: "unifi"
image: linuxserver/unifi-controller
volumes: ["../data/unifi/:/config"]
environment:
TZ: "America/Seattle"
@j18e
j18e / karabiner.json
Last active January 30, 2019 13:27
App switching, Norwegian characters, ctrl/esc over caps, hyper using Karabiner elements on mac
{
"global": {
"check_for_updates_on_startup": false,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@j18e
j18e / keymods.ahk
Created December 29, 2018 07:02
Auto hotkey config to remap ctrl and esc to caps lock, and to map alt+[]\ to vol up down and mute
; Volume control (turn master volume up and down with Ctrl-Alt-Up/Down and
; toggle mute with Ctrl-Alt-.)
!]::Send {Volume_Up}
![::Send {Volume_Down}
!\::Send {Volume_Mute}
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
@j18e
j18e / config
Created July 22, 2018 08:46
Configure SSH Port Forwards
# in ~/.ssh/config
# run `ssh application-server` to use forward, then `curl localhost:8080`
Host application-server
HostName bastion.mycloud.app
User admin
ForwardAgent yes
ForwardX11 yes
LocalForward 8080 app-server-01.mycloud.local:80
@j18e
j18e / yamplate.py
Last active March 6, 2018 13:13
yamplate
from jinja2 import Environment, meta, StrictUndefined, exceptions
from yaml import load_all
def get_manifests(template_string, overrides):
config = get_config(template_string)
for k, v in overrides.items():
config['parms'][k] = v
rendered = render_jinja(template_string, config['parms'])
results = list(load_all(rendered))
try:
@j18e
j18e / ssh-port-forwarding
Last active January 8, 2018 15:23
SSH Port Forwarding
# $HOME/.ssh/config
Host example-forward
HostName bastion.example.com
ForwardAgent yes
ForwardX11 yes
LocalForward 9090 app-0.example.local:8080
# this allows you to run `ssh example-forward`
# you'll get an SSH session but more importantly,