#!/bin/sh
## xref: https://www.reddit.com/r/MacOS/comments/jy5ry8/m1_macbook_air_keysshortcut_for_keyboard/ghryk3j/?utm_source=reddit&utm_medium=web2x&context=3
cat > ~/Library/LaunchAgents/com.local.KeyRemapping.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
View U2F_ssh_ecdsa.txt
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
# | |
# U2F SSH key generation and installation guide | |
# | |
# install U2F libraries on client machine | |
sudo apt-get install pamu2fcfg libpam-u2f | |
# | |
# Currently, there are only two ciphers that support | |
# 'special keys' or (sk) this is the notation in the |
View LICENSE
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
MIT License | |
Copyright (c) 2021 Daniel Ethridge | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
View asymptotic_progress_bar.py
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 | |
# asymptotic_progress_bar.py | |
# MIT License © 2021 | |
# | |
# A pretty non-blocking python progress bar timer that fills up asymptotically until you stop it. | |
# Good for when you don't know how long a task is going to take (up to some max timeout), | |
# but you want it to feel fast and accurate / not stuck the whole time. | |
# ████████████████████ 0.9% (1/60sec) | |
# | |
# Usage: |
View auto_timezone_from_browser.html
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
{% load tz %} | |
<html> | |
<head> | |
<script> | |
{% get_current_timezone as TIME_ZONE %} | |
window.TIME_ZONE = '{{TIME_ZONE}}' // timezone server thinks we're in | |
function setCookie(name, value, days) { | |
let expires = "" | |
if (days) { |
View test_stdin_stdout_stderr.py
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 | |
# Get all the information you could ever want about the STDIN, STDOUT, STDERR file descriptors (e.g. is it a TTY, terminal, pipe, redirection, etc.) | |
# Works cross-platform on Windows, macOS, Linux, in Docker, and in Docker-Compose by using stat library | |
# | |
# Useful for detecting and handling different stdin/stdout redirect scenarios in CLI scripts, | |
# e.g. is the user piping a file in or are they interactively typing things in? | |
# is the process output being saved to a file or being printed to a terminal? | |
# can we ask the user for input or is it a non-interactive masquerading as a TTY? | |
# | |
# Further reading: |
View key-remap.md
View compress_videos.sh
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 | |
# Requires: ffmpeg, exiftool (install via apt/brew first) | |
# Usage: | |
# $ cd ~/Videos | |
# $ ./compress_videos.sh | |
# [+] Converting all .mp4 files in ~/Videos to .x265.mp4 files... | |
# - √ GP013838.mp4 (2.5GB) -> GP013838.x265.mp4 (142MB) | |
# - √ ... | |
# [√] Done converting all .mp4 files in $PWD. |
View cloudflare_dns_secrets.fish
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 fish | |
# Script to store and retrieve config/secret key=value pairs in Cloudflare DNS records | |
# Encrypts secrets with a specified passphrase + salt using AES-256-CBC | |
# | |
# Usage: | |
# | |
# $ set_config some_config_key "example config value abc" | |
# $ get_config some_config_key | |
# example config value abc | |
# |
View docker-compose.yml
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
# Example database container setups for PostgreSQL, MariaDB, Redis, Memcached, MongoDB, Neo4j, Hasura GraphQL, CockroachDB, and TiDB in Docker Compose | |
# https://gist.github.com/pirate/1fafaa18a47254f388aa5c0f79f7d263 | |
# Goes well with these docker-compose networking/ingress container examples: | |
# https://gist.github.com/pirate/1996d3ed6c5872b1b7afded250772f7c | |
version: '2.4' | |
services: | |
postgres: |
NewerOlder