Skip to content

Instantly share code, notes, and snippets.


Nick Brady nick-brady

View GitHub Profile
tribals / Pipfile
Last active Sep 8, 2020
Understanding SQL row locking - `SELECT FOR UPDATE`
View Pipfile
url = ""
verify_ssl = true
name = "pypi"
SQLAlchemy = "*"
"psycopg2-binary" = "*"
libertyy / git-cleanup-repo
Last active Jan 10, 2018 — forked from robmiller/git-cleanup-repo
A script for cleaning up Git repositories; it deletes branches that are fully merged into `origin/master`, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
View git-cleanup-repo
# git-cleanup-repo
# Author: Rob Miller <>
# Adapted from the original by Yorick Sijsling
git checkout master &> /dev/null
keeth / 00-packages.config
Last active Aug 3, 2020
Django, Postgres 9.6 and Celery on Elastic Beanstalk - ebextensions
View 00-packages.config
libjpeg-turbo-devel: []
libpng-devel: []
libcurl-devel: []
command: "(yum repolist |grep -q pgdg96) || sudo yum install -y"
mcfdn / Multiple Deploy Keys in
Last active Feb 16, 2020
Using multiple GitHub deploy keys on a single server with a single user
View Multiple Deploy Keys in

Using multiple GitHub deploy keys on a single server with a single user

Within GitHub it is possible to set up two types of SSH key - account level SSH keys and and repository level SSH keys. These repository level SSH keys are known in GitHub as deploy keys.

Deploy keys are useful for deploying code because they do not rely on an individual user account, which is susceptible to change, to “store” the server keys.

There is, however, an ‘issue’ with using deploy keys; each key across all repositories on GitHub must be unique. No one key can be used more than once. This becomes a problem when deploying to repositories to the same server with the same user. If you create two keys, the SSH client will not know which key to use when connecting to GitHub.

One solution is to use an SSH config file to define which key to use in which situation. This isn’t as easy as it seems.. you might try something like this:

nrollr /
Last active Sep 22, 2020
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

htp /
Last active Sep 29, 2020
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host:" \
--header "Origin:" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
khalilovcmd / lodashify.js
Created Dec 19, 2015
to import lodash into chrome dev tools console
View lodashify.js
var el = document.createElement('script');
el.src = "";
el.type = "text/javascript";
gubatron /
Last active Sep 25, 2020
How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

Let's say alice is a user, with 2 or more private repositories repoN. For this example we'll work with just two repositories named repo1 and repo2

You need to be to pull from these repositories without entering a passwords probably on a server, or on multiple servers.

gitaarik /
Last active Sep 19, 2020
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
dideler /
Last active May 17, 2020
Parsing Command-Line Argument in Python

Command-line arguments in Python show up in sys.argv as a list of strings (so you'll need to import the sys module).

For example, if you want to print all passed command-line arguments:

import sys
print(sys.argv)  # Note the first argument is always the script filename.

Command-line options are sometimes passed by position (e.g. myprogram foo bar) and sometimes by using a "-name value" pair (e.g. myprogram -a foo -b bar).

You can’t perform that action at this time.