Skip to content

Instantly share code, notes, and snippets.

View wren's full-sized avatar

Jonathan Wren wren

  • Seattle, WA
  • 12:19 (UTC -12:00)
View GitHub Profile
@wren
wren / borg-wrapper.sh
Last active December 5, 2022 00:37
Simple wrapper for borg to get config variables from a yaml file
#!/usr/bin/env zsh
# License: MIT (https://opensource.org/licenses/MIT)
# Copyright © 2022 Jonathan Wren <jonathan@nowandwren.com>
# https://gist.github.com/wren/e6e2fb695ce4b1b745405efbbbb93b93
#
# Wraps borg (borgbackup), and uses yq to get config variables
# to pass to borg for easier use
#
# See bottom of file for configurable variables.
#
#!/usr/bin/env zsh
# License: MIT (https://opensource.org/licenses/MIT)
# Copyright © 2022 Jonathan Wren <jonathan@nowandwren.com>
# https://gist.github.com/wren/e45b2c49d7a08bb718c683ad986793da
#
# Generates and shows diffs for images in a terminal
# functions
function exif() {
exiftool "$1" -@ ~/.config/git/misc/exiftool-args
@wren
wren / vim-startuptime-test.sh
Last active February 10, 2022 09:30
Test vim startup time using hyperfine
#!/usr/bin/env zsh
# License: WTFPL (http://www.wtfpl.net/about/)
#
# Test vim startup time using hyperfine
hyperfine --warmup 5 \
-L cmd 'nvim,lvim' \
-L file ',init.lua' \
-L rc '--clean,,-i NONE' \
'{cmd} +qa {rc} {file}' \
@wren
wren / less-with-pipe
Last active November 13, 2022 00:36
less + bat + batpipe
#!/usr/bin/env zsh
# License: WTFPL (http://www.wtfpl.net/about/)
#
# less + bat + batpipe
if [[ -t 0 ]]; then
# normal usage
less -F ${@:-.}
else
# being piped to
@wren
wren / pretty-packer
Last active December 9, 2024 19:55
Packs and unpacks files and directories using zst (and tar as needed).
#!/usr/bin/env zsh
# License: MIT (https://opensource.org/licenses/MIT)
# Copyright © 2021-2022 Jonathan Wren <jonathan@nowandwren.com>
# https://gist.github.com/wren/c7a385e0b59c1f4cdeb0b81f099f1610
#
# Packs and unpacks files and directories using zst (and tar as needed).
set -e
set -u
set -o pipefail
@wren
wren / shell-script-template.sh
Created February 10, 2022 09:12
Template for shell scripts with a few functions I commonly use
#!/bin/bash
# License: MIT (https://opensource.org/licenses/MIT)
# Copyright © 2021 Jonathan Wren <jonathan@nowandwren.com>
# https://gist.github.com/wren/270babdcdc007d3186768986d3f3da81
#
# Template for shell scripts with a few functions I commonly use
set -e
usage_small() {
echo "title - description lorem ipsum dolor sit amet"
@wren
wren / run-backups
Last active February 26, 2022 08:31
Runs backups using Borg, and notifies on success/failure using healthchecks.io. Very configurable, and supports debug mode.
#!/usr/bin/env zsh
# License: MIT (https://opensource.org/licenses/MIT)
# Copyright © 2021 Jonathan Wren <jonathan@nowandwren.com>
# https://gist.github.com/wren/cad91379c42f02bbcaff5e5f6a74255a
#
# Runs backups using Borg, and notifies on success/failure using
# healthchecks.io. Very configurable, and supports debug mode.
#
# See bottom of file for configurable variables.
#
@wren
wren / git-branch-list
Last active July 7, 2024 18:38
Output a list of git branches in a nicely formatted, and colored table
#!/usr/bin/env zsh
# License: MIT (https://opensource.org/licenses/MIT)
# Copyright © 2022 Jonathan Wren <jonathan@nowandwren.com>
# https://gist.github.com/wren/87d82952f24d503c14888e0430a46b17
#
# Outputs a list of git branches in a nicely formatted, and colored table
# colors
color_local_branch=3
color_remote_branch=14
@wren
wren / google-calendar-user.css
Last active February 10, 2022 08:50
Custom user styling for Google Calendar to make text colors make sense.
.qqMC3e {
color: #fff !important;
}
.LKeQwe span {
color: rgb(186, 186, 186);
}
.UflSff span, .UflSff {
color: #78787A !important;