Skip to content

Instantly share code, notes, and snippets.

@jinnko
jinnko / fix_docker_host_vpn_connectivity.sh
Last active May 1, 2020 12:07 — forked from codemedic/vpn-docker-fix
Fix connectivity from docker network through host IPSec / Strongswan VPN
#!/usr/bin/env bash
# Link up docker network via IPSec VPN on docker-host
#
# Usage: [dry_run=1] [debug=1] vpn-docker-fix [<a-docker-network-name-or-id>]
#
# Env Variables:
# docker_network - Defaults to docker0
# dry_run - Set to 1 to have a dry run, just printing out the iptables command
# debug - Set to 1 to see bash substitutions
@jinnko
jinnko / patch-killer-firmware.zsh
Last active January 9, 2021 21:45
Automate patching Killer Wireless firmware on Ubuntu for Dell XPS 9370
#!/usr/bin/env zsh
#
# See the following AskUbuntu question for why this is a thing
# https://askubuntu.com/questions/1024281/dell-xps-13-9370-bluetooth-issues/1148484#1148484
#
# As the overwritten files are owned by the linux-firmware package you may want to add this
# script to an @reboot cron of the root user.
#
# This script uses the Windows driver package as the src of the firmware bin files. This can
# be acquired from https://www.dell.com/support/home/uk/en/ukbsdt1/drivers/driversdetails?driverId=1JVK3
@jinnko
jinnko / aws-ssh.sh
Created April 20, 2018 11:33
SSH to AWS EC2 instances behind a bastion, using ec2-ssh
#!/bin/sh
usage() {
echo "Usage: $(basename "$0") [-h|--help] [-J USER@HOST] [-l user] [ssh-opts] \$ec2-host"
}
help() {
usage
echo
echo "SSH to an EC2 host determined by the Name tag, via a bastion host."
@jinnko
jinnko / keybase.md
Created July 12, 2017 14:27
keybase.md

Keybase proof

I hereby claim:

  • I am jinnko on github.
  • I am jinn_gds (https://keybase.io/jinn_gds) on keybase.
  • I have a public key whose fingerprint is 6B03 1AC4 B5B9 CED6 808A 96D2 1938 8E4F B6AF F041

To claim this, I am signing this object:

@jinnko
jinnko / keybase.md
Created June 30, 2017 09:57
keybase.md

Keybase proof

I hereby claim:

  • I am jinnko on github.
  • I am jinn (https://keybase.io/jinn) on keybase.
  • I have a public key ASAk-KAa77rdx1qtYYQCq6gmY2NjpnVarxntBnbhau_Aawo

To claim this, I am signing this object:

@jinnko
jinnko / es-verify-closed-indices.sh
Last active November 1, 2023 09:36
Script to open elasticsearch indices, allow them to complete verification or shard redistribution, then close the index.
#!/bin/dash -e
# vim:ts=2 sw=2 sts=2 expandtab:
# How long to wait for an opened index to become green
TIMEOUT=3600
DELAY=5
say() {
echo
echo "\033[32m===> \033[1;37m${1}\033[0m"

Keybase proof

I hereby claim:

  • I am jinnko on github.
  • I am jinn (https://keybase.io/jinn) on keybase.
  • I have a public key whose fingerprint is 6B03 1AC4 B5B9 CED6 808A 96D2 1938 8E4F B6AF F041

To claim this, I am signing this object:

@jinnko
jinnko / pem-split
Last active April 5, 2024 15:13
Take a PEM format file as input and split out certs and keys into separate files.
#!/usr/bin/awk -f
#
# Take a PEM format file as input and split out certs and keys into separate files
#
BEGIN { n=0; cert=0; key=0; if ( ARGC < 2 ) { print "Usage: pem-split FILENAME"; exit 1 } }
/-----BEGIN PRIVATE KEY-----/ { key=1; cert=0 }
/-----BEGIN CERTIFICATE-----/ { cert=1; key=0 }
split_after == 1 { n++; split_after=0 }
/-----END CERTIFICATE-----/ { split_after=1 }
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
[example.org]
listen = /srv/vhtdocs/example.org/log/.php-fpm.sock
listen.owner = example_org
listen.group = www-data
listen.mode = 0660
user = example_org
group = example_org
pm = dynamic