In the middle of the desert you can say anything you want
TIL from my wife in the context of checkbox detection! letters detection fourier transform – Google Suche
TL;DR you can use fourier transforms on letters, that then lead to differentiable results! Bright lines perpendicular to lines in the original letter etc.
python - How to have actual values in matplotlib Pie Chart displayed - Stack Overflow:
def absolute_value(val):
a = numpy.round(val/100.*sizes.sum(), 0)
return a
plt.pie(sizes, labels=labels, colors=colors,
autopct=absolute_value, shadow=True)
Can be also used to add more complex stuff inside the wedges (apparently the term for parts of the ‘pie’).
I did this:
def absolute_value(val):
a = int(np.round(val/100.*np.array(sizes).sum(), 0))
res = f"{a} ({val:.2f}%)"
return res
for this:
Based on feedback on a paper I wrote:
Stumbled upon zyedidia/micro: A modern and intuitive terminal-based text editor. Simple text editor that wants to be the successor of nano, CLI-based. The static .tar.gz contains an executable that can be directly run. Played with it for 30 seconds and it’s really neat**.
(Need something like vim for someone who doesn’t like vim, but wants to edit files on servers in an easy way in case nano isn’t installed and no sudo rights.)
There are online resources:
SO thread1 version:
diff <(jq --sort-keys . A.json) <(jq --sort-keys . B.json)
Wrapped it into a function in my .zshrc
:
jdiff() {
diff <(jq --sort-keys . "$1") <(jq --sort-keys . "$2")
}
vimdiff
is a thing and does this by default!
Otherwise2 diff has the parameters -y
, and --suppress-common-lines
is useful.
This led to jdiff
’s brother jdiffy
:
jdiffy() {
diff -y --suppress-common-lines <(jq --sort-keys . "$1") <(jq --sort-keys . "$2")
}
git diff --no-index
allows to use git diff without the thing needing to be inside a repo. Used it heavily previously for some of its fancier functions. Say hi to gdiff
:
gdiff() {
git diff --no-index "$1" "$2"
}
This is neat: xlsxgrep · PyPI
Supports many grep options.
Rancher
Two ways to run stuff
kubectl
Via yaml:
- name: podname
image: "docker/image"
command:
- /bin/sh
- -c
- while true; do echo $(date) >> /tmp/out; sleep 1; done
Kubernetes Workloads and Pods | Rancher Manager
Assigning Pods to Nodes | Kubernetes:
nodeName
is a simple direct way
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
nodeName: kube-01
TIL - when looking how to clean printer heads - that some printers can do it automatically! Can be started both through the OS GUI or the printer itself (if it has buttons and stuff).
Wikihow (lol) as the first result in Google gave me enough to learn about automatic cleaning being a thing: How to Clean Print Heads: Clogged & Dried Up Print Heads; How to Clean a Printhead for Better Ink Efficiency < Tech Takes - HP.com Singapore +
Was doing a graph-like stucture to easily explain a really complex decision tree that’s not really a tree, but I was really looking for an existing thing: A state machine!
And it’s even an existing programming pattern: StateMachine — Python 3 Patterns, Recipes and Idioms
The book I didn’t know I needed!
Anyway, existing implementations:
I really like how feature-complete and documented transitions
is - callbacks etc.