This file contains hidden or 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 decimal | |
import math | |
from decimal import Decimal | |
from fractions import Fraction | |
# In response to https://www.reddit.com/r/mildlyinteresting/comments/1hcb9ce/not_a_single_person_at_my_2000_student_high/ | |
# and, in particular, some sloppy math in https://www.reddit.com/r/mildlyinteresting/comments/1hcb9ce/comment/m1mzfgh/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button |
This file contains hidden or 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
module Main where | |
main :: IO () | |
main = do | |
mapM_ print xs where | |
xs = powerset [(1 :: Integer)..24] | |
powerset :: [a] -> [[a]] | |
powerset = pset [] where | |
pset :: [a] -> [a] -> [[a]] |
This file contains hidden or 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 | |
# This tool operates on CSV files as created (and read) by the FitCSVTool.jar | |
# tool included in the FIT SDK. Input is always read from stdin, and output is | |
# written to stdout. | |
# | |
# Example usage: | |
# java -jar FitCSVTool.jar -b original_activity.fit original_activity.csv | |
# ./fixfit.py detect <original_activity.csv | |
# ./fixfit.py strip --field=accumulated_power --field=avg_power --field=functional_threshold_power --field=max_power --field=normalized_power --field=power --field=power_zone_high_boundary --field=threshold_power --field=time_in_power_zone <original_activity.csv >fixed_activity.csv |
This file contains hidden or 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 | |
set -euo pipefail | |
function main() { | |
if [[ $# -ne 1 ]] ; then | |
echo "usage: $0 <router ip>" >&2 | |
exit 2 | |
fi | |
local router_ip="$1" |
This file contains hidden or 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
package main | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"io" | |
"sync" | |
) |
This file contains hidden or 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 __future__ import annotations | |
import argparse | |
import json | |
import sys | |
def main(): |
This file contains hidden or 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
let main = async (account, units) => { | |
const scrapeAccount = (accountWidget) => { | |
const accountId = accountWidget.id; | |
const accountName = accountWidget | |
.querySelector("span.c11n-accordion__heading") | |
.innerText.trim(); | |
const holdingsLinks = [ | |
...accountWidget.querySelectorAll( | |
`app-holdings tr[app-holdings-row] div.holdings-link` | |
), |
This file contains hidden or 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
let main = () => { | |
const datePattern = new RegExp(`(\\d{2})/(\\d{2})/(\\d{4})`); | |
const extractDate = (s) => { | |
const m = s.match(datePattern); | |
const month = m[1]; | |
const day = m[2]; | |
const year = m[3]; | |
return `${year}-${month}-${day}`; | |
}; | |
const extractLot = (row) => { |
This file contains hidden or 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 | |
# NOTE: This is intended to be used with dump-links.py: | |
# https://gist.github.com/bsidhom/c5c83a8d38f500db4be397926cae8d02 | |
import argparse | |
import base64 | |
import json | |
import os | |
import os.path |
This file contains hidden or 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 | |
# Dump all symlinks and their targets under a given direcory in a | |
# newline-separated JSON format. This JSON data includes both the raw path data | |
# encoded as base64 as well as human-readable strings. The strings should not be | |
# used for automated FS operations, as they may have lost information in | |
# encoding. Instead, these should be used as approximate representations for | |
# hand inspection. | |
# This script does _not_ follow any symlinks when searching for links themselves |
NewerOlder