In the middle of the desert you can say anything you want
In my old zsh config I had this:
function dos() {
# run_disowned and silenced
nohup "$@" >/dev/null 2>&1 & disown
}
Emulating my old dos
command in fish:
firefox &; disown
starts and disowns ffx.Both together give this solution:
function dos
echo "disowning $argv"
command $argv >/dev/null 2>&1 &
disown
end
$(cmd)
shell - Fish equivalent of bash $(command) notation - Stack Overflow:
- bash: $(command)
- fish: (command)
which
commandtype - locate a command and describe its type — fish-shell 3.7.0 documentation:
type commandname
.
[I] sh@nebra~/me/me-qs $ type cc
cc is a function with definition
# Defined in /home/sh/.config/fish/config.fish @ line 184
function cc
echo ">>> $argv"
command python3 -c "from math import *; from statistics import *; print($argv);"
end
When doing a multilingual quarto website using profiles (240619-1425 Quarto multilanguage website), quarto preview/render --profile de
allows previewing only one language, and the menu links (/de/xxx
) break.
Solution to preview EVERYTHING, including menu links logic:
# Todo break on erorr
quarto render --profile=ua
quarto render --profile=en
quarto render --profile=de
And then serve the _site
directory locally through a simple webserver, e.g.
Python SimpleHTTPServer - Python HTTP Server | DigitalOcean, and see the result on http://localhost:9000:
python3 -m http.server -d _site 9000
ERROR: TypeError: title.trim is not a function quarto
happens for me when in front-matter I do
---
# title: "Publications and Awards"
title: {\{< var test >}}
instead of QUOTED
---
# title: "Publications and Awards"
title: "{\{< var test >}}"
ALSO, interestingly, when I save the wrong version while previewing the error is better:
ERROR: Validation of YAML front matter failed.
ERROR: In file publications.qmd
(line 3, columns 8--24) Field "title" has value {\{< var test >}}, which must insteadbe a string
2: # title: "Publications and Awards"
3: title: {\{< var test >}}
~~~~~~~~~~~~~~~~~
4: css: ./posts_publications/pub_style.css
✖ The value {\{< var test >}} is of type object.
ℹ The error happened in location title.
ERROR: Render failed due to invalid YAML.
So: quarto errors are more detailed when previewing instead of when compiling from zero? Interesting. Okay.
No native support
R package exists, but I don’t feel like digging into R at all: Renders a Multilingual Quarto Book • babelquarto
The other approaches I found are all based on project profiles and conditional output
Document Language – Quarto1 for setting one language in the page and doing per-language changes to the template texts
_quarto-profilename.yml
ONLY, the rest won’t get parsed
profile:
default: en
# mutually exclusive group: you can do only one
# (otherwise `--profile one,two` does multiple)
group:
- [en, de, uk]
# `unless-profile` exists as well
::: {.content-visible when-profile="en"}
This content will only appear in the advanced version.
:::
Links are going to be interesting!
Currently /de
is German, /
is English.
Main home page is ..
from DE lang, or /de
from EN.
Menu items:
href: ../de/lehre.html
— note the HTML bit!But when previewing DEU, all of these pages are at /
— ergo menu items don’t work, as they lead to a non-existing ../de/...
ALSO: marioangst.de shows nicely how one can link to other languages from the menu!
- icon: book
href: publications.qmd
text: Publikationen
- href: ../en/blog
text: Blog (englisch)
Website Options – Quarto tells me I can do this in each _quarto-de.yml
etc. profile:
format:
html:
lang: de
#lang: ua
#lang: en
This changes the interface to follow the corresponding quarto-cli/src/resources/language/_language.yml at main · quarto-dev/quarto-cli
Not dealt with in any of the approaches: quarto’s native Document Language1 thing
So:
- How do I do different post titles per language?
- How do I change site language, so , conditionally?_languages.yml
Project Basics – Quarto discusses the various approaches to metadata
… I could literally do a bash script that puts a _metadata.yaml
, builds with a proflie, then removes that file. Oh this would be painful
Skimming Website Options – Quarto doesn’t really help
lang: de
from within profiles! NICEtitle[currnet-profile-name]
or something?_variables.yml
works for var shortcodes (240619-1845 Quarto error title.trim() is not a function), and shortcodes can do metadata too# works
title-en: "Publications and Awards"
title: "{\{< meta title-en >}}"
If only I could do per-language attributes as shown in the docu2:
language:
en:
title-block-published: "Updated"
fr:
title-block-published: "Mis à jour"
It would be so cool if one could overwrite the other variables
language:
de:
title: german post title
The above would nicely get a language from the profile _quarto-lang.yml
and automatically change the things.
Can I do this for titles and front-matter?
I can get the current profile from the env variable
profile: {\{< env QUARTO_PROFILE >}}
If I could just
title: vars['titles']['postname'][QUARTO_PROFILE]
OK let’s do this. No choice.
First3 attempt to write anything in lua:
function Meta(m)
local profiles = quarto.project.profile
local profile = profiles[1]
if profile then
print("Profile: " .. profile)
m.active_profile = profile
end
if profile and m.titles and m.titles[profile] then
cleantitle = pandoc.utils.stringify(m.titles[profile])
oldtitle = pandoc.utils.stringify(m.title)
m.title = cleantitle
print("Profile:" .. profile)
print("Old title:" .. oldtitle)
print("New title:" .. cleantitle)
end
return m
end
I’d need to make it more robust:
So:
function Meta(m)
local profiles = quarto.project.profile
if not profiles then
-- TODO: missing YAML key? Empty YAML key?..
-- TODO even more later: filter multiple profiles to use the language one
return m
end
local profile = profiles[1]
-- If we have a named profile, save it, otherwise return
if profile then
print("Profile: " .. profile)
m.active_profile = profile
else
return m
end
if m.titles then
local titles = m.titles
if titles[profile] then
newtitle = pandoc.utils.stringify(titles[profile])
oldtitle = pandoc.utils.stringify(m.title)
-- log both if they differ
if newtitle ~= oldtitle then
m.title = newtitle
-- print("Old title:" .. oldtitle)
-- print("New title:" .. newtitle)
print(oldtitle .. " => " .. newtitle)
end
else
print("Title for profile " .. profile .. " not found among ")
for lang, title in pairs(titles) do -- Table iteration.
print(" " .. lang .. ": " .. pandoc.utils.stringify(title))
end
end
end
return m
end
Main problems:
[Document Language (alternates) – Quarto](https://quarto.org/docs/authoring/language.html) ↩︎
I think Master Thesis pandoc required lua magic and I tried some small pandoc filter bits, але це було давно і неправда. ↩︎
All from javascript - How can I comment the EJS code (JS node) without getting an error - Stack Overflow:
// Neat multiline comment thing
<%if(false) {%>
<!-- single row of inline icons for pdf. etc instead of buttons -->
<%} %>
// hard to grep for and no syntax highlight, so maybea adding COMMENT works as my bad idea
<%if(false) {%>
<!-- COMMENT
single row of inline icons for pdf. etc instead of buttons
-->
// Documentation says:
<%# comment %>
// Not documentation, multiline comment:
<%/* comment */%>
I had issues putting HTML code w/ EJS snippets in the latter one, so iffalse it is. For nested things, SO suggests these (both bad imo):
<!--label for="<%#= user.id %>" style="background-color: <%#= user.color %>;"-->
<!--label for= <%#=`${user.id}` %> style= <%#=`background-color: ${user.color};`%> -->
Given: quarto website page with publications. Previously touched upon in the messy 240605-2055 Quarto website creation notes.
This works:
[UNLP paper](publications.qmd#hamotskyi2024unlp)
<a name="title"></a>
name=
, not id=
, attribute, but this doesn’t work for me in quarto.)// Get anchor id somehow from paper path
<% let y= item.path.split('/'); y.pop(); let dirname = y.pop(); let citation_key = dirname.split('-').pop() %>
// Overwrite with paper front-matter if there's one
<% if (item.citation_key) { %>
<% citation_key = item.citation_key %>
<% } %>
// Add to paper listing thing
<a id="<%= citation_key %>"></a>
/etc/systemd/system/user-suspend@.service:
[Unit]
Description=Lock the screen
Before=sleep.target
[Service]
User=%I
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/xlock -usefirst -echokeys -description -modelist swarm,starfish,mandelbrot,polyominoes,fadeplot,matrix,lisa,life3d,life1d,kumppa,grav,flow
[Install]
WantedBy=sleep.target
To enable1:
sudo systemctl enable user-suspend@myusername.service
Arch wiki (Session lock - ArchWiki) omits @myusername
which leads to this error:
Failed to enable unit: Destination unit sleep.target is a non-template unit.
Also: xlock (xlockmore) is neat, here’s a list of modes: XlockMore modes
(Also: XScreenSaver versus XLock)
Offtopic but cool: Cool, but obscure X11 tools
Added this to qtile autostart:
xss-lock -- xlock -usefirst -echokeys -modelist qix,lisa &
Auto-lock after 300 seconds:
xset s on
xset s 300
maim
is supposed to be the “better scrot”1
# screenshot and put into clipboard
maim -s | xclip -selection clipboard -t image/png -i
In qtile you can’t do that, because |
is a shell construct2.
Solution: do it in a shell:
CommandSet(commands={
#...
"S/clipboard": "bash -c \"maim -s | xclip -selection clipboard -t image/png -i\"",
Added ddg’s backslash-feeling-lucky to qb search engines. Encoded the backslash as URI, it worked!
https://duckduckgo.com/?q=%5C{}
Full list:
c.url.searchengines = {
'DEFAULT': 'https://search.brave.com/search?q={}',
'b': 'https://search.brave.com/search?q={}',
'g': 'https://google.com/search?q={}',
's': 'https://scholar.google.de/scholar?hl=de&as_sdt=0%2C5&q={}&btnG=',
'ddg': 'https://duckduckgo.com/?q={}',
'l': 'https://duckduckgo.com/?q=%5C{}',
'c': 'http://dict.cc/?s={}',
'y': 'https://youtube.com/results?search_query={}',
'd': 'https://en.wiktionary.org/wiki/Special:Search?search={}',
'w': 'https://en.wikipedia.org/wiki/Special:Search?search={}',
'wa': 'http://wolframalpha.com/input?i={}',
}
A minimal citation style(for grant proposals) – anton.cromba.ch