Skip to content

Instantly share code, notes, and snippets.

View Ralnoc's full-sized avatar

James T. Boylan Ralnoc

  • Grubhub
  • Chicago, IL
View GitHub Profile
@Ralnoc
Ralnoc / tornadosse.py
Created October 21, 2019 02:39 — forked from mivade/tornadosse.py
Tornado server-sent events
"""Demonstration of server-sent events with Tornado. To see the
stream, you can either point your browser to ``http://localhost:8080``
or use ``curl`` like so::
$ curl http://localhost:8080/events
"""
import signal
from tornado import web, gen
@Ralnoc
Ralnoc / helloevolve.py
Created February 21, 2017 14:26
helloevolve.py - a simple genetic algorithm in Python (Updated for Python 3)
"""
helloevolve.py implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
global variables. To change the "most fit" string, modify OPTIMAL. POP_SIZE
controls the size of each generation, and GENERATIONS is the amount of
generations that the simulation will loop through before returning the fittest
string.