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 -S uv run | |
# /// script | |
# requires-python = ">=3.12" | |
# dependencies = [ | |
# "boto3", | |
# ] | |
# /// | |
"""UV Script Demo.""" |
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 | |
"""Open a file in a web browser.""" | |
import argparse | |
from pathlib import Path | |
from subprocess import check_call | |
def main() -> None: | |
"""Run main function.""" |
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 | |
"""Record terminal session to gif.""" | |
import argparse | |
import datetime | |
import shutil | |
from pathlib import Path | |
from subprocess import check_call | |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
"""Wait for a tcp network port to become open.""" | |
import argparse | |
import socket | |
import sys | |
import time | |
from argparse import Namespace | |
SLEEP_SECONDS = 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 bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
mapfile -t ids < <(mailq | grep -E '^[0-9A-F]' | awk '{print $1}') | |
for id in "${ids[@]}"; do | |
postcat -q "${id}" | less | |
echo "Remove? (y)" | |
read -r RM |
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 | |
curl -q http://169.254.169.254/latest/user-data |
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 | |
set -euo pipefail | |
IFS=$'\n\t' | |
# prune stale containers/images | |
docker image prune -f | |
# prune stale volumes | |
docker volume prune -f |
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 | |
set -euo pipefail | |
IFS=$'\n\t' | |
# get all my starred repos | |
getstars() { | |
query="query(\$endCursor: String) { | |
viewer { | |
starredRepositories(first: 100, after: \$endCursor) { |
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
# normal mtr with icmp | |
mtr $1 | |
# tcp | |
mtr -T -P 443 $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 bash | |
# install yawsso https://github.com/victorskl/yawsso | |
# make sure aws cli is installed | |
# call with `sso` | |
################################################################################ | |
# when calling these functions make sure AWS_PROFILE is set | |
################################################################################ |
NewerOlder