Skip to content

Instantly share code, notes, and snippets.

View ElijahLynn's full-sized avatar
😎
All Your DevOps Belong To Us

Elijah Lynn ElijahLynn

😎
All Your DevOps Belong To Us
View GitHub Profile

How to format strings as code w/keyboard shortcuts in various tools:

Slack

  • inline - cmd + shift + c
  • block - cmd + shift + e
  • select any code block, triple click it

GitHub issues and comments - w/Refined GitHub Extension

  • inline - double click to highlight the string, then press ` to wrap in backticks
  • block - ??
@ElijahLynn
ElijahLynn / README.md
Last active November 13, 2025 22:06
GitHub notification spam remover script by bejamincburns
@ElijahLynn
ElijahLynn / fingerprint-sudo-mac.md
Last active September 15, 2025 23:00
fingerprint sudo on mac

TIL: For a consistent fingerprint auth experience on Mac, for both GUI and CLI, I learned that I can add this snippet to the top of /etc/pam.d/sudo:

auth       sufficient     pam_tid.so

and now everytime I get a password prompt, I instead get a fingerprint popup modal. Saves a ton of time if you have a longer password.

@ElijahLynn
ElijahLynn / gist:9443e3b34b462fa6a9f730542663fe90
Last active April 12, 2025 00:01
cli wrapper for docker
I want to create a boiler plate project to create CLI commands that wrap around docker. Then have all the scripting in a Docker image and the CLI program passes the args and any ENV vars for secrets (api access) to the docker run.
I am not easily finding anything like this, but this is a start:
https://andrewlock.net/packaging-cli-programs-into-docker-images-to-avoid-dependency-hell/
@ElijahLynn
ElijahLynn / gist:f3e3f5e5db0249cd7c787fe5f11f5a16
Last active April 9, 2025 22:18
How to set the zone for the gcloud cli tool
# sets the default zone for your gcloud CLI. It means it will apply to all your future gcloud commands coming from that same terminal.
gcloud config set compute/zone <zone>
# default value for this specific project only.
gcloud compute project-info add-metadata --metadata google-compute-default-zone=<zone>
# https://www.reddit.com/r/googlecloud/comments/brshdg/how_to_set_correctly_default_zoneregion_via_gcloud/
@ElijahLynn
ElijahLynn / known_hosts_remove_line.fish
Created April 8, 2025 18:27
fish functions known_hosts_remove_line
functions known_hosts_remove_line
# Defined via `source`
function known_hosts_remove_line
# get total number of lines in the known_hosts file
set total_lines (wc -l < ~/.ssh/known_hosts | tr -d ' ')
if test $argv[1] -gt $total_lines
echo "Line number $argv[1] exceeds total lines ($total_lines) in ~/.ssh/known_hosts"
return 1
end
sed -i '' "$argv[1]d" ~/.ssh/known_hosts
@ElijahLynn
ElijahLynn / gist:19bcc9bac35a343c9f3f07adba3ed4da
Created March 12, 2025 05:43
bash strict mode, with a good concise comment
# enable bash strict mode: exit on error (-e), undefined variables (-u), & pipe failures (-o pipefail)
set -euo pipefail
@ElijahLynn
ElijahLynn / gist:07ba9b3c178fdcf55b3849c5ac11c52f
Last active March 7, 2025 23:56
How to use Mac fingerprint auth for sudo password prompt
For a consistent fingerprint auth experience on Mac, for both GUI and CLI, I learned that I can add the below and everytime I would have gotten a password prompt, I now instead get a fingerprint popup modal. Saves a ton of time if you have a longer password.
/etc/pam.d/sudo Add this line to the TOP, bottom won't work.
```
auth sufficient pam_tid.so
````
@ElijahLynn
ElijahLynn / promtool-grafana-cloud-access-policy-token-auth.md
Last active March 4, 2025 17:40
How to auth to Grafana Cloud Prometheus using an Access Policy Token with promtool

The docs are here but don't specify this level of detail, I found this through trial/error: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_config

Also see, prometheus/prometheus#12924.

  1. Set your access policy up and create a token for it at https://grafana.com/orgs/{{ORG_NAME}}/access-policies
  2. Get your QUERY_ENDPOINT + INSTANCE_ID from https://grafana.com/orgs/{{ORG_NAME}}/members, then click your stack on the left, https://grafana.com/orgs/hedera/stacks/{{STACK_ID}}, then click Prometheus and scroll down to get your Instance ID (https://grafana.com/orgs/hedera/hosted-metrics/{{USERNAME/INSTANCE_ID}}
  3. Then create a file with the creds, e.g. .promtool-http-config.yml with the below format:
    authorization:
@ElijahLynn
ElijahLynn / bash-strict-mode.sh
Created February 7, 2025 00:37
bash strict mode oneliner with a good comment explaining the options
# enable bash strict mode: exit on error (-e), undefined variables (-u), & pipe failures (-o pipefail)
set -euo pipefail