Skip to content

Instantly share code, notes, and snippets.

View blackrobot's full-sized avatar
🖖
coffee

Damon Jablons blackrobot

🖖
coffee
View GitHub Profile
@blackrobot
blackrobot / eggnog.js
Created October 24, 2011 15:54 — forked from kayluhb/eggnog.js
eggnog code
var eggYolks = 12,
lbsSugar = 1,
cupsRum = 2,
cupsBourbon = 2,
quartsWhippingCream = 2,
eggWhites = 12,
nutmeg = "sprinkle";
var eggNog = [eggYolks, lbsSugar, cupsRum,
cupsBourbon, quartsWhippingCream,
garden = Garden.objects.get(slug='garden')
season = Season.objects.get(slug='summer')
###
garden.plants.filter(seasons_of_interest_includes=season.id) <<====
###
# 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]
---
# ^^^ 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.
@blackrobot
blackrobot / Dockerfile
Last active May 5, 2016 18:32 — forked from ncherro/Dockerfile
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 \
# 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 / rsync_parallel.sh
Created September 27, 2017 17:19 — forked from rcoup/rsync_parallel.sh
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
#!/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:
@blackrobot
blackrobot / ensure-cert-macos.sh
Created December 7, 2017 00:25 — forked from koop/ensure-cert-macos.sh
Ensures a certificate is in the macOS system keychain.
#!/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.
@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 / how-to-set-up-stress-free-ssl-on-os-x.md
Created January 31, 2018 01:03 — 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

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