Skip to content

Instantly share code, notes, and snippets.


Wil Koch wil3

View GitHub Profile
import os, argparse
import tensorflow as tf
This script converts a checkpoint to a pb file without needing to know
the names of the input and output nodes. This then allows you to use the
Tensorflow tool summarize_graph to identify potential input/output nodes.
wil3 /
Created Oct 16, 2018
Test of GymFC working with latest OpenAI baselines master branch
#!/usr/bin/env python3
import os
from baselines.common import tf_util as U
from baselines import logger
import gymfc
import argparse
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
This python script is meant to introduce you to parellel processing with
threads and processes. The example uses a simple worker than randomly selects
a letter and continually hashes this value. This demonstrates two methods for
creating a thread, (1) by specifying a target function or (2) inheriting
This lesson also shows that the Thread and Process API are (for the most part)
interchangable allowing us to simply replace threading.Thread with multiprocessing.Process
""" Demo creating a simple webserver and using a pub/sub design pattern
to have handlers for the request url to do work off the critcal path. This could
for example be used to process data analytics.
The publisher uses the callback to signal to the subscriber data has changed.
Conditions are used to ensure subscribers are not reading data while it is being
written. This allows the sublisher to wait (sleep) until the publisher wakes
them up to process an event. See docs for more information on Conditions,
wil3 /
Created Nov 10, 2017
Python 2 Producer/Consumer demonstration
Introduce producer/consumer model with thread safe queues
This demo can be first illustrated as an M/M/K queue in which we have incoming
messages at some rate added to a single queue, each consumer thread will
continually get and process items from the queue.
This is to demonstrate tradeoffs with the queue size, and number
import requests, time, sys, random, string
from urlparse import urlparse
from time import sleep
import argparse
#import subprocess
class MeasureBoot:
def __init__(self):
self.current_token = None
import gzip, os, shutil
import cStringIO
from optparse import OptionParser
Calculate the average entropy of files in the given directories
def entropy(f):
wil3 /
Created Apr 12, 2015
Genetic algorithm to evolve strings
#!/usr/bin/env python
__author__ = "William Koch"
import re
import sys
import random
import numpy
from deap import algorithms
from deap import base
from deap import creator
from deap import tools

Keybase proof

I hereby claim:

  • I am wil3 on github.
  • I am wilkoch ( on keybase.
  • I have a public key whose fingerprint is A13D 0086 FCEF 07F0 2B68 92EF 6AE1 45AF FEC0 1E3C

To claim this, I am signing this object:

wil3 /
Last active Aug 29, 2015
Send an email from your Gmail account using Python
#!/usr/bin/env python
"""Send an email with your Gmail account
import smtplib
__author__ = "William Koch"
class SendGmail: