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
K8S_VERSION_MINOR=1.29 | |
# Repos for cri-o | |
curl -fsSL https://pkgs.k8s.io/addons:/cri-o:/stable:/v${K8S_VERSION_MINOR}/deb/Release.key | | |
gpg --dearmor -o /etc/apt/keyrings/cri-o-apt-keyring.gpg | |
echo "deb [signed-by=/etc/apt/keyrings/cri-o-apt-keyring.gpg] https://pkgs.k8s.io/addons:/cri-o:/stable:/v${K8S_VERSION_MINOR}/deb/ /" | | |
tee /etc/apt/sources.list.d/cri-o.list | |
# Repo for Kubernetes tools/components | |
curl -fsSL https://pkgs.k8s.io/core:/stable:/v${K8S_VERSION_MINOR}/deb/Release.key | |
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
# 1. Find colored lines | |
# 2. Strip out useless lines | |
# 3. Strip empty "colored" lines | |
grep --color=never $'\x1b''\[[0-9;]*' \ | |
| grep -vE 'Terraform has been|Initializing |use this backend unless the backend configuration changes|commands will detect it and remind you to do so if necessary|Refreshing state...|Read complete after |Reading...| copy_backend_before_init |Terraform has compared your real infrastructure|No changes.' \ | |
| sed -E '/^'$'\x1b''\[0m'$'\x1b''\[32m/d' |
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
sudo dnf install -y VirtualBox-server | |
# Make a vhd | |
qemu-img create -f vpc test.vhd 8G | |
virt-format -a test.vhd --partition=gpt --filesystem=ntfs | |
echo 'write /readme.txt "readme"' | guestfish -a test.vhd -m /dev/sda1 | |
mkdir test | |
vboximg-mount --image $(pwd)/test.vhd --rw --root test | |
mkdir testfs |
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
docker run --rm --privileged --pid=host ubuntu:22.04 \ | |
nsenter -t 1 -m -u -n -i \ | |
sh -c "sed -i '/enable-admission-plugins/{/NamespaceAutoProvision/b; s/$/,NamespaceAutoProvision/}' /etc/kubernetes/manifests/kube-apiserver.yaml" |
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
python3 -c ' | |
import json | |
import sys | |
from urllib.parse import urlparse, parse_qs | |
print(json.dumps(parse_qs(urlparse(sys.argv[1]).query))) | |
' |
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
""" | |
See section about "Reading and writing cache files" for how this works | |
with QDirStat https://github.com/shundhammer/qdirstat/blob/master/README.md?plain=1#L848 | |
`borg list` should run without prompting for credentials. See borg docs for configuring | |
environment variables https://borgbackup.readthedocs.io/en/stable/quickstart.html#automating-backups | |
""" | |
import dataclasses | |
import datetime | |
import gzip |
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
def fix_truncated_json(err_json: str) -> str: | |
"""closes open delimiters so json is parseable""" | |
stack = [] | |
expect_literal = False | |
last_literal = [] | |
for i, c in enumerate(err_json): | |
if c == '"': | |
if i > 0 and err_json[i-1] == '\\': | |
continue | |
if stack[-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 python3 | |
""" | |
Use inotify to monitor the file count and size of a given directory. | |
There may be small race conditions that lead to count/size errors | |
so output should be considered a close estimate. | |
* Requires only Python 3 stdlib & Linux | |
""" |
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
from bs4 import BeautifulSoup | |
import pandas as pd | |
import requests | |
import re | |
import json | |
search_url = "https://leekduck.com/boxsales/" | |
headers = { | |
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0", |
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 requests | |
search_url = "https://leekduck.com/boxsales/" | |
headers = { | |
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0", | |
"Referer": "https://web.archive.org/web/*" | |
} | |
sparklines = requests.get( |
NewerOlder