In the middle of the desert you can say anything you want
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
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:
duc index ~/ --fs-exclude fuse.sshfs
ext3,ext4
./etc/fstab
didn’t have the sshfs filesystem, but mount
called it fuse.sshfs
and this worked!duc index ~/ -e "*somefilename*"
*folder\/file*
etc).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 fileI 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!
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
# 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!
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.
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)
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
If you are inside a screen, and need to write the entire contents to a file (not just the ones currently visible), this will work:
<C-a> :hardcopy -h <filename>
.
In the context of a raised hand in google Hangouts meeting: “Do you have a question or an opinion?” (heard at work)
…TIL at work in a remote meeting. Makes the window with the code full-screen, hides the other windows, and increases the font size. Neat!
Yet another chapter of “python stdlib implementing most things I need better than me”, to create an infinite iterator itertools.count()
is better than stuff like iter(range(100500))
(from AA’s comment in a PR)
Couldn’t use ethernet because the device was ’not managed’ according to nm-applet
.
Neither
sudo nmcli dev set enp0s31f6 managed yes
nor changing managed=false
to managed=true
in /etc/NetworkManager/NetworkManager.conf
helped (after the usual service restarts).
But creating an this empty file did:
sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
Memory lapse on my side, I thought tempfile.gettempdir()
returned a random temporary directory I can use. Nope, it returns the absolute address of /tmp
or its equivalent on that platform.
I was thinking about tempfile.gettempdir()
. There are also tempfile.TemporaryDirectory()
, which gets automatically removed after the context ends or the object is deleted.
It’s the kind of things I’m afraid of in shell scripts, where manually deleting a temporary directory could remove more than needed.
As usual, the python docu on topic 1 is a good thing to read.
There’s no way to remove a directory with all its contents recursively using pathlib. 2
pathlib.rmdir()
removes empty directories, pathlib.unlink()
removes files.
The way to do this is external libs, a la shutil.rmtree()
.
Very very weird design decision, as removing stuff is in no way an uncommon operation.
But a recursive pathlib solution exists, from same StackOverflow answer:
from pathlib import Path
def rmdir(directory):
directory = Path(directory)
for item in directory.iterdir():
if item.is_dir():
rmdir(item)
else:
item.unlink()
directory.rmdir()
rmdir(Path("dir/"))
orjson
looks interesting: Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy | PythonRepo
Can be run on an entire folder on right click -> “Inspect Code”
When coding in a plane and then on a bus did some slight changes, some are useful:
font_family FiraCode-Bold
font_size 12.0
If I’ll be on the road more often, I’ll create this as a mode or something - bold bigger text, different IDE colorschemes, etc.
“Octopus mode” for emergency-multitasking-stuff - heard at work (J.)
Was redesigning my website, looked if there’s a smarter way to color links based on whether they are internal/external than manually adding classes to them. Well there is: Attribute selectors - CSS: Cascading Style Sheets | MDN
Attributes can be parsed based on prefixes, suffixes, containing something, belonging to a predefined list etc.
Full list: CSS selectors - CSS: Cascading Style Sheets | MDN
Random list from the internet: Telegram Desktop Keyboard Shortcuts (hotkeys)
Here interesting is <C-S-x>
for strikethrough text. The others there are all mostly useful.
Would be neat to add some simple javascripts to the Checklists | Diensttagebuch, so that when I click each <li>
it’ll become strikethrough-d. I’d be something a la document.querySelectorAll("li")
+ somethingsomethingOnClicksomething.
javascript - Change CSS properties on click - Stack Overflow, or whatever. Filling this as “todo” for some infinite time in the future. Likely not worth spending time on, as I nether am planning to travel too much, nor want to learn more about javascript.
It kept showing a “Thesis” link in the header, I couldn’t understand where from - well, I had a file called \
, prolly a vim artifact, which was a copy of the thesis.md
I’d been blaming. Removing \
removed the link. This also breaks my assumption that jekyll will ignore any non-md non-html files, noted.
published: false
in the front matter should’ve made the post disappear, but reloading it I could see it was still there. Then I noticed it did disappear from the category listings.
The issue was my use of rsync, a line I had copypasted a long time ago:
rsync -av _site/ me@server:/whatever --progress --update
It uploads incrementally only the changed files. No one said anything about deleting the deleted ones! Jekyll didn’t generate pages for those posts, but the ones on the server stayed there.
Not quite sure whether a fix is needed, for now just removed the directory from the server.