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 | |
| set -eu | |
| setup() { | |
| GITHUB_WORKSPACE="$(mktemp -d)" | |
| DOWNLOADS="$(mktemp -d)" | |
| export GITHUB_WORKSPACE | |
| export DOWNLOADS | |
| eval "$(curl -fsSL 'https://api.github.com/repos/gohugoio/hugo/releases/latest' \ | |
| | jq --compact-output --raw-output '.assets | |
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 pathlib import Path | |
| from orjson import loads | |
| import re | |
| TRIM = 50 | |
| plover_dir = Path("~/.config/plover/").expanduser() | |
| dictionary = {} | |
| for path in plover_dir.glob("*.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
| import json | |
| import string | |
| from collections import Counter | |
| from datetime import datetime | |
| from pathlib import Path | |
| from typing import Dict, List | |
| PROGRESS_FILE = ( | |
| Path("~/.config/plover/typey-type_progress.json").expanduser().resolve(strict=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
| import re | |
| from pathlib import Path | |
| from itertools import islice | |
| from csv import DictWriter | |
| from collections import defaultdict | |
| def main(): | |
| results_path = Path("~/projects/time_python_string_concatenation_results.txt").expanduser().resolve(strict=True) | |
| parse_path = Path("~/projects/time_python_string_concatenation_parsed_results.txt").expanduser().resolve() | |
| parse_path.touch() |
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
| # Similar to `realpath -eq` | |
| realpath() { | |
| if [ "$#" -ne 1 ]; then | |
| return 1 | |
| elif ! OLD_CD="$(pwd -P)" > /dev/null 2>&1 ; then | |
| # This depends on `pwd -P` working, and if it's not, we can't proceed anyways | |
| return 1 | |
| elif [ -z "${1%%/*}" ]; then | |
| # Removing everything after the first / leaves nothing, so the path starts with /, and is absolute | |
| THE_PATH="$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
| #!/bin/sh | |
| set -eu | |
| A=0 | |
| IDENTIFIER="$(python3 -c 'print("a" * 100_000, end="")')" | |
| export IDENTIFIER | |
| echo "IDENTIFIER is ${#IDENTIFIER} characters" | |
| for python_version in python3.6 python3.7 python3.8 python3.9; do | |
| echo "${python_version}" |
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 | |
| set -eu | |
| leave() { | |
| if [ -n "${TMPDIR:+"set"}" ]; then | |
| sudo umount "${TMPDIR}" || true | |
| rm -rf "${TMPDIR}" | |
| unset -v TMPDIR || true | |
| fi | |
| } |
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 | |
| set -eu | |
| # # For testing in LXD, start user systemd daemon | |
| # USERNAME="$(id -nu)" | |
| # USER_ID="$(id -u)" | |
| # sudo loginctl --no-ask-password enable-linger "${USERNAME}" | |
| # sudo systemctl --no-ask-password restart "user@${USER_ID}.service" | |
| # | |
| # This was helpful for troubleshooting: |
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
| _hash = 0 | |
| class Falsey: | |
| def __init__(self, *args, **kwargs): pass | |
| # comparisons | |
| def __lt__(self, other): return False | |
| def __le__(self, other): return False | |
| def __eq__(self, other): return False | |
| def __ne__(self, other): return False |
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
| """ | |
| if only I knew javascript | |
| """ | |
| import itertools | |
| import string | |
| import sys | |
| from typing import List, NamedTuple, Union | |
| ASCII = set(string.ascii_lowercase) | |
| ESCAPE = "\u001b" |