Skip to content

Instantly share code, notes, and snippets.

🖖
coffee

Damon Jablons blackrobot

🖖
coffee
Block or report user

Report or block blackrobot

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
@blackrobot
blackrobot / how-to-set-up-stress-free-ssl-on-os-x.md
Created Jan 31, 2018 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine
View how-to-set-up-stress-free-ssl-on-os-x.md

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

View findbar.css
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@keyframes scale-in {
0% {
transform: scaleY(0);
}
100% {
transform: scaleY(1);
}
}
@blackrobot
blackrobot / ensure-cert-macos.sh
Created Dec 7, 2017 — forked from koop/ensure-cert-macos.sh
Ensures a certificate is in the macOS system keychain.
View ensure-cert-macos.sh
#!/bin/bash
# Usage
# $ ./install-cert-macos.sh "/path/to/cert"
CERT_PATH="$1"
# First, grab the SHA-1 from the provided SSL cert.
CERT_SHA1=$(openssl x509 -in "$CERT_PATH" -sha1 -noout -fingerprint | cut -d "=" -f2 | sed "s/://g")
# Next, grab the SHA-1s of any standard.dev certs in the keychain.
# Don't return an error code if nothing is found.
@blackrobot
blackrobot / rsync_parallel.sh
Created Sep 27, 2017 — forked from rcoup/rsync_parallel.sh
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
View rsync_parallel.sh
#!/bin/bash
set -e
# Usage:
# rsync_parallel.sh [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes:
View useful_pandas_snippets.py
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
@blackrobot
blackrobot / Dockerfile
Last active May 5, 2016 — forked from ncherro/Dockerfile
Dockerfile
View Dockerfile
FROM ruby:2.2
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
nodejs \
libpq-dev \
libxml2-dev \
libxslt1-dev \
libqt4-webkit \
libqt4-dev \
View pedantically_commented_playbook.yml
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
View gunicorn-upstart.conf
# This runs gunicorn-django for example.com; to install:
# * sudo ln -s <this file> /etc/init/example_com
# * sudo initctl reload-configuration
# to use:
# * sudo start/stop/restart/reload/status example_com
description "example.com gunicorn instance"
start on runlevel [2345]
stop on runlevel [06]
View gist:2727166
garden = Garden.objects.get(slug='garden')
season = Season.objects.get(slug='summer')
###
garden.plants.filter(seasons_of_interest_includes=season.id) <<====
###
@blackrobot
blackrobot / eggnog.js
Created Oct 24, 2011 — forked from kayluhb/eggnog.js
eggnog code
View eggnog.js
var eggYolks = 12,
lbsSugar = 1,
cupsRum = 2,
cupsBourbon = 2,
quartsWhippingCream = 2,
eggWhites = 12,
nutmeg = "sprinkle";
var eggNog = [eggYolks, lbsSugar, cupsRum,
cupsBourbon, quartsWhippingCream,
You can’t perform that action at this time.