Skip to content

Instantly share code, notes, and snippets.

View acbart's full-sized avatar

Austin Cory Bart acbart

View GitHub Profile
@acbart
acbart / assignment_stats_table.js
Created October 4, 2023 15:11
Get all canvas assignment stats for a course in a nice table
(async function() {
function startDialog(title, body) {
if ($('#dialog').length == 0) {
$(document.body).append('<div title="' + title +
'" id="dialog"></div>');
}
$("#dialog").dialog({
autoOpen: false,
show: "blind",
@acbart
acbart / canvas_get_enrollments.js
Created August 23, 2023 15:15
Simple snippet for downloading the email/name/UDID/canvas id of students
(async function(){
// https://stackoverflow.com/questions/8735792/how-to-parse-link-header-from-github-api
let linkParser = (linkHeader)=>{
let re = /,[\s]*<(.*?)>;[\s]*rel="next"/g;
let result = re.exec(linkHeader);
if (result == null) {
return null;
}
return result[1];
@acbart
acbart / common_jupyter_header.py
Last active August 7, 2023 16:07
Common Jupyter Header
## Generally useful built libraries
import sys
import os
import json
import math
import re
import itertools
from collections import defaultdict
from dataclasses import dataclass
from datetime import timedelta, datetime
@acbart
acbart / hackathon_tech.md
Last active April 29, 2023 14:54
Dr. Bart's Hackathon Technology Suggestions

Hello hackers! Here are some suggestions for hacking during the Hackathon of cool things to try playing with.

For Python

Want to make something with Python? Here are some cool things you might try using:

Python in the Browser: Pyodide

Want to have Python running directly in the browser? You can use a new system called Pyodide! I found this guide that seemed like it would get you something basic going: https://testdriven.io/blog/build-spa-with-python-part-1/

@acbart
acbart / dataclasses_examples.py
Last active February 22, 2023 15:32
Dataclass examples of common data structures
from dataclasses import dataclass
@dataclass
class Teacher:
name: str
years_teaching: int
has_corgi: bool
courses: list[str]
me = Teacher("Dr. Bart", 6, True, ["CISC108", "CISC320"])
@acbart
acbart / assignment_stats.js
Created October 26, 2022 20:47
Assignment Stats
(async function() {
function startDialog(title, body) {
if ($('#dialog').length == 0) {
$(document.body).append('<div title="' + title +
'" id="dialog"></div>');
}
$("#dialog").dialog({
autoOpen: false,
show: "blind",
@acbart
acbart / evil_or_tree.py
Created September 11, 2022 02:45
Abusing the short-circuit of OR to allow recursive definitions
from dataclasses import dataclass
@dataclass
class Empty:
pass
@dataclass
class Tree:
value: int
left: Empty or Tree
@acbart
acbart / simple_tracing.py
Created September 6, 2022 14:28
Simple code, easy to trace
from bakery import assert_equal
name = "Captain"
def shorten(word: str) -> str:
return word[:3]
assert_equal(shorten(name), "Cap")
assert_equal(shorten("Babbage"), "Bab")
@acbart
acbart / heart.py
Created September 1, 2022 14:34
heart.py
# -*- coding: utf-8 -*-
"""
This program draws a heart using MatPlotLib.
You don't have to worry about how it does it, just
make sure that it runs. If it's successful, a heart
will appear in a new window.
"""
# Import graphing library
@acbart
acbart / trace_test.py
Created August 19, 2022 19:29
Trace a program, determine when a class vs function is being entered
import sys
import os
import builtins
build_class_orig = __build_class__
class Tracer:
def __init__(self, code, filename):
self.code = code
self.filename = filename