Skip to content

Instantly share code, notes, and snippets.

View spyoungtech's full-sized avatar

Spencer Phillip Young spyoungtech

View GitHub Profile
"""Contains the User, Category, and Recipe classes"""
from types import SimpleNamespace
class DB(dict):
def query(self, **query_params):
results = []
for key, obj in self.items():
if all(getattr(obj, attr) == value for attr, value in query_params.items()):
@spyoungtech
spyoungtech / simple_mjpeg_streamer_http_server
Created May 11, 2017 07:28 — forked from n3wtron/simple_mjpeg_streamer_http_server
Simple Python Motion Jpeg (mjpeg server) from webcam. Using: OpenCV,BaseHTTPServer
#!/usr/bin/python
'''
Author: Igor Maculan - n3wtron@gmail.com
A Simple mjpg stream http server
'''
import cv2
import Image
import threading
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from SocketServer import ThreadingMixIn
@spyoungtech
spyoungtech / connectfour.py
Last active March 13, 2017 03:38
Connect-Four
from itertools import cycle
class Player(object):
def __init__(self, token, name):
self.token = token
self.name = name
class ConnectFour(object):
@spyoungtech
spyoungtech / data_dict.py
Created March 1, 2017 02:12
example api response
data = {'forecast': {'simpleforecast': {'forecastday': [{'avehumidity': 87,
'avewind': {'degrees': 161,
'dir': 'SSE',
'kph': 5,
'mph': 3},
'conditions': 'Clear',
'date': {'ampm': 'PM',
'day': 28,
'epoch': '1488326400',
'hour': 19,
@spyoungtech
spyoungtech / awsexample.py
Last active February 27, 2017 21:39
awsexample.py
from __future__ import print_function
import boto3
import json
print('Loading function')
def respond(err, res=None):
return {
from fuzzywuzzy import process
import keyboard
import speech_recognition as sr
r = sr.Recognizer()
m = sr.Microphone()
commands = {
"deploy landing gear": lambda: keyboard.write("l"),
"retract landing gear": lambda: keyboard.write("l"),
from selenium.webdriver.common.keys import Keys
import time
from browsermobproxy import Server
import ast
import urllib2 as UR
import os
import eyed3 as ED3
from django.utils.encoding import force_text
import re
from selenium import webdriver