Skip to content

Instantly share code, notes, and snippets.

View robobenklein's full-sized avatar
:electron:
translating thoughts to code

Ben Klein robobenklein

:electron:
translating thoughts to code
View GitHub Profile
@robobenklein
robobenklein / canvasgrades.py
Created September 11, 2023 19:17
Canvas grades file Python context object
import csv
from pathlib import Path
class CanvasGradeFile():
def __init__(self, file: Path):
self.file = file
def __enter__(self):
with self.file.open('r') as f:
@robobenklein
robobenklein / watch-nice-changes.py
Last active June 7, 2022 05:11
Watch your PIDs for changes to the niceness after they've started.
import time
import psutil
nices = {}
while True:
time.sleep(0.2)
for proc in psutil.process_iter(['pid', 'cmdline', 'nice']):
try:
@robobenklein
robobenklein / gendat.zsh
Created October 29, 2020 17:49
CS462 dat file generator
#!/usr/bin/zsh
params="${1}"
typeset -i algo=${2}
typeset -i threads=${3}
{ [[ -z $params ]] || [[ -z ${2} ]] || (( algo < 0 || algo >= 10 )) } && {
echo "Please supply the <parameters file> <algorithm number> [thread count?]"
exit 1
}
import serial
import time
import fileinput
port = serial.Serial('/dev/ttyUSB0',19200,serial.EIGHTBITS,serial.PARITY_NONE,
serial.STOPBITS_ONE,timeout=5,rtscts = False)
def wr(m):
port.write(m)
@robobenklein
robobenklein / Makefile
Last active September 16, 2018 00:16
CS360 Makefile
# CS360 makefile
# original by robobenklein / bklein3@utk
# GPLv3 license
# contact me if this breaks for some reason,
# but it's not my fault if you delete your programs using this
# plug: join the UTKCS discord!
CC:=gcc
VARS_OLD := $(.VARIABLES)
@robobenklein
robobenklein / google-calendar-dark.user.js
Last active April 17, 2018 04:33
Hey look I can use the same tricks I used on Inbox in Google Calendar, cool.
// ==UserScript==
// @name Dark Google Calendar using chrome filters
// @include https://calendar.google.com/*
// @grant GM_addStyle
// @run-at document-start
// @version 2018.04.17
// @description Robobenklein found another Google Service needing a dark theme.
// ==/UserScript==
GM_addStyle ( `
@robobenklein
robobenklein / inbox-dark.user.js
Last active April 10, 2018 01:24
Dark theme for inbox, trying to be as simple as possible. Designed for Chrome & Violentmonkey.
// ==UserScript==
// @name Dark inbox using chrome filters
// @include https://inbox.google.com/*
// @grant GM_addStyle
// @run-at document-start
// @version 2018.04.09
// @description Robobenklein got tired of Google Inbox without a dark theme.
// ==/UserScript==
GM_addStyle ( `
@robobenklein
robobenklein / helpme.hpp
Created April 3, 2018 19:56
C++ debugging ostreams
// for cerr debugging, overloads for vector, list, set
template <class T>
std::ostream& operator<< (std::ostream& out, const std::vector<T>& v) {
if ( !v.empty() ) {
out << "vector[";
for (T item : v) {
out << item;
out << ", ";
}
out << "\b\b]";
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y git libboost-dev libboost-regex-dev curl wget python3 python-pip python3-pip
RUN wget https://wrighteagle2d.github.io/binaries/WrightEagle_stable_ubuntu_16.04.tar.gz
RUN mv WrightEagle_*.tar.gz wrighteagle.tar.gz
ENV TEAM_NAME wrighteagle-docker
@robobenklein
robobenklein / excerpt.ssh.config
Last active October 27, 2017 14:52
Who's on hydra?
Host hydra*
Hostname %h.eecs.utk.edu
User <netid>
ForwardX11 yes
forwardagent no