Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nick Brady nick-brady

🎯
Focusing
View GitHub Profile
@tribals
tribals / Pipfile
Last active Sep 8, 2020
Understanding SQL row locking - `SELECT FOR UPDATE`
View Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
SQLAlchemy = "*"
"psycopg2-binary" = "*"
[dev-packages]
@libertyy
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
#!/bin/bash
# git-cleanup-repo
#
# Author: Rob Miller <rob@bigfish.co.uk>
# Adapted from the original by Yorick Sijsling
CLEANUP_REMOTE=${CLEANUP_REMOTE:-'no'}
git checkout master &> /dev/null
@keeth
keeth / 00-packages.config
Last active Aug 3, 2020
Django, Postgres 9.6 and Celery on Elastic Beanstalk - ebextensions
View 00-packages.config
packages:
yum:
libjpeg-turbo-devel: []
libpng-devel: []
libcurl-devel: []
commands:
01_install_rhel_pg:
command: "(yum repolist |grep -q pgdg96) || sudo yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-ami201503-96-9.6-2.noarch.rpm -y"
02_install_pg_devel:
@mcfdn
mcfdn / Multiple Deploy Keys in GitHub.md
Last active Feb 16, 2020
Using multiple GitHub deploy keys on a single server with a single user
View Multiple Deploy Keys in GitHub.md

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
nrollr / MySQL_macOS_Sierra.md
Last active Sep 22, 2020
Install MySQL on Sierra using Homebrew
View MySQL_macOS_Sierra.md

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 https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 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
htp / curl-websocket.sh
Last active Sep 29, 2020
Test a WebSocket using curl.
View curl-websocket.sh
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@khalilovcmd
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 = "https://raw.githubusercontent.com/lodash/lodash/3.10.1/lodash.min.js";
el.type = "text/javascript";
document.head.appendChild(el)
@gubatron
gubatron / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md
Last active Sep 25, 2020
How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent
View multiple-deploy-keys-multiple-private-repos-github-ssh-config.md

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 github.com user, with 2 or more private repositories repoN. For this example we'll work with just two repositories named repo1 and repo2

https://github.com/alice/repo1

https://github.com/alice/repo2

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

@gitaarik
gitaarik / git_submodules.md
Last active Sep 19, 2020
Git Submodules basic explanation
View git_submodules.md

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
dideler / pyargs.md
Last active May 17, 2020
Parsing Command-Line Argument in Python
View pyargs.md

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.