serhii.net

In the middle of the desert you can say anything you want

15 Sep 2021

Day 988

timewarrior track and :fill

Who knew you could combine commands! This is how you start tracking tag1,tag2 starting from the end of the previous span:

$ w track :fill tag1,tag2

Backfilled to 2021-09-15T12:21:41
Tracking "tag1,tag2"
  Started 2021-09-15T12:21:41
  Current               23:47
  Total               0:02:06

Running DUC with sshfs (excluding files and filesystems)

TL;DR:

duc index ~/ --fs-exclude fuse.sshfs

duc is about disk space, before running it the index should be built/updated. Usually similar to duc index ~/.

If I have a sshfs mounted somewhere, the process never ends as it tries to index the folder where it’s mounted.

Found some solutions:

  • To exclude entire filesystems, duc index ~/ --fs-exclude fuse.sshfs
    • According to the man page, this would be a comma-separated list of filesystems as found in fstab, like ext3,ext4.
    • My /etc/fstab didn’t have the sshfs filesystem, but mount called it fuse.sshfs and this worked!
  • To exclude individual files, duc index ~/ -e "*somefilename*"
    • doesn’t seem to work with folders in all variations I could think of (*folder\/file* etc).
    • So no way to exclude a folder? Except using its name and praying no other folders share it

Bonus: -p shows progress during indexing.

Now I have a new alias in ~/.zshrc:

ducindex() {
	duc index "$1" -p --fs-exclude fuse.sshfs 
}

cdd CLI alias for CD-ing to directory containing a file

I copypaste a lot the locations of the files from pycharm/intellij to run them from CLI or something similar. Easiest way, because they are focused and I don’t need to focus on the files/project view for that. I can’t find an Action in pycharm/intellij to copypaste only the directory.

Yet another alias for today:

cdd() {
	$(dirname "$1")
}

dirname gives the directory, dirname .. | cd and dirname ... | xargs cd don’t work (TODO - why?), so I’m using the zsh thing about “cd to the directory if it’s in a command by itself”.

Now cdd /home/me/wahtever/test.py takes me to /home/me/whatever/ which will saved tens of seconds per year!

Concatenating/splitting tiffs

Of course tiffsplit1 has a sister tiffcp! Ubuntu Manpage: tiffcp - copy (and possibly convert) a TIFF file

Concatenate N pages into a result.tif:

tiffcp xaaa.tif xaab.tif xabr.tif result.tif

pycharm highlights comments if they’re immediately below a TODO one and indented

# TODO - this is highlighted yellow
# And this is not

# ... BUT!

# TODO - this is highlighted yellow
#  This too, because it's indented one space and logically belongs to the comment above!

Random / vim / TODO

I often do <CR>ddkkp or d$kp as a reverse-enter, moving what’s to the right of the cursor on the line above the current one. I’m sure something like this already exists in vim.

Detectron2 and Yacs / YAML config / CfgNode; allow adding new keys

Detectron’s Yacs has a github repo with documentation and examples, much better than detectron’s own: rbgirshick/yacs: YACS – Yet Another Configuration System

This works:

comp_cfg.set_new_allowed(True)
comp_cfg['key'] = 'value'

Interesting bit about why it’s not like this by default:

We typically don’t use this so that typo in config file can be noticed. 2

Additionally, this is set per leaf, not per config - you can allow adding stuff to the root but not to its existing children.

And, still, even with comp_cfg.set_new_allowed(True), why can’t I merge_from_list etc. for non-existing keys? (TODO)

Detectron’s logger and log.txt

log.txt is nice and colorful on CLI, I don’t remember how to let vim interpret the CLI colors but less log.txt works magnificently.

cfg.merge_from_file() doesn’t work with new keys · Issue #2082 · facebookresearch/detectron2

Nel mezzo del deserto posso dire tutto quello che voglio.