serhii.net

In the middle of the desert you can say anything you want

07 May 2020

Day 493

Rsync to slash or not to slash

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

  • Source directory:
    • Slash: copy the contents of the source directory, without the directory itself
    • No slash: copy both the directory and its files
  • Destination directory: doesn’t matter

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.

grep excluding matches

On the topic of the things I keep forgetting: grep -v excludeme, mnemonic might be reVerse? #anki

rsync show progress

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

Random / Interesting / Ukrainian

Хештег - Як перекладається слово Хештег українською - Словотвір

З огляду на технічну складову питання додам коротке обґрунтування назви “кришмітка”. Слово hash-tag отримало таку назву не просто із-за символа “решітка”, причиною використання цього символа є скорочення написання слова hash-tag, коріння якого по своїй суті заходить глибоко в науку про компьютери. Розробники використовють слово hash як скорочення слова dictionary (словничок) що є спеціальною структурою даних котра пришвидшує пошук. Hash-tag або “#tag” з технічної точки зору означає те що слово “tag” проіндексується (потрапить у індекс або іншими словами словничок) і надалі буде доступне для швидкого пошуку. Тепер про саме слово hash, у тій же компьютерній науці існує багато стуктур даних здатних виконувати роль словничка. Hash-словнички особливі тим що використовують спеціальну hash-функцію, котра дозволяє отримувати інформацію із найменшою кількістю дій над словничком (аналогія дії - перелистування сторінок словника, що є вкрай повільним). Hash-фунція на основі вхідної послідовності символів (текста чи слова) підраховує число. Якісна hash-функція буде генерувати числа особливим чином, якщо в тексті замінити бодай одну літеру число має змінитися кардинально, але визначальним є те що якщо на вхід подавати одну і ту ж саму послідовність число має залишитися незмінним. Таким чином після того як ваша послідовність символів потрапила у словничок, вам не потрібно гортати його сторінки для того щоб знайти необхідний ключ, ви підраховуєте хеш-функцію яка вам повертає номер сторінки де має знаходитись слово. Hash-функція отримала таку назву із-за дій що вона виконує над вхідними данними всередині себе. Фактично вона “кришить”, “рубає”, “перемішує”, “заплутує” вхідні данні, що відповідає англійському перекладу слова hash. Тобто логічним було б перекласти слово хеш у цьому контексті як “криш” або “міш”. Переклад слова “tag” вже здійснений, і це “мітка”, поєднавши ці варіанти отримаємо “кришмітка” що в одночас володіє певною милозвучністю.

“Кришітка” є спрощеним варіантом новотвору “кришмітка”, запропонованого Денисом Яремовим. Але має кілька суттєвих переваг: 1) Милозвучніше; 2) Відповідає етимології (криш-мітка); 3) І до того ж співзвучне з назвою самого символу # - “решітка”.

Знову захотілося писати Соломку українською мовою, просто щоб мати змогу використовувати слово “кришітка” :)

Taskwarrior

Removed the dependency from $SPRINT by simplifying basically everything in .zshrc:

s () {task s sprint.is:$(date +%-V) or sprint:c $*}

Downloading private youtube playlist using youtube-dl

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).

Youtube mildly interesting statistics

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.

English

kibble is store-bought dry (mostly) cat food. To kibble = ’to coarsely grind’. Found on Peter Watts’ The Kibble Fund

Nel mezzo del deserto posso dire tutto quello che voglio.