This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import time | |
import datetime | |
UNO = '/dev/ttyACM0' | |
ser = serial.Serial(UNO, 115200) | |
repeatTime = 1000 # milliseconds | |
def writeData(value): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
I adapted the live plotting code from somewhere but I cannot remember where. | |
If you know where, I would be happy to add it to the comment here. | |
''' | |
''' | |
I adapted the live plotting code from somewhere but I cannot remember where. | |
If you know where, I would be happy to add it to the comment here. | |
''' | |
import threading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def humanize_bytes(bytes, precision=1): | |
# taken from http://code.activestate.com/recipes/577081-humanized-representation-of-a-number-of-bytes/ | |
abbrevs = ( | |
(1<<60L, 'EB'), | |
(1<<50L, 'PB'), | |
(1<<40L, 'TB'), | |
(1<<30L, 'GB'), | |
(1<<20L, 'MB'), | |
(1<<10L, 'kB'), | |
(1, 'bytes') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Hello master chef, and welcome to MeatTemp Version 1.0!") | |
print("Please type your name and press ENTER: ") | |
name = input() | |
print("Welcome,",name+"! Please select the number corresponding to the type of meat you will be working with and press ENTER: ") | |
print("1. Beef (Ground)") | |
print("2. Beef (Non-ground)") | |
print("3. Chicken") | |
print("4. Turkey") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def printIt(meatType, temp): | |
meatType = ' '.join(meatType) | |
print("I recommend cooking your {0} to an internal temperature of {1} degrees Fahrenheit.".format(meatType, temp)) | |
print("Thank you for using MeatTemp Version 1.0! Bon appetit!") | |
sys.exit() | |
while True: | |
print("Hello master chef, and welcome to MeatTemp Version 1.0!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
import time | |
def cache_or_get(fp, expiry=300, r=redis.Redis(db=5)): | |
''' | |
Input fp: file to cache or get | |
Input expiry: time to expire for file (default 300 seconds) | |
Input r: redis instance (default new instance with db set to 4) | |
Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
import time | |
import random | |
def load_file(fp, fpKey, r, expiry): | |
with open(fp, "rb") as f: | |
data = f.read() | |
p = r.pipeline() | |
p.set(fpKey, data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python2 | |
# Requests is much easier to use than urllib | |
import requests | |
# needed for sys.exit() | |
import sys | |
# Wrap it in a function you can, you might find a use for it later | |
# We're adding subreddit functionality, but still providing a default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup as bs | |
from pyquery import PyQuery as pq | |
from lxml.html import fromstring | |
import re | |
import requests | |
import time | |
def Timer(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/python | |
import serial | |
import time | |
import sys | |
extruderSetPoint = 345 | |
bedSetPoint = 6300 | |
ser = serial.Serial("/dev/ttyUSB0", 115200) |
OlderNewer