Skip to content

Instantly share code, notes, and snippets.

View cherryblossom000's full-sized avatar

Lauren Yim cherryblossom000

View GitHub Profile
@cherryblossom000
cherryblossom000 / install.md
Last active August 16, 2024 14:14
Haskell installation instructions

Haskell Installation Instructions

If you are participating in the MAC Introduction to Haskell Workshop and want to install Haskell locally, follow these instructions to install Haskell to save time during the workshop. If you don’t want to install Haskell, there will also be an option to code online which does not require you to install anything.

TLDR

ghcup install hls --set

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!

@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 ^
[email protected] |
from-json
)
@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
❯ defaults read com.apple.touchbar.agent
{
    PresentationModeFnModes =     {
        appWithControlStrip = functionKeys;
    };
    PresentationModeGlobal = appWithControlStrip;
    PresentationModePerApp =     {
        "com.hnc.Discord" = functionKeys;
 "com.hnc.DiscordPTB" = functionKeys;
@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" [email protected] \
| fx .data Object.entries '.forEach(([subject, {grades: {currentScore}}]) => console.log(`${subject}: ${currentScore === null ? "--" : `${String(currentScore).padEnd(5, "0")}%`}`))' 2> /dev/null \
| column -t
#!/usr/bin/env zsh
xhs www.coronavirus.vic.gov.au/sdp-ckan resource_id==afb52611-6061-4a2b-9110-74c920bede77 limit==0 | fx .result.total
module Main where
import Control.Arrow ((&&&))
import Data.List (group, sort)
import Text.Printf (printf)
type EnchantmentLevel = Int
levelProbs :: [(EnchantmentLevel, Double)]
levelProbs = (head &&& (/total) . fromIntegral . length)
@cherryblossom000
cherryblossom000 / discord highlight.js theme.css
Last active August 20, 2023 10:16
Discord highlight.js theme
:root {
--saturation-factor: 1; /* this varies depending on the user’s settings */
--primary-dark-200: hsl(210, calc(var(--saturation-factor, 1) * 2.9%), 86.7%);
--primary-dark-500: hsl(217, calc(var(--saturation-factor, 1) * 7.6%), 33.5%);
--primary-dark-630: hsl(223, calc(var(--saturation-factor, 1) * 6.9%), 19.8%);
--primary-light-130: hsl(220, calc(var(--saturation-factor, 1) * 13%), 95.5%);
--primary-light-300: hsl(210, calc(var(--saturation-factor, 1) * 9.8%), 80%);
--primary-light-700: hsl(210, calc(var(--saturation-factor, 1) * 9.8%), 20%);
--primary-light-900: hsl(240, calc(var(--saturation-factor, 1) * 7.7%), 2.5%);
--white-500: hsl(0, calc(var(--saturation-factor, 1) * 0%), 100%);
@cherryblossom000
cherryblossom000 / Discord Colours.json
Last active May 15, 2022 21:41
As of 11 May 2021. Taken from the Discord source code
{
"PRIMARY_DARK_100": "#f6f6f7",
"PRIMARY_DARK_130": "#eff0f0",
"PRIMARY_DARK_160": "#e6e6e8",
"PRIMARY_DARK_200": "#dcddde",
"PRIMARY_DARK_230": "#d1d3d5",
"PRIMARY_DARK_260": "#c6c8ca",
"PRIMARY_DARK_300": "#b9bbbe",
"PRIMARY_DARK_330": "#a3a6aa",
"PRIMARY_DARK_360": "#8e9297",