Skip to content

Instantly share code, notes, and snippets.

View cherryblossom000's full-sized avatar

Lauren Yim cherryblossom000

View GitHub Profile
@cherryblossom000
cherryblossom000 / grades.sh
Last active January 6, 2022 09:52
Get grades from Canvas
#!/usr/bin/env bash
set -euo pipefail
# The GraphQL query could also be inlined instead of referencing the file, but
# I kept it in a separate file for syntax highlighting and stuff
xhs \
--check-status --ignore-stdin --timeout 2.5 \
example.instructure.com/api/graphql Authorization:"Bearer $CANVAS_TOKEN" query=@query.graphql \
| fx .data Object.entries '.forEach(([subject, {grades: {currentScore}}]) => console.log(`${subject}: ${currentScore === null ? "--" : `${String(currentScore).padEnd(5, "0")}%`}`))' 2> /dev/null \
| column -t
❯ defaults read com.apple.touchbar.agent
{
    PresentationModeFnModes =     {
        appWithControlStrip = functionKeys;
    };
    PresentationModeGlobal = appWithControlStrip;
    PresentationModePerApp =     {
        "com.hnc.Discord" = functionKeys;
 "com.hnc.DiscordPTB" = functionKeys;
@cherryblossom000
cherryblossom000 / install.zsh
Created December 12, 2021 06:39
Reinstalling Nix + nix-darwin + home-manager on macOS
# https://github.com/NixOS/nix/issues/3261
# sudo ln -sf /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
# https://discourse.nixos.org/t/nix-flake-and-fetcher-cache-v1-sqlite/8958
# (local u="$(whoami); sudo chown "$u:users" ~/.cache/nix)
# https://github.com/numtide/nix-unstable-installer
sh <(curl -L https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.5pre20211026_5667822/install) --daemon
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
@cherryblossom000
cherryblossom000 / grades.elv
Last active December 15, 2022 08:31
Get grades from Canvas — Elvish version
#!/usr/bin/env elvish
var result = (
xhs ^
--check-status --ignore-stdin --timeout 2.5 ^
example.instructure.com/api/graphql ^
Authorization:'Bearer '$E:CANVAS_TOKEN ^
query=@query.graphql |
from-json
)

Don’t like the

This document is intended for <student name> at <school> (user ID: <id>). Unauthorised circulation in any form is not permitted.

at the bottom of each page of an Edrolo PDF textbook?

Use this script!