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
""" | |
intended to be used with git bisect: | |
git bisect start "5.10.1" "5.0.0" | |
git bisect run python ../isort_check.py | |
""" | |
import subprocess | |
import sys | |
from pathlib import Path | |
from tempfile import TemporaryDirectory |
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/env python | |
""" | |
https://twitter.com/dave_universetf/status/1342688553264762880 | |
""" | |
import sys | |
from typing import List | |
def split_by_dots(dotted_quad: str) -> List[int]: | |
"turns '1.2.3.4' into [1,2,3,4]" |
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/sh | |
set -eu | |
HOME=/home/ubuntu | |
MYSQL_ROOT_USERNAME="${MYSQL_ROOT_USERNAME:-"root"}" | |
MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD:-"root_password"}" | |
WORDPRESS_DATABASE_NAME="${WORDPRESS_DATABASE_NAME:-"wordpress"}" | |
WORDPRESS_DB_USERNAME="${WORDPRESS_DB_USERNAME:-"wordpress_user"}" | |
WORDPRESS_DB_PASSWORD="${WORDPRESS_DB_PASSWORD:-"wordpress_password"}" | |
log() { |
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
""" | |
if only I knew javascript | |
""" | |
import itertools | |
import string | |
import sys | |
from typing import List, NamedTuple, Union | |
ASCII = set(string.ascii_lowercase) | |
ESCAPE = "\u001b" |
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
_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 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 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 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 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 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() |
NewerOlder