Skip to content

Instantly share code, notes, and snippets.

View paul-schwendenman's full-sized avatar

Paul Schwendenman paul-schwendenman

View GitHub Profile
@paul-schwendenman
paul-schwendenman / Dockerfile
Created February 27, 2022 21:59
Multistage Django Docker file
ARG PYTHON_VERSION=3.9.4-alpine3.13
FROM python:${PYTHON_VERSION} as builder
ENV PYTHONUNBUFFERED=1
WORKDIR /wheels
RUN apk add --update --no-cache \
alpine-sdk \
postgresql-dev
@paul-schwendenman
paul-schwendenman / run.sh
Last active July 8, 2021 02:00
MSM setup on Digitial Ocean
#!/usr/bin/env bash
# Install and setup the minecraft server
# Install java
apt install -qq -y openjdk-16-jdk-headless openjdk-16-jre-headless
# Create mountpoint
mkdir -p /mnt/volume_nyc1_02/msm
@paul-schwendenman
paul-schwendenman / pairings.py
Created April 14, 2018 16:53
Pairings generator
import itertools
import functools
import random
a = itertools.permutations(['David', 'Dicko', 'Matt', 'Paul', 'Ryan'], 5)
def swapper(x):
y = list(x)
@paul-schwendenman
paul-schwendenman / setup_trello_hooks.py
Created March 22, 2017 05:47
Manage Trello webhooks
'''
Script to manage Trello hooks
This script is used to manage Trello hooks. It has sub-commands to create, list
and delete webhooks. It uses two environment variables to authenticate with
Trello: TRELLO_TOKEN and TRELLO_KEY.
Tests:
To run the tests::
@paul-schwendenman
paul-schwendenman / messages.rst
Last active July 30, 2018 14:11
Git commits

My team uses a git commit message convention that helps us read fast and also is parsable by toolchains. We agree on a short list of leading active verbs:

Add

Create a capability e.g. feature, test, dependency.

Cut

Remove a capability e.g. feature, test, dependency.

Fix

Fix an issue e.g. bug, typo, accident, misstatement.

Bump

Increase the version of something e.g. dependency.

Make

Change the build process, or tooling, or infra.

Start

Begin doing something; e.g. create a feature flag.

Stop

End doing something; e.g. remove a feature flag.

Keybase proof

I hereby claim:

  • I am paul-schwendenman on github.
  • I am whatsdoom (https://keybase.io/whatsdoom) on keybase.
  • I have a public key whose fingerprint is BFD9 3334 D82A FFC3 E68F 436D 89E1 71A2 2A8E 8375

To claim this, I am signing this object:

@paul-schwendenman
paul-schwendenman / sed-replace.md
Created September 9, 2016 00:38
Sed Replace package.json

Directory structure:

$ tree
.
├── a
│   ├── a
│   │   ├── other.json
│   │   └── package.json
│   ├── other.json
│   └── package.json
#!/usr/bin/env python
import sys, time, os, urllib2, shelve, string, xmltramp, mimetools, mimetypes, md5, webbrowser
#
# uploadr.py
#
# Upload images placed within a directory to your Flickr account.
#
# Requires:
# xmltramp http://www.aaronsw.com/2002/xmltramp/
@paul-schwendenman
paul-schwendenman / snakes_and_ladders.py
Last active August 12, 2016 05:14 — forked from benhoyt/snakes_and_ladders.py
Calculate the average number of moves in a snakes and ladders game
"""Calculate the average number of moves in a snakes and ladders game.
Because as a parent one gets roped into these board (boring?) games
every so often, and I wanted to calculate the average duration of a
snakes and ladders game. Turns out it's about 36 moves for a
single-player game and 15 moves for a three-player game :-)
> python snakes_and_ladders.py
Played 10000 rounds, averaged 36.0559 moves, max 324 moves, took 0.508s
@paul-schwendenman
paul-schwendenman / dns.rst
Last active November 17, 2016 04:49
DNS servers

Google:

8.8.8.8
8.8.4.4

Microsoft:

209.18.47.61
209.18.47.62