Skip to content

Instantly share code, notes, and snippets.

View FluxCapacitor2's full-sized avatar

FluxCapacitor FluxCapacitor2

View GitHub Profile
@FluxCapacitor2
FluxCapacitor2 / print-friendly-webassign.css
Last active December 21, 2023 07:26
Print-friendly WebAssign user styles
@media print {
#js-student-header, #webAssignTop, form#wa, #assignmentWrapper, .js-question-header, .extraContent, #js-page-bottom, #js-assignment-take-footer, #js-student-footer, #js-assignment-header > div > div:nth-child(2) {
display: none;
}
#webAssignMain {
counter-reset: question;
}
.waQBox::before {
counter-increment: question;
content: "Question " counter(question);
@FluxCapacitor2
FluxCapacitor2 / remove-all-caches.sh
Created February 4, 2023 02:55
Remove all GitHub Actions caches for a repository
#!/bin/bash
# Requires the "gh" CLI
# https://cli.github.com/
# Install the GitHub Actions cache extension for the GitHub CLI
gh extension install actions/gh-actions-cache
# Purge the 100 oldest cache entries
# (running the script multiple times may cause a rate limit to be hit; this can be solved by waiting a few minutes)
gh actions-cache list -L 100 --sort last-used --order asc | awk '{print $1}' | xargs -d\\n -n1 gh actions-cache delete --confirm
@FluxCapacitor2
FluxCapacitor2 / LenientDoubleArraySerializer.kt
Created July 11, 2022 21:08
A serializer for kotlinx.serialization and KMongo that can accept either an int32 or a double and returns a double.
/**
* A serializer for kotlinx.serialization and KMongo that can accept either an int32 or a double and returns a double.
* Depends on KMongo or another MongoDB library that uses [kbson](https://github.com/jershell/kbson), because
* its FlexibleDecoder gives a hint of what the type is before the value is decoded.
* @author FluxCapacitor2
*/
object LenientDoubleArraySerializer : KSerializer<Array<Double>> {
val s = ListSerializer(LenientDoubleSerializer)