These are scripts I use to serialize some of the practice exercises we get on multivariable calculus, statistics and physics 2 class, they are not meant to be easy to understand or a tutorial on how to write CAS programs on the HP Prime graphing calculator but rather a set of solutions I was able to come up with, for some a valuable resource nonetheless.
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 bash | |
# Returns an eval-safe representation of the bash function that when evaluated prints its name, | |
# useful when redefining functions | |
function_copy_rnd () { | |
local rand_prefix="$(head /dev/urandom | tr -dc A-Za-z | head -c 8)_" | |
local name="$1" | |
local decl; | |
decl="$(declare -f "$name")" || return $? | |
echo "${rand_prefix}${decl}; echo $(printf "%q" "${rand_prefix}${name}")" |
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 | |
from oscilloscope import parse_csv_export, ParsedCSV | |
import argparse | |
from io import TextIOWrapper | |
import matplotlib.pyplot as plt | |
def main(): | |
parser = argparse.ArgumentParser(description="Example plotter") | |
parser.add_argument("infile", type=argparse.FileType('r')) |
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 bash | |
run_on_ztncui () { | |
(source ~/containers/ztncui.sh && ztncui-compose exec -T ztncui bash -c "$1"); return $? | |
} | |
NETWORKS="$(run_on_ztncui 'curl -s -X GET --header "X-ZT1-Auth: $ZT_TOKEN" "$ZT_ADDR"/controller/network')" | |
for rules_file in ./rules/*.ztrules; do | |
nwid="$(python3 -c "import pathlib, sys; print(pathlib.Path(sys.argv[1]).stem)" "$rules_file")" && |
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 | |
from nbt.nbt import NBTFile | |
from nbt.chunk import McRegionChunk | |
from nbt.world import WorldFolder, AnvilWorldFolder, McRegionWorldFolder | |
from pathlib import Path | |
from pprint import pprint | |
from typing import List, Dict, Tuple, Optional, Generator, Iterable, Union, NamedTuple, DefaultDict, Any | |
from collections import defaultdict | |
from io import TextIOWrapper | |
import json |
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.8 | |
from sympy import Basic, Piecewise, Symbol, Eq, Mod, Heaviside, sympify, plot as splot | |
import numpy | |
from typing import Hashable, Tuple, Iterable, NamedTuple, Callable, Type | |
from matplotlib import pyplot as mplot | |
from sympy.physics.units.definitions import Hz | |
from sympy.physics.units.quantities import Quantity | |
from sympy.physics.units.prefixes import kilo |
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 | |
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" | |
# https://stackoverflow.com/a/26827443 | |
# shellcheck disable=SC2030,SC2034,SC2031 | |
split_output() { | |
local -n array="$1" || return $?; | |
# shellcheck disable=SC1090 | |
. <({ | |
err="$({ out="$("${@:2}")"; ret=$?; } 2>&1; |
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.8 | |
from typing import TypeVar, Iterator | |
""" | |
https://docs.python.org/3/library/stdtypes.html#iterator-types | |
This is considered broken by the iterator protocol, however I think | |
that what's considered broken is to continue to _yield values_, where | |
with this we emphasize the fact that if ``StopIteration`` is raised | |
once, the iterator _should not be used_ further. Those are two | |
different things. |
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
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Compile plugins", | |
"type": "shell", | |
"command": "${config:sourcepawnLanguageServer.sourcemod_home}/../spcomp64", | |
"args": [ |
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 typing import Iterator, Tuple, Dict, Any, Iterable, Union, cast | |
from sympy import plot as splot | |
from sympy.plotting.plot import Plot | |
from matplotlib import pyplot | |
from itertools import filterfalse | |
from more_itertools import unzip | |
import random | |
import colorsys | |
Curve = Tuple[Any, Dict[str, Any]] |