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
| def fmt_table(table, disable_column_headers=False) -> str: | |
| """ | |
| I would use tabulate but I don't want nonstandard imports | |
| """ | |
| table_output = "" | |
| # no row has more elements than the header row | |
| assert(all(len(row) <= len(table[0]) for row in table)) | |
| column_widths = [ 0 ] * len(table[0]) | |
| for row in table: | |
| for i,element in enumerate(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 | |
| import os | |
| import sys | |
| import glob | |
| import zipfile | |
| import tempfile | |
| from subprocess import check_output, CalledProcessError | |
| assert len(sys.argv) >= 3 | |
| grep_args = ' '.join(sys.argv[1:-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
| from collections import deque | |
| def round_up(x): | |
| return round(x + 0.4999999) | |
| def make_routh_table(coefs: list): | |
| num_columns = round_up(len(coefs)/2)+1 | |
| num_rows = num_columns*2 | |
| routh_table = [[0]*num_columns for x in range(num_rows)] | |
| i = 0 # column |
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
| #!/bin/bash | |
| # list .exe files in $1/* | |
| # if one of those directories contains nothing but another subdirectory, | |
| # then list .exe files in $1/dir/subdir | |
| function fail(){ | |
| echo $@ >&2 | |
| exit 1 | |
| } | |
| function list_exe(){ |
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
| import sys | |
| import socket | |
| import subprocess | |
| LOOKUPS = [ | |
| "unity.rc.umass.edu.", | |
| "ood.unity.rc.umass.edu.", | |
| "docs.unity.rc.umass.edu.", | |
| ] |
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 os | |
| import grp | |
| import sys | |
| import json | |
| import shutil | |
| import subprocess as subp | |
| from typing import List | |
| SINFO_CACHE_FILE_PATH="/modules/user-resources/cache/sinfo.json" |
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
| #!/bin/bash | |
| set -eo pipefail | |
| SETTING="mousewheel.default.delta_multiplier_y" | |
| CONFIG_FILE_PATH="/home/simon/.mozilla/firefox/shlbuz9i.default-esr/prefs.js" | |
| LOW="30" # comfortable with my macbook 2015 touchpad | |
| HIGH="101" # 100 is default, firefox deletes default values from the file | |
| firefox_found=$(pgrep -U "$(whoami)" -fx '(.*/)?firefox(-esr)?$' | uniq || true) |
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
| prettier_style_check: | |
| image: node:latest | |
| stage: test | |
| script: | |
| - npm install -g prettier | |
| - prettier --version | |
| - prettier . --check || { echo "did you run \`format.sh\`?"; exit 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
| #!/usr/bin/env python3 | |
| import sys | |
| import atexit | |
| import ldap3 | |
| __LDAP_USER = "" | |
| __LDAP_PASSWORD = "" | |
| __LOCKED_STR = b"LOCKED" | |
| __USERS = "ou=users,dc=unity,dc=rc,dc=umass,dc=edu" |
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
| #!/bin/sh | |
| prepend_path() { | |
| if [ -z "$1" ] || [ -z "$2" ]; then | |
| echo "usage: prepend_path <directory> <env.var>" | |
| echo "e.g. prepend_path ~/.local/bin PATH" | |
| echo "received: prepend_path $@" | |
| return 1 | |
| fi | |
| local dir="$1" | |
| local env_var="$2" |