This file contains 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 pretty_print(self, elem, level=0): | |
""" | |
Adds indentation to output of an ElementTree based on depth of element. Recursive. | |
""" | |
# Todo: Write to be compliant with a dictionary | |
i = "\r\n" + 2 * level * " " | |
for item in elem: | |
(attr, val) = item | |
if not type(val) is dict: | |
self.BeginBold() |
This file contains 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
# LED Control Aliases | |
alias led_green="echo -e -n '\x10' > /dev/ttyACM1" | |
alias led_dim="echo -e -n '\x20' > /dev/ttyACM1" | |
alias led_blue="echo -e -n '\x50' > /dev/ttyACM1" | |
alias led_off="echo -e -n '\x60' > /dev/ttyACM1" | |
alias led_red="echo -e -n '\x90' > /dev/ttyACM1" | |
alias led_bright="echo -e -n '\xA0' > /dev/ttyACM1" | |
alias led_smooth="echo -e -n '\xC8' > /dev/ttyACM1" | |
alias led_white="echo -e -n '\xD0' > /dev/ttyACM1" | |
alias led_fade="echo -e -n '\xD1' > /dev/ttyACM1" |
This file contains 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
ps -ef | awk '$1 ~ /sawyer/ { print }' |
This file contains 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
WEEKDAY_CODES = { | |
'U': 6, | |
'M': 0, | |
'T': 1, | |
'W': 2, | |
'R': 3, | |
'F': 4, | |
'S': 5 | |
} | |
This file contains 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 lxml import html | |
import requests | |
from collections import namedtuple | |
import json | |
def unique(list): | |
seen = set() | |
seen_add = seen.add | |
return [x for x in list if not (x in seen or seen_add(x))] |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#define DISPLAY_BUFFER_SIZE 5 | |
typedef struct FixedFloat | |
{ | |
int upper; | |
int lower; |
This file contains 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 time | |
from slackclient import SlackClient | |
import smartsheet | |
import re | |
from tkinter import * | |
# starterbot's ID as an environment variable | |
BOT_ID = os.environ.get("BOT_ID") |
This file contains 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): |
This file contains 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 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: |
OlderNewer