In the middle of the desert you can say anything you want
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)
Detectron2 in its default dataloader filters images not containing any annotations1 because tradition; can be disabled by with
Couldn’t use ethernet because the device was ‘not managed’ according to
sudo nmcli dev set enp0s31f6 managed yes
/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
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.
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.
<li> it’ll become strikethrough-d. I’d be something a la
document.querySelectorAll("li") + somethingsomethingOnClicksomething.
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.
Has nice keyboard shortcuts, viewable with
?. Heavily vim-inspired