In the middle of the desert you can say anything you want
“Hugo uses Go’s html/template and text/template libraries as the basis for the templating.” 1
I tried to use go
as “language” in code blocks to highlight Hugo templates and it seems to work nicely!
The result of
```go
{{ range (.Paginate ($pages_l.GroupByDate "2006-01-02")).PageGroups }}
```
is
{{ range (.Paginate ($pages_l.GroupByDate "2006-01-02")).PageGroups }}
(I generated the first code listing using the \{-{-< highlight go >\}\}
Hugo shortcode)
Previously I had the posts split by days (“Day 1234”), now for every former h2-header I have a separate post, but still want to split them by days.
Hugo can group posts by stuff, including by dates. 1
This kinda works with pagination. 2
Now my list.html
template for Diensttagebuch uses this to iterate through days/groups:
{{ $pages_k := where .RegularPagesRecursive ".Parent.Title" "Days" }}
{{ $pages_j := where $pages_k "Params.draft" "ne" true}}
{{ $pages_l := where $pages_j "Params.hidden" "ne" true}}
{{ range (.Paginate ($pages_l.GroupByDate "2006-01-02")).PageGroups }}
With the important bit being here, this iterates by day, not by month as in the examples:
$pages_l.GroupByDate "2006-01-02"
Then the “day” header itself is {{.Key}}
, to get the day of the month + month-year I do this:
<span class="day">{{ dateFormat "02" .Key }}</span>
{{ dateFormat "Jan 2006" .Key }}
Then iterating through the individual posts inside each “day” is:
{{ range .Pages }}
<a href="{{ .RelPermalink }}">{{.Title}}</a>
<span class="description">
{{ .Content }}
</span>
{{ end }}
Everything that has to do with grouping and lists described here: Lists of Content in Hugo | Hugo) ↩︎
nvidia-smi
has a python library: nvsmi · PyPI
import nvsmi
nvsmi.get_gpus()
nvsmi.get_available_gpus()
nvsmi.get_gpu_processes()
RabbitMQ is a message broker / scheduler that allows sending/receiving messages.
RabbitMQ is a message broker: it accepts and forwards messages. You can think about it as a post office: when you put the mail that you want posting in a post box, you can be sure that the letter carrier will eventually deliver the mail to your recipient. In this analogy, RabbitMQ is a post box, a post office, and a letter carrier.
The major difference between RabbitMQ and the post office is that it doesn’t deal with paper, instead it accepts, stores, and forwards binary blobs of data ‒ messages.
#GAN that generates handwritten text: amzn/convolutional-handwriting-gan: ScrabbleGAN: Semi-Supervised Varying Length Handwritten Text Generation (CVPR20) #pytorch
You can do python -m pip uninstall -r requirements.txt
Errors with bdist_wheel
missing as a command when installing python packages got fixed with the help of SO1, needed to do python3 -m pip install wheel
After writing whatever: str or Path
or whataver: Union[str, Path]
for the N-th time I googled how to do this better. Well, 1
from typing import Union
from pathlib import Path
pathlike = Union[str, Path]
whatever: pathlike = some_function()
def f_paths(path_one: pathlike):
From FreeCodeCamp:1
git branch
shows all branchesgit push --all
pushes all local branches to remote.git push origin some-branch:my-feature
pushes the local branch some-branch
to a remote branch called my-feature
I should really try this sometime. Having a reproducible OS install would make life much easier. On my radar a long time, but a person I was interviewing last week was the final drop I guess.
bindsym ${mod}+d exec ${nixpkgs.rofi}/bin/rofi -show run
Nix is a 100% reproducible package manager, for all languages and all things. This means your python environment, your R environment, your models, your entire computer can be completely reproduced, all using the magic of nix. In this article, we will walk through setting up a simple, reproducible, and failproof data science stack with nix, including importing packages not found on nixpkgs and caching the builds online
From SO, to find the disk space taken by files with a certain extension/type:1
find ./photos/john_doe -type f -name '*.jpg' -exec du -ch {} + | grep total$