This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, re | |
# Assume space after 'switch' or 'match' | |
startre = re.compile(r"(\s*)(switch|match) ") | |
def switch_lengths(filename): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
if [[ $# -lt 1 ]]; then | |
echo "Usage: submit-tex.sh [hole] [options]" | |
echo "Example: ./submit-tex.sh ./src/fizz-buzz.tex" | |
echo "Requires directory setup where all .tex files are in ./src." | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, tty, termios | |
import subprocess | |
from fuzzywuzzy import fuzz | |
import re | |
import curses | |
from curses import wrapper | |
def getch(): | |
fd = sys.stdin.fileno() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
/* Dracula Base Colors */ | |
--dracula-background: #282a36 !important; | |
--dracula-current-line: #44475a !important; | |
--dracula-selection: #44475a !important; | |
--dracula-foreground: #f8f8f2 !important; | |
--dracula-comment: #6272a4 !important; | |
--dracula-cyan: #8be9fd !important; | |
--dracula-green: #50fa7b !important; | |
--dracula-orange: #ffb86c !important; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Expose topLevelComponents | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Expose Desmos's topLevelComponents as window._topLevelComponents. The global window._topLevelComponents is available after Desmos loads. Make sure to run at document-start. | |
// @author fireflame241 | |
// @match https://www.desmos.com/calculator | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=desmos.com | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lolps1() { | |
PREV_EXIT_CODE=$? | |
# PS1 rainbow modified from https://gist.github.com/duckythescientist/8338f028e018fd3fecae58e4f1c45def | |
# Replace $HOME with ~ | |
mypwd=${PWD/#$HOME/"~"} | |
# Make a persistent, incrementing seed to make a smooth rainbow effect from line to line | |
if [ -z ${LOLCAT_SEED+x} ]; then LOLCAT_SEED=1; else let "LOLCAT_SEED += 1"; fi | |
PS1=$(echo " $mypwd" | lolcat --force --freq 0.3 --seed $LOLCAT_SEED 2>/dev/null) | |
# Strip the "reset colors to normal" commands | |
PS1=$(echo "$PS1" | sed $'s/\033\[0m//g') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Switch audio device | |
# Based on https://askubuntu.com/a/1203350/647230 | |
declare -i next_sink_index=`pacmd list-sinks | sed -n -e 's/[[:space:]][[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'` | |
# Change the default sink | |
pacmd "set-default-sink ${next_sink_index}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function computeContext() { | |
// Emulate what happens in the web worker | |
const Context = require("core/math/context").Context; | |
const context = new Context(); | |
const changeSet = { | |
isCompleteState: true, | |
statements: {}, | |
}; | |
for (let stmt of Calc.controller.getAllItemModels()) { | |
if (stmt.type !== "expression") continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function download(url, filename) { | |
var a = document.createElement("a"); | |
a.href = url; | |
a.download = filename; | |
document.body.appendChild(a); | |
a.click(); | |
setTimeout(function () { | |
document.body.removeChild(a); | |
window.URL.revokeObjectURL(url); | |
}, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy.ntheory import factorint | |
from sympy.ntheory.factor_ import totient | |
import functools | |
import itertools | |
import networkx as nx | |
from collections import deque | |
# pygraphviz is optional; you can use command-line graphviz instead if you want | |
import pygraphviz as pgv | |
NewerOlder