In the middle of the desert you can say anything you want
Hypermodern Python · Claudio Jolowicz
It has basics on how to write/run/publish a Python app in 2020, which is nice. Uses poetry
and stuff. I don’t have much knowledge in such things. But next project I do will use some of the ways described in there, there’s no consensus on how to do it right but what’s described there is much better than nothing.
Yet another nice unfinished project! I need something to unite flashcards and actual study material. I see something that gets markdown flashcards as input, and generates (via genanki1?) actual flashcards to be imported into anki, but also (with pandoc?) nice readable latex/HTML thinges in column (a la “The little schemer”) form to review it better and/or print.
This is something I really miss now, since anki_import
has some issues but I don’t want to learn perl to fix them. And I’d need the column format output.
Added this to config.py:
config.unbind('<Shift-Escape>', mode='passthrough')
config.bind('<Ctrl-Shift-Escape>', 'leave-mode', mode='passthrough')
Now I can use <Shift+Escape>
in vim-mode of Jupyter Notebook! It’s used to go from insert mode inside a cell to operate on the cells themselves. I missed this. Additionally my bindings of “Ctrl” as “Escape” when clicked fast seem to work also inside other bindings! As in <Shift-fastCtrl>
works as <Shift-Escape>
. Wow.
Youtube-dl can download video from Reddit! Such as will she fall? (tutorial link in comment) : animation
Why can’t Python’s raw string literals end with a single backslash? - Stack Overflow - raw strings are not that raw and can’t end in a single backslash.
fun! SetBackslash()
syn region mys matchgroup=ignore start=/^\s*\\/ end=/$/ oneline
hi link mys EndOfBuffer
endfu
fun! SetQuestions()
syn region dash matchgroup=ignore start=/^\s*\\+/ end=/$/ oneline
hi link dash Statement
endfu
" fun! SetQuestions()
" syn match mys /^\s*+.*$/
" hi link mys Keyword
" endfu
autocmd filetype markdown :call SetBackslash()
autocmd filetype markdown :call SetQuestions()
Ctrl+a
increases the number under the cursor,
Ctrl+x
decreases the number under the cursor.
The Top 12 Fake Apologies – And What Makes for an Authentic Apology
Кот Максим который, когда слышит записанные звуки котят, начинает их искать (Зум-квиз-радость)
An Ermine, aka Stoat, is the thing Lady with an Ermine holds.
{:width=“50%”}.
Yes.
Hotlinking is allowed from Wikimedia servers, but not generally recommended: this is because anyone could change, vandalise, rename or delete a hotlinked image. 1
First found in The Trouble with Tribbles which I found through Voltaire - The Trouble with Tribbles (Song Only) - YouTube
Changed the default <Leader><Leader>
mapping to s
, that I never use, now everything is much easier!
The *
thing to search for word under cursor also works!
“Шредингеров кот” (с) Андрей
Vim plugins that I use, Read man pages with vim
The last one is freaking awesome.
spunk - spark (fire); courage, spirit, determination.
fun! SetBackslash()
syn region mys matchgroup=ignore start=/^\\/ end=/$/ oneline
hi link mys EndOfBuffer
endfu
fun! SetQuestions()
syn region dash matchgroup=ignore start=/^\\\s*+/ end=/$/ oneline
hi link dash Statement
endfu
The backslash is a way to mark “pre-written” things is my todo files. Anything after them is special.
The backslash itself doesn’t get shown (matchgroup=ignore
), everything else either is colored as EndOfBuffer
(blue) or, if it starts with a +
, as Statement
(=yellow).
I’ll play with the colours a bit more later.
matchgroup=
1 is the colour in which we’ll print the things that are actually matched as start/end, can be different from the thing demarcated by them.
How to Use Generators and yield in Python – Real Python:
>>> nums_squared_lc = [num**2 for num in range(5)]
>>> nums_squared_gc = (num**2 for num in range(5))
The second one is a generator expression, with all the nice memory thingsies that entails.
In general How to Stand Out in a Python Coding Interview – Real Python has some very interesting bits I had no idea about.
And from “Dive into python”, p.193:
Using a generator expression instead of a list comprehension can save both RAM and CPU. If you’re building an list just to throw it away (e.g. passing it to
tuple()
orset()
), use a generator expression instead!
Generator expressions are functionally equivalent to generator functions.
itertools
The itertools module has a lot of awesome stuff! 1
cycle, count, repeat, etc etc etc.
Scary to think how many hours of coding I could have done over my lifetime if I hadn’t read this.
#!/usr/bin/env python
and the env trick for running stuffFrom the Learning Python 5th Edition book, Chapter 3 page 60:
#!/usr/bin/env python
...script goes here...
This is fascinating. The env $whatever
command returns the location of $whatever
, which may or may not be standard. And apparently this is the way to write trueъ portable scripts.
This goes to show that reading some nice reference line-by-line is actually a good thing if you have basic random bits of knowledge about something.
So currently:
The latter two have actual “Test your knowledge” tests and exercises.
All of them may or may not be helpfully available illegally online, especially on github, especially in a repo I cloned.
My latest trick for deciding on external ports to forward is to combine the service port and the device’s internal IP address. If my desktop was 10.0.1.36 and the service was SSH on port 22, the external port would be 22136. So far it’s worked well, but it only really works if you force your router to only give out 10.0.1.2 through 10.0.1.99. (snazz @ Port knocking | Hacker News)
Also: Port knocking is a method of externally opening ports on a firewall by generating a connection attempt on a set of prespecified closed ports. Once a correct sequence of connection attempts is received, the firewall rules are dynamically modified to allow the host which sent the connection attempts to connect over specific port(s). 1
I’ve noticed a similar way of counting that’s still quite common today in China. They point with their thumb to each segment of their four fingers to count up to 12 on one hand. The other hand tracks the number of 12 counts, which lets you keep track all the way up to 144 with both hands. (modo_ at Roman Finger Counting | Hacker News)
All thumbs - Fig. very awkward and clumsy, especially with one’s hands.
uncouth - clumsy, awkward, unrefined, crude.
My favourite quote by Kerouac has a fuller version I forgot exists:
“I don’t know, I don’t care, and it doesn’t make any difference.” ― Jack Kerouac
From the 1-to-1: “You always meet twice in life”
Binary crossentropy is a special case of categorical crossentropy, for when you have one output.
I can use syntax like !10600
inside commands in the CLI! They get replaced when needed.
pdf2ps input.pdf tmp.ps
ps2pdf -dPDFSETTINGS=/screen -dDownsampleColorImages=true -dColorImageResolution=200 -dColorImageDownsampleType=/Bicubic tmp.ps output.pdf
```, and you can tune `dColorImageResolution`. Out of all answers in that thread [^compr], it's the only one that decreased my 2.3M pdf to 1.3MB. (Needed less than 2MB)
[^compr]: [pdftk compression option - Stack Overflow](https://stackoverflow.com/questions/5296667/pdftk-compression-option)
If their absence brings you peace, you didn’t lose them.
whatevercommand | vim -
works nicely for some of the commands I’d usually use less
for.
Related TODO: that vim plugin to read man pages and the website I found it on.
I feel like writing better reviews of the books I read on Goodreads or my blog. I miss having to put things into words, and one of my New Year’s resolutions one of the previous years has been “Less consuming, more creating. Doesn’t matter what it is, doesn’t matter if it’s bad.”, stolen from HN. There’s definitely something to it. Along with this quote:
“Write it. Shoot it. Publish it. Crochet it, sauté it, whatever. MAKE.” ― Joss Whedon
Also, from the Onion:
This is America. Nobody deserves to be treated as a black man. Judge Rules White Girl Will Be Tried As Black Adult - YouTube