Skip to content

Instantly share code, notes, and snippets.

View kscottz's full-sized avatar
💭
🐀 🫡 🛠️

Katherine Scott kscottz

💭
🐀 🫡 🛠️
View GitHub Profile
@kscottz
kscottz / opencv_twitch.py
Created February 8, 2016 05:00
A hack to slurp up twitch streams and process them with opencv.
import cv2
import numpy as np
import time
import livestreamer
# use live streamer to figure out the stream info
streams = livestreamer.streams("http://www.twitch.tv/inostupid")
stream = streams['best']
# open our out file.
fname = "test.mpg"
@kscottz
kscottz / gopro.py
Created February 4, 2016 07:28
Trigger a gopro camera over wifi and automagically find and download the images or videos.
from goprohero import GoProHero
import urllib
import bs4
import time
def download_and_save(name,route="http://10.5.5.9:8080/videos/DCIM/100GOPRO/"):
grab = route+name
result = urllib.urlopen(grab)
if( result.code == 200 ):
with open(name,'wb') as fp:
import itertools as it
def make_cards(n,m=[0,100,200,300,400]):
values = [n+mm for mm in m]
cards = []
for card in it.permutations(values):
cards.append(list(card))
return cards
def run_alg(cards,alg):
import itertools as it
def make_cards(n,m=[0,100,200,300,400]):
values = [n+mm for mm in m]
cards = []
for card in it.permutations(values):
cards.append(list(card))
return cards
def run_alg(cards,alg):
import pkg_resources
import argparse
import os.path as osp
import csv
def get_pkg_license(pkgname):
"""
Given a package reference (as from requirements.txt),
return license listed in package metadata.
"""
tempoautomation@tempoautomation:~/Code$ ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: %paste
import tinyg as tg
tgm = tg.TGMode()
tgm.configure()
tgm.home()
tgm.execute("$$\r")
tgm.execute("G91\r")
tgm.execute("G0X100\r")
tgm.execute("G0X-100\r")
tempoautomation@MarkV:~/Code/tempo_ws/src/tinyg_node/scripts$ ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
def _parse_variable_tray(self,config):
# for a variable tray we allocate the rows
# at run time as needed
tl_x = config["points"]["tl"]["x"]
tl_y = config["points"]["tl"]["y"]
br_x = config["points"]["br"]["x"]
br_y = config["points"]["br"]["y"]
self.row_tl = [tl_x,tl_y]
self.row_br = [br_x,br_y]