Skip to content

Instantly share code, notes, and snippets.

View Seagor's full-sized avatar

Sean Gorman Seagor

View GitHub Profile
import base64 as b64
import numpy as np
import cv2
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive, fixed
from IPython.display import Image, display
import ipywidgets as widgets
from itertools import tee, izip
WINDOW_SIZE = 41 # size of window to use when computing averages. Endpoint images outside
import base64 as b64
import numpy as np
import cv2
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive, fixed
from IPython.display import Image, display
import ipywidgets as widgets
def convert_media_to_image(media):
arr = np.asarray(bytearray(b64.b64decode(media["__data__"])), dtype=np.uint8)
%matplotlib inline
import matplotlib.pyplot as plt
from datetime import timedelta
from bson import ObjectId
import seaborn as sns
sns.set_style('whitegrid')
from itertools import cycle
cyclic_palette = cycle(sns.color_palette())
values = []
X = [ObjectId(oid).generation_time for oid, rec in data][:40]
@Seagor
Seagor / image_scraper.py
Last active April 7, 2016 02:30
A scraper for fetching images from a webcam
import gevent
import urllib2
image_url = "http://manage.hdrelay.com/snapshot/ee489921-1004-45df-9634-0fa96543dabf?size=710x425&f=30000"
polling_interval = "31"
def stream():
while True:
msg = {"media_url": image_url}
msg["polling_interval"] = float(polling_interval)
@Seagor
Seagor / index.html
Last active December 1, 2015 14:53
Twitter Data Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href=
"http://js.arcgis.com/3.14/esri/css/esri.css">
<link rel="stylesheet" type="text/css" href=
"https://rawgit.com/benheb/legend/master/legend.css">
@Seagor
Seagor / webmap.json
Created November 18, 2015 16:36
Census Blocks
{
"item": {
"title": "New Map",
"snippet": "Census Blocks",
"extent": [
[
-124.86249999996639,
-42.233197141816774
],
[
#!/bin/sh
"exec" "twxec" "-e" "rand_ints()" "$0" "$@"
import random
import gevent
def rand_ints():
while True:
value = random.randint({{number minval}}, {{number maxval}} + 1)