Skip to content

Instantly share code, notes, and snippets.

Roberto Aguilar rca

  • NYC
View GitHub Profile
rca /
Created Jan 27, 2020
Setting up Pyhon on a Mac

Installing Python3 on a Mac

Getting a sane Python3 runtime on a Mac can be tedious. The most painless way I have found thus far installing a Python3 package from and, from there, installing two additional packages into the system directory: pip and pipx.

Install Python

Install Python with a package from This post uses 3.6.8:

At this point, close the current shell and launch a new shell. This will ensure you have Python 3.6 in your PATH; you should see something similar to:

rca /
Last active Sep 26, 2019
An explanation of `git rebase --onto`

git rebase onto fu

Looking at the following git history, there are a few commits that were accidentally made on top of env/dev-auth that should be on a feature branch named experiments/sso-login-app (1. in the command below):

$ git log
commit feb0ee98c8b77e929b9cc23442c5664c9d4986c9 (HEAD -> env/dev-auth)  # this is `0.` in the command below
Author: Roberto Aguilar <>
Date:   Thu Sep 26 00:25:15 2019 -0400
rca / vault-env
Created Aug 29, 2019
Converts key/value pairs returned by a vault command into environment variables
View vault-env
#!/usr/bin/env python3.6
Converts key/value pairs returned by a vault command into environment variables
import json
import sys
'access_key': 'AWS_ACCESS_KEY_ID',
'secret_key': 'AWS_SECRET_ACCESS_KEY',
rca / flush_dns
Created Feb 5, 2019
Flushes local DNS cache on MacOS X
View flush_dns
set -e
sudo killall -HUP mDNSResponder
rca / rancher-exec
Created Jan 25, 2019
Execute a command within a container running in Rancher k8s
View rancher-exec
set -e
set -x
SCRIPT_NAME=$(basename $0)
if [ -z "$4" ]; then
echo "${SCRIPT_NAME} <env> <namespace> <pod name> <command> [args]" 1>&2
exit 1
View gist:07cb74c350d6be278249db6136faa7f7
class Foo:
def __init__(self, x=[]):
self.x = x
f = Foo()
rca / docker-service-ports
Created Mar 21, 2018
Script to list service ports and get next available port
View docker-service-ports
#!/usr/bin/env python3.6
import argparse
import logging
import re
import shlex
import sh
PORT_RE = re.compile(r':(?P<port>\d+)->')
rca / docker-networks
Last active Jul 13, 2018
Lists all docker networks sorted by their subnet address
View docker-networks
#!/usr/bin/env xonsh
import json
import re
import sys
from tabulate import tabulate
def sorted_alnum(l, key=None):
rca / git_whitespace
Created Feb 13, 2018
get rid of whitespace in your uncommitted work
View git_whitespace
#!/usr/bin/env python2.7
Ensure new lines added to git do not have whitespace
import os
import sys
import time
import traceback
from optparse import OptionParser
You can’t perform that action at this time.