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 / cee_lo.py
Last active November 11, 2020 20:03 — forked from anonymous/Cee-Lo
Cee Lo dice game
'''
Cee-lo is a gambling game played with three six-sided dice.
'''
from __future__ import print_function
import random
from collections import Counter
def input_float(msg):
'''

Allow incoming:

iptables -A INPUT  -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 0 -m state --state ESTABLISHED,RELATED -j ACCEPT

Allow outgoing:

iptables -A OUTPUT -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT  -p icmp --icmp-type 0 -m state --state ESTABLISHED,RELATED -j ACCEPT
@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.

@paul-schwendenman
paul-schwendenman / gpg.rst
Last active July 30, 2018 14:09
GPG Cheatsheet

GPG Cheat sheet

A small guide to little things

Create a key

@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 / snake.py
Created February 14, 2016 16:17 — forked from sanchitgangwar/snake.py
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)
@paul-schwendenman
paul-schwendenman / gunicorn
Last active February 19, 2018 19:42
Gunicorn setup
#!/bin/bash
# /etc/init.d/gunicorn
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
@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::