Skip to content

Instantly share code, notes, and snippets.

View akatrevorjay's full-sized avatar
🌙

Trevor Joynson akatrevorjay

🌙
View GitHub Profile
@akatrevorjay
akatrevorjay / insert_all_completions_matches.zsh
Created June 28, 2016 00:22
Zsh: Insert all completions/matches via bound key
# ^Xa to insert all matches
zle -C all-matches complete-word _generic
bindkey '^Xa' all-matches
zstyle ':completion:all-matches:*' old-matches only
zstyle ':completion:all-matches::::' completer _all_matches
@akatrevorjay
akatrevorjay / openpgp.txt
Created August 10, 2016 11:07
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:f2bee065f8281c9a0092ef16928f139c9871f640]
@akatrevorjay
akatrevorjay / openpgp.txt
Created August 12, 2016 16:55
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:f2bee065f8281c9a0092ef16928f139c9871f640]
#!/bin/bash
#
# Given standard docker line variables, parses and waits for them to respond to SYNs in parallel with timeout.
# Works with tcp, udp, and unix sockets.
#
# @deps bash>=4 netcat
# @url https://github.com/akatrevorjay/wait-for-linked-services
# @author trevorj
#
set -eo pipefail
@akatrevorjay
akatrevorjay / format-dict-recursively.py
Last active October 12, 2017 15:58
Format each string value of dictionary using values contained within itself, keeping track of dependencies as required.
import sys
import re
def format_dict_recursively(mapping, raise_unresolvable=True, strip_unresolvable=False, conversions={'True': True, 'False': False}):
"""Format each string value of dictionary using values contained within
itself, keeping track of dependencies as required.
Also converts any formatted values according to conversions dict.
@akatrevorjay
akatrevorjay / git-fshow
Last active May 19, 2024 01:39 — forked from junegunn/gist:f4fca918e937e6bf5bad
Browsing git commit history with fzf
#!/bin/zsh
# git-fshow - git commit browser
#
# https://gist.github.com/akatrevorjay/9fc061e8371529c4007689a696d33c62
# https://asciinema.org/a/101366
#
git-fshow() {
local g=(
git log
@akatrevorjay
akatrevorjay / loc
Last active May 19, 2024 01:31
loc: mlocate + fzf integration
#!/usr/bin/env zsh
#
# loc: mlocate + fzf integration
#
# https://gist.github.com/06dc1238b2fcbfb6c10bbad05ad79bc1
# https://asciinema.org/a/102006
#
# ~ trevorj <github@trevor.joynson.io>
#
setopt pipe_fail err_return err_exit
#!/bin/bash
set -eo pipefail
reset="\e[0m"
red="\033[0;31m"
green="\033[0;32m"
for url in "$@"; do
if curl -sSLfo /dev/null "$url" >/dev/null 2>&1; then
echo -e "${green}GOOD" "$url" "${reset}"
@akatrevorjay
akatrevorjay / ini2env.py
Last active June 9, 2017 10:55
Convert ini to env file
#!/usr/bin/env python
from __future__ import print_function, absolute_import
import itertools
import logging
import logging.config
import sys
import argparse
import io
@akatrevorjay
akatrevorjay / thespian-raft.py
Created June 23, 2017 03:07 — forked from rcarmo/thespian-raft.py
The Raft leader election protocol, implemented atop GoDaddy's Thespian actor library
from thespian.actors import *
from datetime import datetime, timedelta
from logging import getLogger, basicConfig, DEBUG
from random import randint
basicConfig(level=DEBUG)
log = getLogger(__name__)
class Postman(Actor):