In the middle of the desert you can say anything you want
Context: in a paper, using PDF graphics is much better than e.g. PNG, because antialiasing (230628-1313 Saving plots matplotlib seaborn plotly PDF). Assume you need to crop one, and taking a PNG screenshot won’t cut it, because it would defeat the entire purpose.
TL;DR: in \includegraphics
, trim=left bottom right top
(in cm)
positioning - How can I crop included PDF documents? - TeX - LaTeX Stack Exchange:
includegraphics[clip, trim=0.5cm 11cm 0.5cm 11cm, width=1.00\textwidth]{PDFFILE.pdf}
BUT! If I’m ever in this situation, inkscape can really nicely open a PDF and export only the selected things, also as PDF.
… test the results by downloading the PDF from overleaf and opening it locally, because antialiasing w/ imported vector pictures can be broken from within the preview window.
Usual:
format:
revealjs:
logo: logo.png
theme: [default, custom.scss]
Adding after the first one, so no !important
needed1:
format:
revealjs:
logo: logo.png
header-includes: |
<link href="custom.css" rel="stylesheet">
Inline w/o declaring classes2:
Some [red words]{style="color:#cc0000"}
or:
::: {style="font-size: 1.5em; text-align: center"}
styling an entire div
:::
Insert custom css into revealjs presentation · Issue #746 · quarto-dev/quarto-cli ↩︎
Excellent list of bits: Meghan Hall ↩︎
For yay, the cache is in
$HOME/.cache/yay/
If the package is there, then:
sudo pacman -U ./quarto-cli-1.4.555-1-x86_64.pkg.tar.zst
Then pin the package in /etc/pacman.conf:
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg = quarto-cli
#IgnoreGroup =
Then yay -Syu
will ignore it as well:
:: Synchronizing package databases...
endeavouros is up to date
core is up to date
extra is up to date
multilib is up to date
:: Searching AUR for updates...
-> quarto-cli: ignoring package upgrade (1.4.555-1 => 1.5.52-1)
:: Searching databases for updates...
there is nothing to do
Refs: How do you downgrade an AUR package? : r/archlinux
For not-AUR, there’s the downgrade
command: archlinux-downgrade/downgrade: Downgrade packages in Arch Linux
Better preview at a specific port, handy for restarting after editing CSS. Similar to quarto project frontmatter preview: port: 4444 browser: false
.
quarto preview slides.qmd --port 4444 --no-browser
In frontmatter:
logo
is in bottom-right+
footer-logo-link
footer
for all slides
footer
shift-heading-level-by
, number-offset
, number-section
, number-depth
— will touch if I need this.In front matter:
header
: one header text for all presentationtitle-as-header
,subtitle-as-header
: if true
, place the presentation frontmatter’s title
/subtitle
as header if one not provided (overwriting the header
value)
hide-from-titleSlide
: all
/text
/logo
to hide it from title slidesc-sb-title
: if true
, h1/h2 slide titles will appear in the slide header automatically when slide-level
is 2 or 3Divs with classes:
.header
: slide-specific header
Excellent example from its docu of dynamic per-(sub-)section headers:
Since .s[c|b]-title
is present always, text added that way will be present on the title slide regardless of settings. … and — adding text to a presentation through CSS is, well, ..
.reveal-header .sc-title {
background-color: red;
&::before {
content: 'sc-title header content';
}
}
Slightly better ugly hack: main header text split in three, with two aligned l/r correspondingly.
.header-right {
// text-align: left;
float: right;
background-color: pink;
display: inline-block;
}
.header-left {
// text-align: left;
float: left;
background-color: yellow;
display: inline-block;
}
::: header
[left]{.header-left} and not left [and right]{.header-right}
:::
Result:
Improved the above to support both footer and headers I have a hammer and everything is a nail SCSS can do mixins let’s use them
// L/R margins of the footer — if logo is wider than this, it may overlap right footer text.
// By default, logo max-height is 2.2em, width auto based on this.
$footer-margin: 5em;
// left or right column bits
%hfcol {
display: inline-block;
}
/* L/R columns in header */
.reveal .reveal-header .rightcol {
@extend %hfcol;
float: right;
}
.reveal .reveal-header .leftcol {
@extend %hfcol;
float: left;
}
/* L/R columns in footer */
.reveal .footer .leftcol {
@extend %hfcol;
float: left;
margin-left: $footer-margin;
}
.reveal .footer .rightcol {
@extend %hfcol;
float: right;
margin-right: $footer-margin;
}
Usage:
## I am a slide with custom headers
And With content
::: footer
[Left footer]{.leftcol} Center footer [Right footer]{.rightcol}
:::
::: header
[Left header]{.leftcol} Center header [Right header]{.rightcol}
:::
Frontmatter usage works only for footer, likely header
doesn’t support markup.
footer: "Center footer [right]{.rightcol} [left]{.leftcol}" # CHANGEME
Result:
PROBLEMS:
This works almost perfectly, including missing values:
::: footer
::: {.columns}
:::: {.column width="20%"}
left
::::
:::: {.column width="50%"}
Center footer
::::
:::: {.column width="20%"}
right
::::
:::
:::
It even works inside frontmatter as multiline string (not that it’s a good idea):
footer: |
::: {.columns}
:::: {.column width="20%"}
left
::::
:::: {.column width="50%"}
FB5 – Informatik und Sprachen: Deep Learning (MDS)
::::
:::: {.column width="20%"}
::::
:::
This removes the margin placing it exactly in the same place as a normal footer:
.reveal .footer p {
margin: 0 !important;
}
(but headers don’t work)
A filter that parses frontmatter and puts things in the correct places.
For later.
Download GitHub directory: paste an URI to the directory, get .zip of that directory only. Handy for downloading only parts of datasets
training/patient101/
containing
segmentation.nii.gz
is the ground truth as used in the challenge, after postprocessing, the one we need.[kidney|tumor|cyst]_instance-[1|2|..?]_annotation-[1|2|3].nii.gz
test set unreleased: How to Obtain Test Data in the KiTS23 Dataset? - KiTS Challenge ↩︎
↩︎It’s important to note the distinction between what we call “annotations” and what we call “segmentations”. We use “annotations” to refer to the raw vectorized interactions that the user generates during an annotation session. A “segmentation,” on the other hand, refers to the rasterized output of a postprocessing script that uses “annotations” to define regions of interest.[^kits2023]
TL;DR use Chromium
PDF, PS and DjVu - ArchWiki has a table, but it lies, in my tests:
And for the Nth time, I end up remembering about Chrome/Chromium PDF viewer, that does this reliably.
sudo pacman -S cronie
sudo systemctl enable cronie.service
# many minutes were lost due to me forgetting to start it as well...
sudo systemctl start cronie.service
crontab -e
edits your own crontab, then you can omit the username.#!/bin/bash
# https://stackoverflow.com/posts/1482133/
# get the directory where this file is located
DIRNAME="$( dirname -- "$( readlink -f -- "$0"; )"; )"
cd $DIRNAME &&
git add -A &&
git commit -m "Automatic backup at `date`" &&
git push origin master &&
echo "Done"
# and this is the crontab
# odd hours:
# * 1-23/2 * * * /bin/bash $HOME/this-script-location.sh > /tmp/cronlog
EDIT: sometimes if git crashes an index file stays and then nothing runs — so the cronjob must be somehow monitored manually, todo.
TL;DR: fish easy version below works, but needs quotes when expression is complex: cc 2+2
but cc 'floor(2.3)'
.
I’m continuing to move my useful snippets from zsh to fish (240620-2109 Fish shell bits), and the most challenging one was the CLI python calculator I really love and depend on, since it contained arguments with parentheses (which are fish expressions as well).
Basically: cc WHATEVER
runs WHATEVER
inside python, can do both easy math a la 2+2
and more casual statistics-y mean([2,33,28])
.
Before in zsh this was the magic function:
cc() python3 -c "from math import *; from statistics import *; print($*);"
alias cc='noglob cc'
Fish, easy version:
function cc
command python3 -c "from math import *; from statistics import *; print($argv);"
end
Works for easy cc 2+2
bits, but as soon as functions and therefore parentheses get involved (cc floor(2.3)
) it starts to error out.
[I] sh@nebra~/t $ cc mean([2,4])
fish: Unknown command: '[2,4]'
in command substitution
fish: Unknown command
cc mean([2,4])
^~~~~~^
[I] sh@nebra~/t $ cc mean\([2,4]\)
>>> mean([2,4])
3
[I] sh@nebra~/t $
(But I REALLY don’t want to do cc mean\([2, 3]\)
)
In the zsh snippet, noglob
meant basically “take this literally w/o expanding anything”, and it passed everything as-is to python, and this is what fails in my fish solution.
Noglob in fish is fun:
If you wish to use arguments that may be expanded somehow literally, quote them. echo ‘’ and echo “” both will print the literal.
\'
for literals inside single$TERM
) & command substitution ($(command)
)
\"
for literal "
s inside doubleecho (ls)
= ls output, one lineecho "$(ls)"
= ls output, multilineecho '(ls)'
= (ls)
echo "(ls)"
= "(ls)"
THEN
command python3 -c "from math import *; from statistics import *; print($argv);"
cc ceil\(2\)
+cc ceil(2)
-`command python3 -c “from math import *; from statistics import *; print(’$argv’);”
OK can I do a variable then?
set pyc $argv
echo $pyc
command python3 -c "from math import *; from statistics import *; print($pyc);"
nope.
(and learning to use fish loops mainly, of course there are better ways to do this.)
# list of simple, brackets, and parentheses + no, single, double quotes
# no space between nums in brackets, python interpreter would add them. [2,3] — literal, [2, 3] — parsed by python
set cmds \
'2+2' \
'\'2+2\'' \
'"2+2"' \
'[2,3]' \
'\'[2,3]\'' \
'"[2,3]"' \
'floor(2.3)' \
'\'floor(2.3)\'' \
'"floor(2.3)"'
function tcc
set pyc $argv
# command python3 -c "from math import *; from statistics import *; print" '(' "$pyc" ');'
# command python3 -c "from math import *; from statistics import *; print($pyc);"
command python3 -c "from math import *; from statistics import *; print($pyc);"
end
# loop through all test cases to see sth that works for all
for i in $cmds
echo $i:
echo " $(tcc $i)"
end
At the end, no additional literal quotes + initial command didn’t error out, and we came full circle:
set cmds \
'2+2' \
'[2,3]' \
'floor(2.3)'
# winner command!
function tcc
command python3 -c "from math import *; from statistics import *; print($argv);"
end
[I] sh@nebra~/t $ ./test_cc.sh
2+2:
4
[2,3]:
[2, 3]
floor(2.3):
2
$pyc
gets expanded$pyc
in the working versions have no hard-coded quotestcc floor(2.3)
still fails — because like that it’s a command, not a string. In the file it was inside single quotes, as a string. So I can do this in the CLI as well.So simple and logical at the end.
function cc
echo ">>> $argv"
command python3 -c "from math import *; from statistics import *; print($argv);"
end
When using, quotes are needed only for complex bits (parentheses, *
etc.).
[I] sh@nebra~/t $ cc 2+2
>>> 2+2
4
[I] sh@nebra~/t $ cc [2,3,4]
>>> [2,3,4]
[2, 3, 4]
# no quotes
[I] sh@nebra~/t $ cc mean([2,3,4])
fish: Unknown command: '[2,3,4]'
in command substitution
fish: Unknown command
cc mean([2,3,4])
^~~~~~~~^
# with quotes
[I] sh@nebra~/t $ cc 'mean([2,3,4])'
>>> mean([2,3,4])
3
So I literally had to follow the advice from the first link I found and used single quotes in my initial command:
If you wish to use arguments that may be expanded somehow literally, quote them. echo ‘’ and echo “” both will print the literal.
Still, I learned a lot about fish in the process and honestly am loving it.