This file contains hidden or 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
function tl() { | |
tldr --list | awk -v RS=', |\n' '/^[^\s]/ { print }' \ | |
| fzf --preview 'tldr {}' --query "$1" \ | |
| xargs -I{} tldr '{}' | |
} |
This file contains hidden or 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
(make-network-process :name "rmacs" | |
:server t | |
:host 'local | |
:service 52699 | |
:filter #'(lambda (proc string) | |
(delete-process proc) | |
(raise-frame) | |
(let ((tramp-allow-unsafe-temporary-files t)) | |
(find-file (string-trim string))))) | |
;; (delete-process "rmacs") |
This file contains hidden or 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
#!/bin/bash | |
# kobocomic: Modifies CBR and CBZ files to be displayed correctly on Kobo devices | |
# Requires perl, rar, unrar, zip, unzip | |
if [ "$#" -lt 1 ]; then | |
echo Supply a CBZ, CBR, ZIP, or RAR file to modify. | |
exit | |
fi | |
if [ -d "tmp_kobocomic" ]; then |
This file contains hidden or 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
k get ingress -A --output json | jq ' | |
def pad(n): tostring | if length >= n then . else ([range(n-length) | "0"] | join("")) + . end; | |
.items | |
| sort_by(.metadata.namespace) | |
| map({ ns: .metadata.namespace, name: .spec.rules[].http.paths[].backend.service.name, host: .spec.rules[].host, path: .spec.rules[].http.paths[].path }) | |
| to_entries | |
| map({ name: [.value.ns, .value.name, .key | pad(2)] | join("-"), url: ["https://", .value.host, .value.path] | join("") }) | |
| map(select(.url | contains("*") | not)) | |
| unique_by(.url) | |
| sort_by(.name) |
This file contains hidden or 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
pixels.fill((0, 128, 0)) | |
pixels.show() | |
time.sleep(1.0) | |
pixels.fill((0, 255, 0)) | |
pixels.show() | |
time.sleep(0.05) | |
pixels.fill((0, 128, 0)) | |
pixels.show() |
This file contains hidden or 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
[[ "$(date '+%Y-%m-%d')" < "$(date '+%Y-%m-%d' -d "$(openssl s_client -connect localhost:465 2>/dev/null </dev/null | openssl x509 -noout -dates | awk -F= '/notAfter/ { print $2 " - 1 month" }')" )" ]] |
This file contains hidden or 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
(local fennel (require :fennel)) | |
(require :hs.ipc) | |
(let [coro (coroutine.create fennel.repl)] | |
(coroutine.resume coro {:readChunk (fn [] | |
(let [input (coroutine.yield)] | |
(.. input "\n"))) | |
:onValues (fn [xs] | |
(print (table.concat xs "\t"))) | |
:onError (fn [_ msg] |
This file contains hidden or 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
;; -- Coroutinize | |
(fn coroutinize [f ...] | |
"Coroutinize a function `f' allow to to call functions with a callback within its body naturally | |
via coroutine, eliminate the callback hell. | |
These function often need to be evaluated in main thread or where `coroutine.resume' is not | |
availabe (Hammerspoon). The functions should to be wraped within `(fn [resolve] (f ... resolve))' | |
and yielded.They will be evaluated (in main thread) and come back via `coroutine.yield' |
This file contains hidden or 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
for i in `seq 150 650`; do | |
convert -size 1016x200 -background white -fill black -font Libre-Barcode-39-Regular -pointsize 160 -gravity center caption:"*66250${i}*" -gravity south -extent 1016x260 -resize 1016x648\! "66250${i}.png" | |
done | |
convert *.png 0.pdf |
This file contains hidden or 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
sudo sed -i '' '2i\ | |
auth sufficient pam_tid.so | |
' /etc/pam.d/sudo |