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 | |
| """ | |
| Download data from a Rigol DS1052E oscilloscope channel 1 and | |
| dump to a .wav file. | |
| By Ken Shirriff, http://righto.com/rigol | |
| Modified by Sawyer McLane 2/28/2019 | |
| """ | |
| import sys |
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 flatten(container): | |
| """ | |
| >>> list(flatten([1, 2, 3, [1, 2, 3, [5, 6], 8], 5, 6])) | |
| [1, 2, 3, 1, 2, 3, 5, 6, 8, 5, 6] | |
| """ | |
| for i in container: | |
| if isinstance(i, (list,tuple)): | |
| for j in flatten(i): | |
| yield j | |
| else: |
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
| aliceblue | |
| antiquewhite | |
| cyan | |
| aquamarine | |
| azure | |
| beige | |
| bisque | |
| black | |
| blanchedalmond | |
| blue |
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
| names: [ | |
| ["000000", "Black"], | |
| ["000080", "Navy Blue"], | |
| ["0000C8", "Dark Blue"], | |
| ["0000FF", "Blue"], | |
| ["000741", "Stratos"], | |
| ["001B1C", "Swamp"], | |
| ["002387", "Resolution Blue"], | |
| ["002900", "Deep Fir"], | |
| ["002E20", "Burnham"], |
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 os | |
| import pickle as cPickle | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import tensorflow as tf | |
| import mnist | |
| DATA_PATH = "./cifar-10-batches-py/" |
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
| img = PhotoImage() | |
| color_string = '' | |
| for y in range(img.height()): | |
| color_string += '{' | |
| for x in range(img.width()): | |
| color_string += GET_PIXEL_COLOR(x,y) + ' ' # GET_PIXEL_COLOR is whatever function you want to apply to the image | |
| color_string += '} ' | |
| img.put(color_string, (0, 0, img.height(), img.width())) |
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
| # -*- mode: python -*- | |
| import datetime | |
| bd = datetime.datetime.now().isoformat() | |
| auth = "Sawyer McLane" | |
| vers = "1.3.4" | |
| is_debug = False | |
| # Write version info into _constants.py resource file | |
| with open('_constants.py', 'w') as f: |
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
| class BulbIconList(Frame): | |
| def __init__(self, *args): | |
| self.window_width = 285 | |
| self.icon_width = 50 | |
| self.icon_height = 75 | |
| super().__init__(*args, width=self.window_width, height=self.icon_height) | |
| self.pad = 5 | |
| self.scrollx = 0 | |
| self.scrolly = 0 | |
| self.bulb_dict = {} |
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 truncate(f, n): | |
| '''Truncates/pads a float f to n decimal places without rounding''' | |
| s = '{}'.format(f) | |
| if 'e' in s or 'E' in s: | |
| return '{0:.{1}f}'.format(f, n) | |
| i, p, d = s.partition('.') | |
| return float('.'.join([i, (d+'0'*n)[:n]])) | |
| def truncate_args(digits): | |
| def decorator(func): |