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
#!/usr/bin/env zsh | |
# Purpose: Create a kubeconfig for a ServiceAccount with access to multiple namespaces | |
# and permission to list namespaces cluster-wide. | |
# Shell: Zsh (arrays are 1-indexed!) | |
set -euo pipefail | |
### ===================== | |
### Configurable variables | |
### ===================== |
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)) | |
(local pp fennel.view) | |
;; CAGS | |
(local mod-map {:a :ctrl :s :alt :d :cmd :f :shift | |
:j :rightshift :k :rightcmd :l :rightalt ";" :rightctrl}) | |
(local flags-map {:deviceLeftAlternate :alt | |
:deviceLeftCommand :cmd | |
:deviceLeftControl :ctrl |
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
const utcDate = new Date("2022-06-15T05:00:00Z"); | |
console.log("utcDate", utcDate, utcDate.toString()); | |
const utcDate2 = set(utcDate, { hours: 1 }); // Always set in curren time | |
console.log("utcDate2", utcDate2, utcDate2.toString()); | |
const zonedDate = utcToZonedTime(utcDate, "Asia/Jakarta"); // 5 + 7 = 12 in current timezone (pretend to be in local) | |
console.log("zoneDate", zonedDate, zonedDate.toString()); | |
const zonedDate2 = set(zonedDate, { hours: 1 }); |
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
# remote-random | |
cat *.json | jq -s -r 'sort_by(.country) | .[] | "remote \(.ip) 1193 # \(.country)-\(.city)"' | |
# remote | |
cat *.json | jq -s -r "sort_by(.country) | .[] | \"cat ~/.config/default.ovpn | sed 's/remote XXX/remote \(.ip) 1193 # \(.country)-\(.city)/' > '\(.country)-\(.city)-\(.ip).ovpn'\"" |
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
;; evaluate this to remove all IDs that are neither: a target, has attachment(s) nor timestamp (synced with caldav) | |
;; assume everything is in `~/org', including archived files | |
;; require `rg', `jq' and `awk' | |
(let* ((default-directory (expand-file-name "~/org")) | |
(ids (-> (shell-command-to-string | |
"rg -a -g '*.org*' --json '^:ID:\s*([A-Za-z00-9\-])+\s*$' | jq -r '.data.submatches | select(.) | .[].match.text' | awk '{ print $2 }' | sort") | |
(string-trim) | |
(split-string "\n"))) | |
(targets (-> (shell-command-to-string | |
(format "rg -a -g '*.org*' --json '\\[id:(%s)]' | jq -r '.data.submatches | select(.) | .[].match.text[4:-1]' | sort" (string-join ids "|"))) |
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
< Citations.jsonl | curl -vv -H 'Content-Type: application/octet-stream' http://127.0.0.1:5001/hatchi-mobile/us-central1/maintainance\?secret\=$SECRET\&action\=importCol\&col\=Citations\&withSubCollections\=1 --data-binary @- ; \ | |
< Concours.jsonl | curl -vv -H 'Content-Type: application/octet-stream' http://127.0.0.1:5001/hatchi-mobile/us-central1/maintainance\?secret\=$SECRET\&action\=importCol\&col\=Concours\&withSubCollections\=1 --data-binary @- ; \ | |
< Conseils.jsonl | curl -vv -H 'Content-Type: application/octet-stream' http://127.0.0.1:5001/hatchi-mobile/us-central1/maintainance\?secret\=$SECRET\&action\=importCol\&col\=Conseils\&withSubCollections\=1 --data-binary @- ; \ | |
< Devises.jsonl | curl -vv -H 'Content-Type: application/octet-stream' http://127.0.0.1:5001/hatchi-mobile/us-central1/maintainance\?secret\=$SECRET\&action\=importCol\&col\=Devises\&withSubCollections\=1 --data-binary @- ; \ | |
< Dictionnary_mot_interdit.jsonl | curl -vv -H 'Content-Type: application/octet-stream' http://127.0.0.1:5001/ha |
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
(defun merge-lists (&rest lists) | |
"Merge list, keep elements' order the same as where they are in the original lists. | |
E.g `(merge-list '(1 2) '(3 4 5))' should returns `(1 3 2 4 5)'." | |
(let ((copy (mapcar 'copy-sequence lists)) | |
(result)) | |
(while copy | |
(dolist (lst copy) | |
(when-let ((elt (pop lst))) ; pop doesn't change `lst' | |
(push elt result))) |
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
api.driver.cloud.private | |
api.driver.cloud.transalliance.eu | |
|~ "(?i)error" | |
|= `ms {` | |
| pattern `<ts> stdout F <method> <url> <code> <ms>ms {` |
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 |
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 |
NewerOlder