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 | |
# trap exit signals 2, 1, 15 | |
trap "exit" SIGINT SIGHUP SIGTERM | |
cat << 'DESCRIPTION' >/dev/null | |
USAGE: | |
backup.sh [SRC] [DEST] [EXT] [TLD] [SUB_DIR] [LOG_PATH] |
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 | |
# shellcheck disable=SC2120 | |
# exit on signals: 2, 1, 15 | |
trap 'exit' SIGINT SIGHUP SIGTERM | |
# $USER | |
[[ -n $(logname >/dev/null 2>&1) ]] && logged_in_user=$(logname) || logged_in_user=$(whoami) |
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 | |
# shellcheck disable=SC1091,SC2317 | |
# shift shim behind real binary | |
export PATH="/usr/local/bin/:${PATH}" | |
# env vars | |
git_root="$(git rev-parse --show-toplevel 2>/dev/null)" | |
script_dir=$(dirname "$(readlink -f "$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
# syntax=docker/dockerfile:1.7 | |
FROM ubuntu:20.04 | |
ARG PYTHON_VERSION="3.11" | |
ENV TZ=US/Chicago | |
ARG DEBIAN_FRONTEND=noninteractive | |
RUN <<EOF | |
#!/usr/bin/env bash |
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 python | |
import sys | |
import signal | |
timeout = 5 # Timeout in seconds | |
def handle_timeout(signum, frame): | |
raise TimeoutError("Input timed out!") |
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
... | |
@log_call | |
def file_exists(filename): | |
"""Check if a file exists.""" | |
fn = Path.cwd() / filename | |
if fn.exists(): | |
overwrite = input(f"File '{filename}' already exists. Do you want to overwrite it? (y/n): ") | |
match overwrite.lower(): | |
case "y" | "yes": | |
fn.touch(exist_ok=True) |
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 python | |
import os | |
from geopy.geocoders import Nominatim | |
from pprint import pprint | |
app = Nominatim(user_agent="tutorial") | |
if len(os.sys.argv) > 1: | |
your_loc = os.sys.argv[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
# https://learn.microsoft.com/en-us/windows/wsl/wsl-config#example-wslconf-file | |
# Per-distro settings go in /etc/wsl.conf | |
# $env:userprofile\.wslconfig | |
# WSL2-specific options | |
[wsl2] | |
processors = 4 # Makes the WSL 2 VM use two virtual processors | |
memory = 8GB # Limits VM memory in WSL 2 | |
swap = 0 # Do not use swap file | |
localhostforwarding=true # bind WSL 2 localhost to Windows localhost |
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
# kind create cluster --config kind-config.yaml | |
--- | |
kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
networking: | |
# Set the API server address to be accessible from the LAN | |
apiServerAddress: "192.168.25.196" | |
apiServerPort: 6443 | |
disableDefaultCNI: true | |
nodes: |
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 python | |
import markdown | |
import resend | |
from decouple import config | |
# from pathlib import Path | |
# env vars | |
resend_api_key = config("RESEND_API_KEY") | |
resend_from = config("RESEND_FROM", default="Acme <[email protected]>") |