Skip to content

Instantly share code, notes, and snippets.

🌙

Trevor Joynson akatrevorjay

🌙
Block or report user

Report or block akatrevorjay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View container-exec
#!/bin/bash
set -eo pipefail
usage() {
cat <<-'EOF'
# Container exec
A method for exporting commands for transparent docker-compose usage from your shell,
letting you forget that you're even using commands across different containers.
@akatrevorjay
akatrevorjay / tabs-to-repos.py
Last active Mar 9, 2018
Download all github repos that you have open in firefox tabs
View tabs-to-repos.py
#!/usr/bin/env python3
"""
_____________
tabs-to-repos -- Quickly gnt all of the github repos that you have open in firefox tabs.
Pipe the output to your shell to actually clone them, otherwise it just prints the commands and some comments ;)
@trevorj 12/2017
https://gist.github.com/akatrevorjay/3fb5bc753edd42b2abd0accb4dde4cdc
"""
@akatrevorjay
akatrevorjay / json2yaml.py
Last active Jun 27, 2019
( json2yaml | yaml2json | j2y | y2j ) that preserves original ordering in all cases (for normal types at least)
View json2yaml.py
#!/usr/bin/env python
"""
json2yaml -- what it says.
Features:
- Preserves order of original document, which makes diffing much easier.
- Symlink it to `j2y`, `y2j`, 'yaml2json` and it'll do what you expect.
https://gist.github.com/akatrevorjay/918755c8eb2c66a48566d77fb578630c
"""
@akatrevorjay
akatrevorjay / es-send-search-party
Last active Dec 6, 2017
Kick elasticsearch until it finds your unassigned shards
View es-send-search-party
#!/usr/bin/env zsh
##
## "You know, for sanity."
##
## ES clusters can determine that your shards are permanently missing at times, marking them forever unassigned.
## You go and look, but the shards are right there. What?
## What this script does is kick ES to make it actually take a look.
## For some reason telling ES to move the shard makes it realize it does in fact exist. Don't ask me, man.
##
set -eo pipefail
@akatrevorjay
akatrevorjay / refind.conf
Last active Dec 10, 2017
vga switcheroo wrapper and such for macbook pro 10+ efi booting (intel + amd) I've ended up with over the years
View refind.conf
#
# refind.conf
# Configuration file for the rEFInd boot menu
#
# Timeout in seconds for the main menu screen. Setting the timeout to 0
# disables automatic booting (i.e., no timeout). Setting it to -1 causes
# an immediate boot to the default OS *UNLESS* a keypress is in the buffer
# when rEFInd launches, in which case that keypress is interpreted as a
# shortcut key. If no matching shortcut is found, rEFInd displays its
@akatrevorjay
akatrevorjay / pretty.py
Last active Oct 12, 2017
A pprint that doesn't suck
View pretty.py
import six
import sys
import pygments
from pprint import pformat
STYLE = pygments.styles.get_style_by_name('monokai')
FORMATTER = pygments.formatters.get_formatter_by_name('console16m', style=STYLE)
LEXER_PYTHON = pygments.lexers.get_lexer_by_name('python{}'.format(six.PY3 and '3' or ''))
@akatrevorjay
akatrevorjay / thespian-raft.py
Created Jun 23, 2017 — forked from rcarmo/thespian-raft.py
The Raft leader election protocol, implemented atop GoDaddy's Thespian actor library
View thespian-raft.py
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):
@akatrevorjay
akatrevorjay / ini2env.py
Last active Jun 9, 2017
Convert ini to env file
View ini2env.py
#!/usr/bin/env python
from __future__ import print_function, absolute_import
import itertools
import logging
import logging.config
import sys
import argparse
import io
View check-url
#!/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 / loc
Last active Oct 20, 2019
loc: mlocate + fzf integration
View loc
#!/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
You can’t perform that action at this time.