In the middle of the desert you can say anything you want
I can always replace return None
with just return
in #python. (Third way is omit a return
completely.)
More about this: The Python return Statement: Usage and Best Practices – Real Python
In python, when doing regex on a multiline string:
re.MULTILINE
makes ^
and $
match on each line, not just begin/end of entire string.re.DOTALL
makes .
match newline (by default it doesn’t).Obsidian can do advanced search: Obsidian search
tag: #Tag
is better than searching the tag by itself, as the latter might find tags inside code listings etc etc etc
I changed the templates I use to be more repetitive but hopefully with less chances for a note meant to be private to get published on my website.
Three types of notes I want to be able to create easily:
I don’t want the Personal ones to end up left in any of the folders parsed by obyde even by chance, and if they do I don’t want them converted, and if they do - shown.
Now I just create a note, it gets put into /
, I give it a name, and then run one of the three templates. The templates take care of moving it to the correct folder and prefic
Now I have three identical templates, they move the note to the correct place, prefix the file with the datetime if needed, and add boilerplate frontmatter.
Public diensttagebuch note (<C-t>
), puts it into /garden/it/
and prefixes with datetime:
<% tp.file.move("garden/it/"+tp.date.now("YYMMDD-HHmm")+" "+tp.file.title) %>---
title: "<% tp.file.title %>"
tags:
- "zc"
- "zc/it"
- "<% tp.file.cursor() %>"
fulldate: <% tp.date.now("YYYY-MM-DDTHH:MM:SSZZ") %>
date: <% tp.date.now("YYYY-MM-DD") %>
layout: post
hidden: false
draft: false
---
Public journal note (<C-S-t>
) is pretty much identical:
<% tp.file.move("garden/rl/"+tp.date.now("YYMMDD-HHmm")+" "+tp.file.title) %>---
title: "<% tp.file.title %>"
tags:
- "zc"
- "zc/rl"
- "<% tp.file.cursor() %>"
fulldate: <% tp.date.now("YYYY-MM-DDTHH:MM:SSZZ") %>
date: <% tp.date.now("YYYY-MM-DD") %>
layout: post
hidden: false
draft: false
---
Notes not meant to be published (<C-t>
) get put into /Personal
, but also:
date
in frontmatter, obyde should loudly error out if it sees them (which it should never)Is helpfully describeed in the autocomplete for [[
:
[[^
to internal blocks (you have to type the title by yourself, like this)[[#
for headers (Manually creating block references).
EDIT 2021-12-07: You can do this from external pages too! Just autocompletion is not intuitive. See 211207-2015 Obsidian embedding parts of other document. 1
When linking internally it autogenerates reference names, it seems. ^74ce58
Can I do this? ^myreference
Yes I can! Autocompletion even suggests/uses my reference!
Can _I_ do this? ^myreference
[Yes I can!](#^myreference) Autocompletion even suggests/uses my reference!
When looking at a commit, clicking on “View the entire source for this file” symbol opens that file, and then one can navigate to folders etc as usual, they’ll all be from the current branch.
Hugo generates anchors from headers automatically 1. Tested it - yes, except they’re lowercased and spaces get converted to -
(which makes sense).
As a refresher, in HTML it’s
<h2 id="anchor">..</h2>
<a name="anchor"></a>
<a href="#anchor">anchor link </a>
One additional way to check the type hints in #python is mypy
, installable as python package.
mypy -p package_name
checks the typing in the package, and found some potential errors in corner cases I didn’t know about in one of the projects I’m working on!
Finds wrong typing, missing/wrong return values, that kind of stuff.
It doesn’t like what: str or Path
typing output, I guess only Union[str, Path]
- is there a reason for it?
In any case I like it more than Pycharm’s way of outputting things and will be using it along with black
and flake8
in the future (along with typing itself).
#py/mypy
Tried to download a Teamcity artifact through wget
, and apparently you can if you provide a user/pass through wget!
I assume it’s HTTP auth or something
wget --user username --password my-password https://teamcity.location/repository/download/....
Had issues, asked for help, and then learned a lot of stuff.
git rebase branchname
!= git rebase origin/branchname
!
The first one is about the current local state of the branch, the second one about the one on remote.
BUT the one on remote as known by local != one on remote-remote! You need to update first!
git fetch --all
or whatever.
I’d previouly update / pull before through PyCharm before doing that, and this abstracted all of this away from me.