In the middle of the desert you can say anything you want
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
Analyzing this DTB would make for an interesting blog post, especially by plotting the frequency of words in the headers, length, time of the day they were created. Same goes for the link wiki. Same goes for list of URLs and graphing the number of them returning 404s or similar.
I also want to create better Python scripts that join everything to the master file (Master file | Diensttagebuch) with better formated dates.
This definitely goes into anki: Rsync – To Slash or Not To Slash? – Rants & Raves – The Blog!
Without a slash on the source directory means copy both the source directory, and the contents (recursively if specified) to the destination directory while adding a trailing slash means only copy the contents of the source directory, recursively if specified, to the destination. Without a slash on the source directory means copy both the source directory, and the contents (recursively if specified) to the destination directory while adding a trailing slash means only copy the contents of the source directory, recursively if specified, to the destination.
TL;DR: #anki
The difference between /target/source/source_content
and /target/source_content
.
Usually I want slash.
To memorize, the slash represents the contents of the directory in some way.
Also nice handy command tree
that I didn’t know I needed.
On the topic of the things I keep forgetting:
grep -v excludeme
, mnemonic might be reVerse
? #anki
rsync -ra --info=progress2 source target
#anki
Usually this is what I want, otherwise there’s pv
that I could never get to work reliably
Хештег - Як перекладається слово Хештег українською - Словотвір
З огляду на технічну складову питання додам коротке обґрунтування назви “кришмітка”. Слово hash-tag отримало таку назву не просто із-за символа “решітка”, причиною використання цього символа є скорочення написання слова hash-tag, коріння якого по своїй суті заходить глибоко в науку про компьютери. Розробники використовють слово hash як скорочення слова dictionary (словничок) що є спеціальною структурою даних котра пришвидшує пошук. Hash-tag або “#tag” з технічної точки зору означає те що слово “tag” проіндексується (потрапить у індекс або іншими словами словничок) і надалі буде доступне для швидкого пошуку. Тепер про саме слово hash, у тій же компьютерній науці існує багато стуктур даних здатних виконувати роль словничка. Hash-словнички особливі тим що використовують спеціальну hash-функцію, котра дозволяє отримувати інформацію із найменшою кількістю дій над словничком (аналогія дії - перелистування сторінок словника, що є вкрай повільним). Hash-фунція на основі вхідної послідовності символів (текста чи слова) підраховує число. Якісна hash-функція буде генерувати числа особливим чином, якщо в тексті замінити бодай одну літеру число має змінитися кардинально, але визначальним є те що якщо на вхід подавати одну і ту ж саму послідовність число має залишитися незмінним. Таким чином після того як ваша послідовність символів потрапила у словничок, вам не потрібно гортати його сторінки для того щоб знайти необхідний ключ, ви підраховуєте хеш-функцію яка вам повертає номер сторінки де має знаходитись слово. Hash-функція отримала таку назву із-за дій що вона виконує над вхідними данними всередині себе. Фактично вона “кришить”, “рубає”, “перемішує”, “заплутує” вхідні данні, що відповідає англійському перекладу слова hash. Тобто логічним було б перекласти слово хеш у цьому контексті як “криш” або “міш”. Переклад слова “tag” вже здійснений, і це “мітка”, поєднавши ці варіанти отримаємо “кришмітка” що в одночас володіє певною милозвучністю.
“Кришітка” є спрощеним варіантом новотвору “кришмітка”, запропонованого Денисом Яремовим. Але має кілька суттєвих переваг: 1) Милозвучніше; 2) Відповідає етимології (криш-мітка); 3) І до того ж співзвучне з назвою самого символу # - “решітка”.
Знову захотілося писати Соломку українською мовою, просто щоб мати змогу використовувати слово “кришітка” :)
Removed the dependency from $SPRINT
by simplifying basically everything in .zshrc
:
s () {task s sprint.is:$(date +%-V) or sprint:c $*}
A mostly-complete example:
youtube-dl --yes-playlist --cookies ~/D/cookies.txt --playlist-end 100 --playlist-start 18 --write-description --write-info-json --all-subs -o '%(playlist_index)s - %(title)s.%(ext)s' --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.9.5 Chrome/56.0.2924.122 Safari/537.36" --min-sleep-interval 0 --max-sleep-interval 20 -i https://www.youtube.com/playlist\?list\=$MYPLAYLIST
-i
is for skipping errors (“ERROR: 1Jlvi4qTiyE: YouTube said: This video contains content from DisneyEnterprisesInc, who has blocked it on copyright grounds.”)
I could not get --user
to work, because I got error 400, but --cookies
works. qutebrowser’s cookies are not in the right format (but are located at ~/.local/share/qutebrowser/cookies
and nicely readable), and firefox’s cookies can be downloaded using cookies.txt – Get this Extension for 🦊 Firefox (en-US).
Out of 2279 videos, 1995 were available, that would mean 87.5%. Makes me a bit anxious about the links on my links wiki :) I should do some datahoarding/archiving there too.
And another interesting thing - the random quotes from my file usually are not easy to google, and the only result is my blog post with them (Private: ~/notes/quotes; ~/notes/phrases | Я сам, соломка, чай.)
Everything as-is, sadly I don’t have sources for everything, but should be pretty easy to google.
Ha.
kibble is store-bought dry (mostly) cat food. To kibble = ’to coarsely grind’. Found on Peter Watts’ The Kibble Fund
TIL DDG doesn’t allow me to search for exact matches in quotes, which I find absolutely idiotic. Yandex works, Google works. The usual “I want to like ddg but I honestly can’t”
/g/ - Let’s collect here programming books that are unusual in some sense, be it their approach, presentation, or simply just quality. “The little schemer” has a nice dialog-like structure, and I find this very interesting. I wonder if there are any other similar books (or threads).
Take care editing bash scripts
Well, after the 30 seconds elapses, the running script deletes all of my files. This happens because bash reads the content of the script in chunks as it executes, tracking where it’s up to with a byte offset. When I delete one character from the sleep line, the “next command” offset points at the r in #rm instead of the #. From the interpreter’s point of view, the # shifts backwards onto the previous line so it runs the unfortunate command.
javascript:(function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})()
, found in One of my favorite bookmarklets to remove cookie notifications or other obnoxiou… | Hacker News
To run it as bookmarklet in qutebrowser, jseval
works:
:jseval (function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})()
Now bound to ,b
:
config.bind(",b", ":seval (function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})()")
And as a bonus, ,w
now takes me to the wayback machine for that page:
config.bind(",w", ":jseval javascript:location.href='https://web.archive.org/web/*/'+location.href")
:bind
opens a page with all the bindings as currently configured. This answered a lot of my quesions, especially about the caret mode bindings that are not documented anywhere I could find.
What’s interesting is the Ctrl-e
in Insert mode that opens the editor (I usually did Esc+e
)
TODO: Add links to categories in my blog, they might be useful for example for Pentachronological #0015 Праздник | Я сам, соломка, чай.. And in general maybe look into the blog itself - maybe I want to unite it with Diensttagebuch or something?
{%raw%}{:width="40%"}{%endraw%}
If you really want to make something good, eat good food and drink good saki. (Welcome to the NHK, episode 20.) 1
A tv drama has a progressive plot, an emotional climax and a resolution, but our lives aren’t like that… all we get day after day are vague anxieties that are never resolved. 2
questo è uno di quegli anime che fanno morire una piccola parte di te, passi 1-2 giorni ripensando a ciò che hai visto malinconico. Al 3 giorno pensi un’ultima volta a ciò che ti ha trasmesso, sorridi e il vuoto che ti ha dato si riempie di fiori dandoti molto di più da ciò che ti aspettavi. 3
And on the topic of fully enlightened people:
tabulate
works surprisingly well to make random tables:
>>> x = tabulate.tabulate([['WHAT','Will happen','Will not happen'],['If I do this','',''],['If I don\'t do this','','']],tablefmt='grid')
>>> print(x)
+--------------------+-------------+-----------------+
| WHAT | Will happen | Will not happen |
+--------------------+-------------+-----------------+
| If I do this | | |
+--------------------+-------------+-----------------+
| If I don't do this | | |
+--------------------+-------------+-----------------+
>>>
(wow?) debellare - Wiktionary - sconfiggere/eliminare. 3
Welcome To The NHK 20 English Dub - YouTube, even though anime on Youtube is one of the more ephemeral things. ↩︎
Welcome to the NHK - Ep. 24 - Welcome to the N.H.K.! - END - YouTube ↩︎ ↩︎