golang text/template cheatsheet. converted from this google doc / reddit post
see also: Go by example
{{ define “template_name” }} {{ end }}
golang text/template cheatsheet. converted from this google doc / reddit post
see also: Go by example
{{ define “template_name” }} {{ end }}
# make sure you have `tac` [1] (if on on macOS) and `atuin` [2] installed, then drop the below in your ~/.zshrc | |
# | |
# [1]: https://unix.stackexchange.com/questions/114041/how-can-i-get-the-tac-command-on-os-x | |
# [2]: https://github.com/ellie/atuin | |
atuin-setup() { | |
! hash atuin && return | |
bindkey '^E' _atuin_search_widget | |
export ATUIN_NOBIND="true" |
GitLab recently decided to silently delete any repositories that hadn't been accessed in the last year. The announcement didn't go over well and they soon caved to public pressure and decided to instead back up inactive repos to object storage instead of unilaterally deleting them. I'm glad they reconsidered, but the experience left me with a bad taste in my mouth, so I decided to look into (relatively) low
j() { | |
[ $# -gt 0 ] && z "$*" && return | |
cd "$(z -l 2>&1 | fzf --height 40% --nth 2.. --reverse --inline-info +s --tac --query "${*##-* }" | sed 's/^[0-9,.]* *//')" | |
} |
'Static' builds of the following tools. Download the binary and run, no further installation necessary.
Best used by copying the downloaded file to your path. If downloading with a browser, right click and use 'Save Link As' and then choose 'keep' from w/in the download's dropdown to avoid security issues.
Example of how to 'install' bat
from the CLI (and bypass above browser issues):
# nikvdp: adapted from [1] to use rootfull docker and make homedir writeable | |
# [1]: https://github.com/lima-vm/lima/blob/master/examples/docker.yaml | |
# To make the linux docker socket accessible in macOS use this ssh command | |
# $ ssh -f -N -p 60006 -i ~/.lima/_config/user -o NoHostAuthenticationForLocalhost=yes -L $HOME/docker.sock:/var/run/docker.sock 127.0.0.1 | |
# $ export DOCKER_HOST=unix://$HOME/docker.sock | |
# $ docker ... | |
images: | |
# Hint: run `limactl prune` to invalidate the "current" cache |
rest=() | |
while [[ $# -ge 1 ]]; do | |
arg="$1" | |
shift | |
case "$arg" in | |
-f|--foo) | |
foo=true | |
;; | |
-p|--param-that-takes-an-arg) |
""" | |
A handy and cool recursive lambda (!) to safely get an item out of a deeply | |
nested list or iterable: | |
>>> unwrap = lambda x: unwrap(next(iter(x), None)) if '__iter__' in dir(x) and not isinstance(x, str) else x | |
>>> unwrap(2) | |
2 | |
>>> unwrap(["hi"]) | |
'hi' | |
>>> unwrap([[[[[[["ok ok, i get it"]]]]]]]) |
I hereby claim:
To claim this, I am signing this object:
diff --git a/.SRCINFO b/.SRCINFO | |
index 8266f23..be95f93 100644 | |
--- a/.SRCINFO | |
+++ b/.SRCINFO | |
@@ -1,16 +1,16 @@ | |
-# Generated by mksrcinfo v8 | |
-# Thu Dec 8 17:47:17 UTC 2016 | |
pkgbase = gitfs | |
pkgdesc = Version controlled file system | |
pkgver = 0.4.5.1 |