Skip to content

Instantly share code, notes, and snippets.

View sw00's full-sized avatar

Sett sw00

View GitHub Profile
@sw00
sw00 / sett.pubkey.asc
Created May 4, 2021 23:14
PGP Public Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBF12A68BDAC6TJidwDHYotVuDxz6egEPAXDmDadyEL2AxZcc9Ugpcv29jIwI
3b5g+uWZexXhEqqYsW3JHeVD5Anm2JzOXCSzEY8sAX7UD5wcFC30MJfgpTNU1nPl
hEP7b8d56AlVDjrrffFD2BzI+TaBKEUPIoQsaOZlICuPZji8yacG+LjYZGn9v+Rt
K2VDqcan7E4KQQjF/lIZJCMDThJyHw2NCkiLK9JK/gZs/VukLUr31KukzZw2WKWY
3FAcUXQmY86r+7r6lMqcwlM2UazQh9AtY/d27MEJP/zHj7znZVjgOUkDDqNxcnKp
S4YxkuqtkYrXIyvlrLrWxkIRkFX14PJrLxbAoufOdjclIgauDBAWU1DSS7urFLIG
fgoxE/dWhJ1hu5TVRIx7oJ5IhiZOBJthJE9rPFORj2pIK/EA3knnDsHrzTJH+8AQ
cJnaqjWADiFjWawVpLw491l+CmeuvbLACN59F0zpq/1n5KLRG/5N0sxVwblPxBif
@sw00
sw00 / bootstrap_network.sh
Last active July 9, 2019 20:52
Bash script to configure routes so that host can still serve traffic over its public IP interface while VPN is on.
#!/bin/bash
set -xe
calculate_subnet() {
IP=$1
PREFIX=$2
{ IFS=. read -r i1 i2 i3 i4; } <<< $IP
{ IFS=. read -r xx m1 m2 m3 m4; } <<< $(for a in $(seq 1 32); do if [ $(((a - 1) % 8)) -eq 0 ]; then echo -n .; fi; if [ $a -le $PREFIX ]; then echo -n 1; else echo -n 0; fi; done)
printf "%d.%d.%d.%d\n" "$((i1 & (2#$m1)))" "$((i2 & (2#$m2)))" "$((i3 & (2#$m3)))" "$((i4 & (2#$m4)))"
@sw00
sw00 / pipdeptree.py
Created January 15, 2019 08:20
Patched pipdeptree so --reverse, --packages and --graph-output flags work together.
from __future__ import print_function
import os
import sys
from itertools import chain
from collections import defaultdict
import argparse
from operator import attrgetter
import json
from importlib import import_module
@sw00
sw00 / .macos
Created August 2, 2017 17:47
Reference gist of MacOS defaults copied directly from https://github.com/mathiasbynens/dotfiles/blob/master/.macos
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
Verifying that +sw00 is my blockchain ID. https://onename.com/sw00
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@sw00
sw00 / keybase.md
Last active November 15, 2015 21:16
Proof of authentication for keybase.io

Keybase proof

I hereby claim:

  • I am sw00 on github.
  • I am sw00 (https://keybase.io/sw00) on keybase.
  • I have a public key whose fingerprint is 92DF BE62 EBBD 1861 9CC1 B9ED F30F 2F27 F014 F286

To claim this, I am signing this object:

@sw00
sw00 / chris-lea_nodejs_apt_key_problems
Created July 21, 2014 10:40
Problem provisioning nodejs from Chris Lea's PPA due to key error (2014-07-21)
vagrant@precise64:~$ apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 136221EE520DDFAF0A905689B9316A7BC7917B12
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.tWGG1sGWk1 --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 136221EE520DDFAF0A905689B9316A7BC7917B12
gpg: requesting key C7917B12 from hkp server keyserver.ubuntu.com
gpg: no writable keyring found: eof
gpg: error reading `[stream]': general error
gpg: Total number processed: 0
"ansible_all_ipv4_addresses": [
"REDACTED IP ADDRESS"
],
"ansible_all_ipv6_addresses": [
"REDACTED IPV6 ADDRESS"
],
"ansible_architecture": "x86_64",
"ansible_bios_date": "09/20/2012",
"ansible_bios_version": "6.00",
"ansible_cmdline": {
@sw00
sw00 / ansible.inventory_params
Created May 28, 2014 13:39
List of ansible inventory behaviour parameters.
ansible_ssh_host
The name of the host to connect to, if different from the alias you wish to give to it.
ansible_ssh_port
The ssh port number, if not 22
ansible_ssh_user
The default ssh user name to use.
ansible_ssh_pass
The ssh password to use (this is insecure, we strongly recommend using --ask-pass or SSH keys)
ansible_sudo_pass
The sudo password to use (this is insecure, we strongly recommend using --ask-sudo-pass)