View *scratch*.el
This file contains 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 "|"))) |
View zshrc.zsh
This file contains 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
export EDITOR=vim | |
export ZSH="$HOME/.oh-my-zsh" | |
ZSH_THEME="nicoulaj" | |
plugins=(asdf aws docker direnv fasd fzf git helm history jq kubectl macos) | |
source $ZSH/oh-my-zsh.sh | |
export FZF_DEFAULT_OPTS="--bind ctrl-k:kill-line,ctrl-b:preview-page-up,ctrl-f:preview-page-down" | |
export _FASD_BACKENDS="native spotlight" | |
export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools" |
View *new*.txt
This file contains 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 |
View *scratch*.el
This file contains 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))) |
View loki-pattern.txt
This file contains 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 {` |
View coroutinize.fnl
This file contains 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' |
View touchid.sh
This file contains 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 |
View for_blackbox.sh
This file contains 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) |
View *scratch*.sh
This file contains 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 |
View init.fnl
This file contains 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] |
NewerOlder