Skip to content

Instantly share code, notes, and snippets.

View apotek's full-sized avatar

K Widholm apotek

View GitHub Profile
# Get a list of the top level keys in a yaml file suitable for shell loop
yq e '(. | keys)[]' example.yaml
# Example:
# for key in $(yq e '(. | keys)[]' example.yaml); do
# echo $key
# done
@apotek
apotek / find-elements-off-right-side.js
Created March 12, 2024 16:37 — forked from agarzola/find-elements-off-right-side.js
Find elements rendered off the right side of the viewport
// Copy the code below, paste it into the browser console, and press enter. It
// will return an array of elements rendered off the right side of the viewport.
Array.from(document.querySelectorAll('*')).reduce((results, element) => {
const rect = element.getBoundingClientRect();
if ((rect.width + rect.left) > window.innerWidth) results.push(element);
return results;
}, []);
@apotek
apotek / better-git-branch.sh
Created February 26, 2024 16:03 — forked from schacon/better-git-branch.sh
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@apotek
apotek / bbedit-json-pretty.sh
Created July 9, 2022 17:07
BBEdit Text Filter for JSON prettification
# Requires Python 3.
# Place this script in ~/Library/Application Support/BBEdit/Text Filters.
# If it doesn't show up in the "apply text filter" menu item, you may need to restart BBEdit.
#!/usr/bin/env python3
import sys, json
print(json.dumps(json.load(sys.stdin), indent=2))
@apotek
apotek / keybase.md
Last active July 26, 2019 20:02
keybase.io

Keybase proof

I hereby claim:

  • I am apotek on github.
  • I am apotek (https://keybase.io/apotek) on keybase.
  • I have a public key whose fingerprint is DDB3 ABBA 23D2 49C4 5C41 0183 A687 CE9C A421 022A

To claim this, I am signing this object:

@apotek
apotek / Setup GitHub issue labels script
Created February 5, 2016 21:37 — forked from adamreisnz/Setup GitHub issue labels script
A terminal script to setup GitHub issue labels for a project.
Setup GitHub issue labels script