Skip to content

Instantly share code, notes, and snippets.

View charlesreid1's full-sized avatar
💭
🍒 🍍 🍓 🍊 🍌

Chaz Reid charlesreid1

💭
🍒 🍍 🍓 🍊 🍌
View GitHub Profile
@charlesreid1
charlesreid1 / make_centillion_public.py
Last active March 4, 2019 16:46
Centillion Dead Person Switch: If this script is run for more than 72 hours continuously, it will make the dcppc/centillion repository public.
#!/usr/bin/env python
import re, os
from github import Github
import time
'''
Centillion Dead Person Switch
If this script is run for
more than 72 hours continuously,
@charlesreid1
charlesreid1 / process.py
Last active January 15, 2022 19:45
Example Jinja template for yaml config files
from jinja2 import Environment, PackageLoader, select_autoescape
def process(**kwargs):
# set up Jinja env
env = Environment(
loader=PackageLoader(''),
autoescape=select_autoescape(['html', 'xml'])
)
@charlesreid1
charlesreid1 / germlife.md
Last active February 6, 2019 07:07
The Story of Germ Life, Chapter 1 - Markdown format

THE STORY OF GERM LIFE: CHAPTER I: BACTERIA AS PLANTS

During the last fifteen years the subject of bacteriology has developed with a marvellous rapidity. At the beginning of the...

HISTORICAL.

The study of bacteria practically began with the use of the microscope. It was toward the close of the seventeenth century that...

Nothing of importance came from this work, however, partly because of the inadequacy of the microscopes of the day, and...

@charlesreid1
charlesreid1 / wraps.py
Last active February 6, 2019 02:33
Using functools @wraps
from functools import wraps
'''
This is a brief demo of how and why
functools @wraps is useful.
Basically, the decorator invisibly
swaps out one function with another
wrapper function. Unfortunately it
also invisibly swaps out the __name__
@charlesreid1
charlesreid1 / get_most_recent_backup.py
Last active February 4, 2019 05:34
Get the most recent backup file from an S3 bucket
#!/usr/bin/env python3
import argparse
import os
import sys
import datetime
import boto
from boto.s3.key import Key
"""
@charlesreid1
charlesreid1 / context_manager_examples.py
Last active January 31, 2019 05:35
Examples of Python context managers in action
import sys
from io import StringIO
"""
Python Context Managers: Some Examples
This file contains a few examples of ways you can
use context managers. These are minimal examples that
should generalize usefully in many situations.
Note: a context manager is opened like this:
@charlesreid1
charlesreid1 / decorators_examples.py
Last active October 23, 2019 15:43
Examples of Python decorators in action
import random
"""
Python Decorators: Some Examples
This file contains a few examples of ways you can
use decorators. These are minimal examples that
should generalize usefully in many situations.
Also see: https://wiki.python.org/moin/PythonDecoratorLibrary
@charlesreid1
charlesreid1 / gendoc.sh
Created January 1, 2019 23:13 — forked from kegsay/gendoc.sh
Generate static docs for a Go package
#!/bin/bash
set -u
DOC_DIR=godoc
PKG=github.com/matrix-org/go-neb
# Run a godoc server which we will scrape. Clobber the GOPATH to include
# only our dependencies.
GOPATH=$(pwd):$(pwd)/vendor godoc -http=localhost:6060 &
DOC_PID=$!
@charlesreid1
charlesreid1 / doit.sh
Created October 31, 2018 21:47
Make a gif file that zooms in to a static jpg/png image (powered by ImageMagick)
#!/bin/bash
# Panned and zoomed animation
# Mark Setchell
# https://stackoverflow.com/a/33467267
CONVERTME="full.jpg"
steps=60
# Final x offset from top left
finalx=2070
@charlesreid1
charlesreid1 / Resume.md
Last active December 25, 2018 06:32
Resume: Dr. Charles Reid