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
#!/usr/bin/env python3 | |
import sys | |
import logging | |
def main(): | |
fname = sys.argv[1] | |
with open(fname) as f: | |
blob = f.read() | |
pairs = blob.split(',') |
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
cache.html | |
__pycache__/ | |
.ipynb_checkpoints/ |
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
#!/usr/bin/env python3 | |
"""Format a csv-styled 9x9 sudoku board. | |
Usage: `sudoku -g -fcsv | ./receipt-sudoku.py - > receipt.txt | |
""" | |
from typing import List | |
SudokuBoard = List[List[int]] | |
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
$0=10 (Step pulse time, microseconds) | |
$1=25 (Step idle delay, milliseconds) | |
$2=0 (Step pulse invert, mask) | |
$3=0 (Step direction invert, mask) | |
$4=0 (Invert step enable pin, boolean) | |
$5=1 (Invert limit pins, boolean) | |
$6=0 (Invert probe pin, boolean) | |
$10=1 (Status report options, mask) | |
$11=0.010 (Junction deviation, millimeters) | |
$12=0.002 (Arc tolerance, millimeters) |
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 serial | |
import time | |
DEVICE_PATH = '/dev/ttyACM0' | |
BAUD_RATE = 115200 | |
s = serial.Serial(DEVICE_PATH, BAUD_RATE) | |
while True: | |
if s.in_waiting > 0: # when new serial info is waiting |
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
#!/usr/bin/env python3 | |
"""Print a horizontal or vertical enumeration. | |
Need to figure out how many characters tall or wide something is in a pinch? | |
This is the commandline utility for you! | |
""" | |
import argparse | |
parser = argparse.ArgumentParser( | |
description='Print a horizontal or vertical enumeration.') |
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
#!/usr/bin/env python3 | |
"""Commandline script to center text horizontally.""" | |
import argparse | |
def center(line: str, width: int, length: int = None): | |
"""Center a line within a width, optionally treating it as len length. | |
>>> center('foo', 6) | |
' foo' |
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
#!/usr/bin/env python3 | |
import csv | |
with open('groups.csv', 'r') as csvfile: | |
reader = csv.DictReader(csvfile, ['full','acrnm','leader']) | |
names = [club['acrnm'] if club['acrnm'] != '' else club['full'] for club in reader] | |
[print(name) for name in names] |
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
#!/usr/bin/env python3 | |
"""Convert an abacus-style computation diagram into a plantUML diagram | |
https://regexr.com/3vj09 | |
""" | |
import argparse | |
import re | |
import warnings | |
parser = argparse.ArgumentParser(description='Generate PlantUML activity diagrams from FoCS abacus-style diagram lists.') |
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
/******************************************************************************* | |
* Step 0) Add a clear descriptive title block at the top of your robot code | |
* Example Title block follows: | |
* Title: 2018 Fun-Robo Simple Arduino Robot Controller (ENGR3390 Tutorial 4) | |
* Description: This structure template contains a SENSE-THINK-ACT data flow to | |
* allow a Robot to perform a sequence of meta-behaviors in soft-real-time based on direct | |
* text commands from a human operator. | |
* Robot Name?: ***add name here** Example; TutorialBot 1 | |
* What does code do?: ****give a short description of what code does*** Example; poll operator, | |
* carry out operator text input, loop indefinitely |
NewerOlder