title: “Welcome to Jekyll!”

You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.

To add new posts, simply add a file in the _posts directory that follows the convention YYYY-MM-DD-name-of-post.ext and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.

Jekyll also offers powerful support for code snippets:

def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.

Check out the Jekyll docs for more info on how to get the most out of Jekyll. File all bugs/feature requests at Jekyll’s GitHub repo. If you have questions, you can ask them on Jekyll Talk.

Well, first of all, today I installed Jekyll and started writing this DTB :) I’ll be using the minimal vanilla theme, I don’t think I’ll need much more. This will be backed up in github, and in general I think it’s a win/win thing on all possible fronts.

Also today I’ll be reinstalling my Arch Linux, from a working arch Linux installation. I’ll be documenting here the process so I won’t have to google it for the third time later.

I’ll also (finally!) fix the following:

  • fix all my configs so that they are optimal and readable
    • especially the vim and i3 configs!
  • better keyboard layout with explicit ru/ua thing to make my life easier.
  • make the zsh statusbar count my taskwarrior todos by better tags. I’m currently using this excellent approach.

As I’m also learning Markdown, I’ll be using this as a reference.

Installing Arch from an existing installation

I needed to install arch-install-scripts; after this I mounted the filesystems and followed the Arch wiki pacstrap gethsemane_root base base-devel

After that, just the wiki without too many changes.

That was harder than expected. Sadly couldn’t document it as I was doing it.

Audio – install pulse, use it as a default device, otherwise ALSA will have problems playing sounds at the same time. Additionally, devices are hard. HDMI seems to be my new default device, changed that in /etc/asound.conf. I’m not even sure what exactly of what I did helped at this point, sadly.

pcm.!default {
    type plug
    slave.pcm {
        @func getenv
        vars [ ALSAPCM ]
        #default "hw:Generic"
        default "pulse"
    }
}
  • Moved i3 configs to .i3/
  • Needed to install gvim so that I’d have access to the system clipboard from vim.
  • Needed to add $HOME/.gem/ruby/2.5.0/bin' to my $PATH` in .zsh

Telegram adds a .desktop file after the first run based on where it is, so I had to change ~/.local/share/applications/telegramdesktop.desktop the lines TryExec and Exec.

Anki

Ankiweb extension: for Anki, AnkiConnect is needed, code 2055492159 + restart. It also seems to have it’s files not in .config like normal people, but .local/share/Anki[2]; copying them didn’t help to save the profiles. Ankiweb sync did.

Today at the beginning I set mediawiki up, another one, and talked to M re everything connected with it. Now I’m doing my internship report.

For this I had to install latex, the package is texlive-most, which amongst other things contains xelatex.

Mimetypes

Install perl-file-mimeinfo. After this, I could change the program to use as mimetype what.pdf.

Tmux

I’m learning to use tmux, just because why not. I hear it’s better than screen. (And lighter than my current solution of multiple terminator instances.).

Best and greates tmux.conf

<C-b> d from inside tmux to detact the current session; tmux attach-session -t tb for attaching the session tb, also works with numbers. Can be tab-completed.

Urxvt

Middle mouse button for pasting from primary, Ctrl+Meta(Alt?)+C/V for copypasting from clipboard. Uses .Xresources for config, and I’m using this one, it’s perfect.

Jekyll

Added a Categories page, using this guide.

Zsh prompt

Added the mod system from my calendar to my prompt, so I can see if the day divides cleanly by 3 5 10.

DAY=$(date +%j)
r=""
w=""
x=""

if (($DAY%3 == 0)); 
then r=1
fi
if (($DAY%5 == 0)); 
then w=2
fi
if (($DAY%10 == 0)); 
then x=5
fi

PROMPT="$SPRINT ["$r$w$x"] $addprompt $PROMPT"

which gives me a prompt like: 2 [1] !!! sh•~/hs/dt» first number is the sprint number, in square brackets are the mod bits, then number of unfinished taskwarrior tasks.

Used this bash conditionals primer as reference.

Quotes

Don’t plant at tree, plant an orchard. Source

Food

Made humus, following this basically recipe:https://www.bodybuilding.com/recipes/traditional-hummus. Next comes either bodybilder’s hummus or pesto hummus.

Reading

Rereading “Your rainforest mind”, reading “The Rime of the Ancient Mariner”.

Drawing

Colored one page of my calendar and made one simple lineart drawing. The time has come to learn to add pictures to Jekyll. For reference: ![Hummus](https://pchr8.net/d/dtb/assets/pics/hummus.jpg)

Hummus. d1. d2.

Github caching password

Using this guide:

git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600

Algo trading

Researched viability of it all, and got the impression that it doesn’t really make sense for me to get into it and that there are better ways to spend my time. Keep looking for ideas for other (but similar!) places where I can apply some of the approaches.

  • would it make sense to focus on individual stocks that can be directly connected to something external, that can both be analyzed?
  • can I find some more or less periodical stocs?
  • Can I find stocks which more-or-less correlate with something external and easy to analyse?

[This])https://www.oreilly.com/learning/algorithmic-trading-in-less-than-100-lines-of-python-code) is a nice intro.

Quotes

Fish don’t know they are in water

Keyboard layout

Realized that my Pchr8board layout uses only left alt as mod key, right alt stays as Alt and can be used for typical nice Alt-things like switching windows in tmux. TODO – still need to fix the tick. Or in the ideal world actually have one clean layout for two hands, one clean for one hand, separate Russian/Ukrainian ones and some kind of indicator, like the old one I wrote and forgot about.

Praktikumsbericht

Mostly writing my internship report.

Vim

To reload the .vimrc when you’re editing it, :so %.

Vocab

Staff meeting = Belegschaftversammlung
Data cleansing -> Datenbereinigung
Electric meter -> Stromzähler (m u. pl.)\ Пёстрый –> Zusammengewürfelt\ Die Einrichtung –> Institution, estabilishment\

Latex

Checkmark as per SO

\usepackage{tikz}
\def\checkmark{\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;} 
 

Kept working on my internship report.

Latex

for the % symbol: \% To use a simplier citation style, \bibliographystyle{unsrt}. For this I had to remove the package apacite. For using urls with underscores in Bibtex: \usepackage{hyperref}, and then howpublished = {\url{https://scikit-learn.org/stable/modules/outlier_detection.html}} for some reason worked for me, even though it shouldn’t have.

German

Die Prognose
How I divided them between X und Y –> Wie ich die zwischen X und Y aufteilte.
Abweichungswerte – deviation values

Kept working on my internship report, hopefully I’ll finish it today. % Also tried to clean up the code for the algotrading thingy to make it use much more pandas.

Latex

Comment in bibtex: no easy and compatible way to do it. (see this).
Page numbering:

\pagenumbering{arabic}

To insert a tilde (~): \textasciitilde

And in general:

abbr IEC Israel Electric Corporation
abbr SZ Stromzähler
abbr LF Lastprognose
abbr ML Maschinelles Lernen
abbr DB Datenbank
abbr AD Erkennung von Anomalien

Deutsch

km^2 = Quadratmeter = km$^2
Die Vergütung.
Anomaly Detection - die Erkennung von Anomalien.
verwenden
15 minute intervals -> 15-Minuten-Intervalls (auch “im Abständen von 15 Minuten”)
Month rhythm -> Monat__s__rhythmus.
basically -> im Gr__u__nde
plöTZLich, EinflUss, drUck, grOßes, wöchiges, regelmäßig, DatenschUtz.
reCHerCHiert, DiagraMM, Kategorie
“und dann habe ich wieder von vorne angefangen”
“fraghaft” existiert nicht, fragwürdig/flaglich
Eingabedatei, not Eingangdatei
Datei(f), Daten(pl)
draft -> der Entwurf

I seem to have a problem remembering where the Umlauts are. I’ll fix this with Anki. Should’ve started doing it a long time ago.

Vim

yank word: yaw. (Not inner, the entire thing, with all eventual paretheses etc.)
Rechschreibung: pacman -S vim-spell-de, after this :setlocal spell spelllang=de_de
Here are the important commands.

]s Gehe zum nächsten falschen Wort
[s Gehe zum vorherigen falschen Wort
zg Fügt das Wort unter dem Cursor dem Wörterbuch hinzu, das in der Variable spellfile steht.
zw Fügt das Wort als falsch der Wörterbuchdatei aus der spellfile-Variable hinzu
z= Bietet eine Auswahl von Korrekturvorschlägen an \

I added: map zr z=1<CR>, so now zr replaces the word under cursor with the first variant suggested. I love vim for the ability to do this.

Latex

Picture with caption:

\captionsetup[figure]{labelfont={bf},name={Bild.},font={small}, labelsep=period}

\begin{figure}[h]
\centering
\includegraphics[width=0.45\textwidth]{data/lstm-structure.png}
\includegraphics[width=0.45\textwidth]{data/lstm-1.png}
\caption{One-point-ahead prediction mit zwei LSTMs.}
\end{figure}

Getting ready for DT Exam. To add all the chapters to taskwarrior, I made a textfile with one todo point per line, and then

while read p; do 
    t add project:HS.dt.pr  "$p"
done <dt_plan 

(See this SO answer)

Anki

Installed anki-vim. anki-vim DECKNAME, it created cards in ~/.anki-vim/decs/DECKNAME, that can be imported later from Anki.

I added to vim:

" For anki-vim math equation latex
abbr nla [$][/$]<esc>hhhi
abbr nbr \overline{}<esc>i

I needed the “allow HTML in fields” option during import. Also I learned that \cdot whatever needs a space, \cdotwhatever gets parsed as one control sequence. Was that always like this?

The multiplicative dot it latex is \cdot, for the math tilda \sim works. For the crossed out Antivalenz thingy, \not\sim.

\bar{a} and \overline{a} look very similar, which one to use is a philosophical question. I liked the answer here:

Semantically, don’t use either. Use \conj, or \mean, or \variant or whatever the overline is meant to mean. Then in your preamble, do: \newcommand*\conj[1]{\bar{#1}} \newcommand*\mean[1]{\bar{#1}}

Then: Your document source becomes readable: you can determine the meaning right there and then. Your document becomes more flexible: if you decide to denote complex conjugation by a star instead you can simply redefine \conj without worrying about changing what \mean does. You can change from \bar to \overline on a whim and don’t have to make that crucial decision now.

I also liked:

“All problems in computer science can be solved by another level of indirection” – Mats Sep 11 ‘16 at 16:28

Lastly: overline seems semantically and mathematically more meaningful, bar works like “just another thing”, not for conjugation/whatever.

Linux

cat /proc/cpuinfo for basic info about the specs of a computer. Also opening videos in Telegram is a bad idea, especially HD ones, opening them from VLC from the download folder works much better. also dmidecode -t 17 looks better.

Cooking

Made Champignons in the oven. Take Champignons, add oil, salt and pepper (less than I thought I needed), and put at 200C for 30 minutes.

HTTP

For redirects, this works.

<script type="text/javascript">
    window.location = "http://google.com";
</script>

CLI

curl http://passwordedsite.com/secret -u USER or curl http://htaccesspasswordedsite.com/secret -u USER -p PASSWORD

Read 200+ pages of “Zen and the Art of Motocycle Mainenance” and drew a nice picture. After that went to Leipzig.

Latex

Kept modifying my calendar and learning LaTex on the way.

Function with multiple arguments

Function with two arguments:

\newcommand*\RN@formatDayNbWithMod[2]{
    % and inside use #1 #2 as usual
}

Phantoms and phantoms in math

A phantom is a symbol which has the width/height/dephts of a symbol but doesn’t print it. I use it to keep my weekdays in the calendar aligned.

From here:

  • \hphantom (horizontal phantom) inserts an empty box that has zero height, zero depth, but the width of its argument.
  • \vphantom (vertical phantom) inserts an empty box that has the height and depth of the argument, but zero width.
  • \phantom inserts an empty box with the same dimensions (horizontal as well as vertical) as the argument.

To use it in math environment, I needed to put it inside another pair of {}s:

  \ifthenelse{\thepeName=0}
  {\RN@dayNbFont$#1^{\phantom{0}}$\hspace{50\RN@xunit}}
  {\RN@dayNbFont$#1^\arabic{peName}$\hspace{50\RN@xunit}}

And here’s a nice discussion about what does width/height/depth mean in Latex.

Commands inside commands

Use ##1 if #1 is taken by parent. See here. Needs to be done also when parent command does not take arguments!

\newcommand{\abc}[1]{joy, oh #1!%
  \newcommand{\ghi}[1]{gloom, oh ##1!}%
}

Simple math

Needed to increase weeday by one, so that 0 is Sun. From this SO answer. Here I also compared #3 to 6, so I get a 0 instead of a 7.

    \ifthenelse{\equal{#3}{6}}{\the\numexpr#3-6\relax}{\the\numexpr#3+1\relax}

DNB

I think I found a website to replace my old favourite one. Now brainscale.net will be my main DNB one.

Speaking of which, today’s results:

d3b 43% Mon 21 Jan 2019 09:51:05 AM CET
d3b 50% Mon 21 Jan 2019 09:52:05 AM CET
d3b 64% Mon 21 Jan 2019 09:54:38 AM CET
d3b 64% Mon 21 Jan 2019 09:56:19 AM CET
d3b 21% Mon 21 Jan 2019 09:59:19 AM CET
d3b 33% Mon 21 Jan 2019 10:00:17 AM CET
d3b 7% Mon 21 Jan 2019 10:05:15 AM CET ???
d3b 64% Mon 21 Jan 2019 10:07:17 AM CET

DT

Found these beautiful slides by some professor. It’s fascinating how the slides themselves are interactive.

Which by the way reminds me of MarkDeck, which allows to make presentations as code in whatever editor and which imo has a lot of potential for me. I’ll look through it later.

DNB

d3b 57% Tue 22 Jan 2019 12:28:10 PM CET
d3b 57% Tue 22 Jan 2019 12:30:10 PM CET
d3b 50% Tue 22 Jan 2019 12:32:10 PM CET
d3b 50% Tue 22 Jan 2019 12:33:10 PM CET

Scratchbox/stack

Add to Anki \wedge \vee and other latexy things I’ve used. Add to anki formulas without commentaries, which work both sides.

Check how can I transform O in Firefox to open in the same tab

Possibly add the Glossary COICOP numbers to anki?

Add “personal” anki deck where I’ll focus everything important but sensitive.

Finances

Money is, at its essence, that measure of a man’s choices. (As quoted here).

First of all, I’m gathering resources to do it all systematically. So far the plan is:

Think about which books to read, possible variants:

  • 4-hour-workweek
  • The book from Deutsche bank about investing.

At the same time, parallelly to the above:

  • Make finally a budget and stick to it
  • Save X $currency per month
  • Build the needed liquidity
  • At the same time start slowly investing into stocks

In general, for less actionable steps:

  • Look into diversifying income

In february maximally stick to a budget and learn finances.

Resume

Added the new experience I forgot to add; very glad I could keep it still one page long.

TODO: Possibly change the template to make it less hack-y.

DNB

Scratchbox/stack

  • T P.HP Find something to do with the Scratchbox at the end of each day? All three of them
  • T h.it Add my vim spellcheck files with my custom words also to my dotfiles repo.
  • T connect https://de.wikipedia.org/wiki/Lastprognose with its English article about Load Forecasting;
  • add aliases for zsh and basic taskwarrior tasks. t 123 start -> tws 123

Latex

\& istead of &, like with \%.

German

Again spellchecking everything, later will anki-fy this.

  • Abschlüss -> Abschluss
  • Nationale Technische Universität „Kiewer Polytechnisches Institut Ihor Sikorskyj“
  • interdisziplinär
  • Load Forecasting -> Lastprognose

PDF

Pdfunite is part of poppler. pdfunite in-1.pdf in-2.pdf in-n.pdf out.pdf

Vim

Decided to map my insert mode things to +whatever, started with this suboptimal way to insert the date: `imap d :put =strftime('%c')kJA`

Python

For progress bars:

from tqdm import tqdm
for i in tqdm(my_list):

Productivity

A match made in heaven. http://www.infinitelooper.com/ is my new favourite website.

Zsh

Added alias for anki-vim as av.

Reading

Taskwarrior

Added never-ending tasks like cleaning as the first numbers, so I can still track the time. To give them ids 1 and 2 etc., I moved them to the top of ~/.task/pending.data. I might consider making a patch so that it’s less of ahack? Or – even better – just scripts that interface with timewarrior with taskwarrior out of the picture completely?

Jupyter/markdown

  • Bulletpoints are one asterisk
    • sub-bullet-points are +
* Bulletpoints are one asterisk
    * sub-bullet-points are <tab>+*

Scratchbox/stack

  • I should make a better way to track repetitive tasks like cleaning with timewarrior. A bash script, prolly? Like track cl or sth similar.
  • Create a day when I go through the scratchbox and paste it somewhere - let’s make it to a particular page on this DTB, and let’s make it wednesday.
    • but ideally recheck it once a day
  • Add to my statusline on the big screen the output of timew for th ecurrent “Tracking”.
    • DONE
  • Add a zsh command to make it easier to create new Jekyll posts, with correctly formatted name and content. I’m surprised that I have not found anything similar, it’s prolly there, but I haven’t looked enough.
    • DONE!
  • Fix dates in all posts – the ones inside the header, not the name
    • DONE!
  • add tags for not-work and deep-work to Taskwarrior, to better track time for clean work and various cleaning/social/lunch/whatever stuff.
  • Calendar – add the symbols in a maximally configurable way instead of directly into tikz-kalender.cls
    • DONE ?
  • How does \ifdate work inside tikz calendar, it’s like a globally defined command? Interesting I didn’t get that before.

German

  • die Zahnbürste

Sport

I will be doing the Stronglifts 5x5 program in February! Should also read this. And follow the drink a lot of milk calorie gain thing.

Timewarrior

  • For tasks with parentheses, they need to be escaped \(like this \), so that they don’t conflict with zsh.
    • Speaking of which, what do they conflict with?
  • I should finally remember that it’s shorten @1 20min for timew, and 20m for utimer. I think it’d be easier to fix utimer than timew – I need to make them identical either way. I guess hypothetical TODO for later.

Scratchbox/stack

  • I should learn the names of the German letters: https://de.wikipedia.org/wiki/Deutsches_Alphabet#Benennung_der_Buchstaben.
  • Learn bash/zsh parentheses – what do they do exactly.
  • I could make a specific i3wm-config for when I want to do Deep Work in Cal Newport’s meaning of the word? With different background and only two workspaces or something like this. Bonus points if I can switch to it dynamically.
  • T add the dynamic font size change perl addon to urxvt
  • I should make two different kinds of Scratchboxes – the ones which are time-sensitive and ones that are not.
    • And I should learn to ignore thoughts which are inconsequential and not with no chance to ever be acted on.
  • Add to my timer the ability to do “tm 15:00” or something.

Deutsch

  • der Pfad - die Pfade -> trails/paths
    • abseits ausgetretener Pfade – off the beaten track
    • TODO Ankify this
  • Not Synchronizität, Synchronität. (at least in Schaltungstechnik).

Mediawiki

  • [[File:File.jpg]] to use the full version of the file
  • [[File:File.png|200px|thumb|left|alt text]] to use a 200 pixel wide rendition in a box in the left margin with “alt text” as description
  • [[Media:File.ogg]] for directly linking to the file without displaying the file

copied directly from the Special:Upload page.

Jekyll

If I make a post’s date in the future it will not appear until then? TODO research how does it work.

Scratchbox/stack

  • I need a way to finally organize all the things I finally want to (invest time to) learn. I seem to lose quite a lot. I need something more formal than my link wiki for this, I think. Or just change how I use it.
  • Add to TW a planned-due field! As opposed to the real-deadline.
    • Add to TW and create a system for some tasks for the year in the respective sprints, like change toothbrush every 3 month. Things with >1m periodicity.
  • Add zsh aliases for compiling & uploading this Jekyll blog.
    • DONE
  • And finally fix the public and private keys

XKB Fun

Modified the default Russian layout to make it also Ukrainian at the same time:

default  partial alphanumeric_keys
xkb_symbols "winkeys" {

    include "ruua(ruua)"
    name[Group1]= "Russian";

    key <AE03> { [           3,  numerosign  ] };
    key <AE04> { [           4,   semicolon  ] };
    key <AE05> { [           5,     percent  ] };
    key <AE06> { [           6,       colon  ] };
    key <AE07> { [           7,    question  ] };
    key <AE08> { [           8,    asterisk, U20BD  ] };

    key <AB10> { [      period,       comma  ] };
    key <BKSL> { [   backslash,       slash  ] };
};

hidden partial alphanumeric_keys
xkb_symbols "ruua" {

    key <AE01> { [           1,      exclam  ] };
    key <AE02> { [           2,    quotedbl  ] };
    key <AE03> { [           3,  numbersign  ] };
    key <AE04> { [           4,    asterisk  ] };
    key <AE05> { [           5,       colon  ] };
    key <AE06> { [           6,       comma  ] };
    key <AE07> { [           7,      period  ] };
    key <AE08> { [           8,   semicolon  ] };
    key <AE09> { [           9,   parenleft  ] };
    key <AE10> { [           0,  parenright  ] };
    key <AE11> { [       minus,  underscore  ] };
    key <AE12> { [       equal,        plus  ] };
    key <BKSL> { [   backslash,         bar  ] };

    key <AB10> { [       slash,    question  ] };
    key <LSGT> { [       slash,         bar  ] };

    key <TLDE> { [       Cyrillic_io,	apostrophe,	U02BC,       Cyrillic_IO  ] };
    key <AD01> { [   Cyrillic_shorti,   Cyrillic_SHORTI  ] };
    key <AD02> { [      Cyrillic_tse,      Cyrillic_TSE  ] };
    key <AD03> { [        Cyrillic_u,        Cyrillic_U  ] };
    key <AD04> { [       Cyrillic_ka,       Cyrillic_KA  ] };
    key <AD05> { [       Cyrillic_ie,       Cyrillic_IE] };
    key <AD06> { [       Cyrillic_en,       Cyrillic_EN  ] };
    key <AD07> { [      Cyrillic_ghe,      Cyrillic_GHE  ] };
    key <AD08> { [      Cyrillic_sha,      Cyrillic_SHA  ] };
    key <AD09> { [    Cyrillic_shcha,    Cyrillic_SHCHA  ] };
    key <AD10> { [       Cyrillic_ze,       Cyrillic_ZE  ] };
    key <AD11> { [       Cyrillic_ha,       Cyrillic_HA  ] };
    key <AD12> { [ Cyrillic_hardsign,	Cyrillic_HARDSIGN,	Ukrainian_yi,	Ukrainian_YI] };

    key <AC01> { [       Cyrillic_ef,       Cyrillic_EF  ] };
    key <AC02> { [     Cyrillic_yeru,     Cyrillic_YERU,	Ukrainian_i,	Ukrainian_I] };
    key <AC03> { [       Cyrillic_ve,       Cyrillic_VE  ] };
    key <AC04> { [        Cyrillic_a,        Cyrillic_A  ] };
    key <AC05> { [       Cyrillic_pe,       Cyrillic_PE  ] };
    key <AC06> { [       Cyrillic_er,       Cyrillic_ER  ] };
    key <AC07> { [        Cyrillic_o,        Cyrillic_O  ] };
    key <AC08> { [       Cyrillic_el,       Cyrillic_EL  ] };
    key <AC09> { [       Cyrillic_de,       Cyrillic_DE  ] };
    key <AC10> { [      Cyrillic_zhe,      Cyrillic_ZHE  ] };
    key <AC11> { [        Cyrillic_e,        Cyrillic_E,	Ukrainian_ie,	Ukrainian_IE] };

    key <AB01> { [       Cyrillic_ya,       Cyrillic_YA  ] };
    key <AB02> { [      Cyrillic_che,      Cyrillic_CHE  ] };
    key <AB03> { [       Cyrillic_es,       Cyrillic_ES  ] };
    key <AB04> { [       Cyrillic_em,       Cyrillic_EM  ] };
    key <AB05> { [        Cyrillic_i,        Cyrillic_I,	x,	playpause] };
    key <AB06> { [       Cyrillic_te,       Cyrillic_TE  ] };
    key <AB07> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN  ] };
    key <AB08> { [       Cyrillic_be,       Cyrillic_BE  ] };
    key <AB09> { [       Cyrillic_yu,       Cyrillic_YU  ] };

    include "kpdl(comma)"
};

Also in the file /usr/include/X11/keysymdef.h is the list of all possible keys to assign.

Cooking

Couscous! Here is how to cook and ideas.

Also champignons in the oven.

Scratchbox/stack

  • More ideas for xkb fun:
    • In vim, make nice shortcuts for usual things I use based on the mod/alt key or the Alt+F2
      • DONE
  • Why did the .html file extension survive better than .htm, but the same didn’t happen for .jpeg?

Today I’ll get my mechanical keyboard <3

Deutsch

  • Finally figure out bzw.

Scratchbox/stack

  • Should I find a way to synchronize all my stacks? TG+T+Jekyll+…
    • Probably not
  • Vim – add a way to delete things without it going to the y-regester
    • "_d does this through the black hole register!

Random / news

I discovered https://hckrnews.com/, its “top-10%” setting is awesome.

Scratchbox/stack

  • Finally learn English apostrophes
  • It would also be interesting sometime later to analyze the words used in these entries

Quotes

I feel like being obsessed with anything automatically makes it unattainable. It’s like the universe saying, “ you’re not behaving in a healthy way so you have not earned it being yours.” Its a handy way to keep myself in check. (Reddit.

German

Finally figure out the Unterschied between the words Unterschied u. Unterschiedlichkeit From this German StackExchange answer:

  • Anders
    • Only word that works alone, without saying different from what
    • Der Hund is anders; der andere Hund.
  • Unterschiedlich
    • An important but small attribute that makes things different that you want to accentuate:
      • Wuffi und Kläffi sind unterschiedlich. Sie unterscheiden sich an den Ohren: Wuffi hat Stehohren, Kläffi hat Schlappohren.
  • Verschieden
    • Just different, without any specifics.
      • Natürlich sind Kläffi und Törti verschieden! Es sind schließlich verschiedene Rassen!

Not from dict.cc, but from my intuition:

  • die Unterschiedlichkeit – the difference in a more abstract meaning.
  • der Unterschied – the difference – especially one in particular.

Mechanical keyboards

Here are tips on how to improve ergonomics for better typing speed and comfort. TL;DR raise my wrists and lower my table/keyboard till I get a >90C angle.

Typing

https://www.typingclub.com/sportal/program-3/328.play has a Dvorak layout!

Scratchbox/stack

  • it would be interesting to make a static structure for these entries. And then make a template for them, with the right name/date/…
    • DONE! Made a script for this.

Interesting stuff for later

Stenography! With plover and this tutorial. It’s what I was trying to do but much much better on so many levels. The world is a really fascinating place. Installed plover, I will definitely play with it later. “Steno Hero” also exists.

Scratchbox/stack

  • Why does Telegram open files in different programs than Telegram? Look again into xdg and the different mechanisms for this.
  • I should try to make a Rührei sometime.
  • And at this point I think I should remove the ‘purely technical’ part from the blog description, since until now there was more cooking than solved technical problems.
    • DONE
  • I should buy a garment steamer! Dampfglätter

DNB and typing

  • d3b 43% Thu 31 Jan 2019 08:36:05 AM CET
  • d3b 36% Thu 31 Jan 2019 08:40:41 AM CET

  • 87 WPM 97.2%
  • 96 WPM 98.7%
  • 101 WPM 98.5%

Bash

Updated my timer script, now it outputs the time when the timer was set along with the reminder.

tm() {
    local N="$1"; shift
  (utimer -c > ~/s/sounds/outbash $N && mpg123 -q ~/s/sounds/tib.mp3  &
      zenity --info --title="Time's Up" --text="${*:-BING} \n\n $(date +'%H:%M:%S %d/%m')")
}

\n for the newline, $() to insert command output in variable (though if I understand right backticks would have also worked), and date’s format because I will probably remember the year.

EDIT Doesn’t output the date when the timer was set, only when executed :C Need to move it to its own variable, I gues TODO for tomorrow. EDIT2 DONE!

tm() {
    local DATE=$(date +'%H:%M:%S %d/%m')
    local N="$1"; shift
  (utimer -c > ~/s/sounds/outbash $N && mpg123 -q ~/s/sounds/tib.mp3  &
      zenity --info --title="Time's Up" --text="${*:-BING} \n\n $DATE")
}

Python

The googletrans python module uses Google Translate’s web api to translate text. Look extremely useful, I should make a small CLI script for this. I seem to translate random stuff quite often.

Deutsch

  • der ZAhler — whoever pays. Der ZÄhler — counter.

Quotes

Good ol’ alternative productivity. Getting lots of stuff done, but nothing important. Reddit

Digitaltechnik exam finished!

Here’s a really nice burndown about the states of every single project in the history of humanity:

Burndown.

Aaand after a short downtime we start again! Today I will be reviewing again all the basics of Python OOP and playing with some game theory by programming a simple simulator, having open the PEP 8 — Style Guide, and focusing on not bottoming-out my keyboard keys.

Python

  • Ankify import random and randInt(x, y)
  • This is how __init__ and inheritance work in Python.

Scratchbox/stack

  • How does the apropos thing work? Do I need to create a database for it? I think it worked out of the box before.
    • I needed to run mandb as root, and apparently need to do it every time a enew man page is added

Scratchbox/stack

  • I need to find a way to look through / grep all these files for when I need something. I’m sure I can grep through multiple files, but if not I can just make a make-script which concatenates them all before “compiling” and sending to server?
    • Fzf?

Typing and DNB

DNB

d3b 43% Thu 07 Feb 2019 09:12:29 AM CET
d3b 36% Thu 07 Feb 2019 09:12:29 AM CET
d3b 14% Thu 07 Feb 2019 09:12:29 AM CET
d2b 75% Thu 07 Feb 2019 09:12:29 AM CET <- D2B! I'll keep working on it until I get 80% again on this.
d2b 92% Thu 07 Feb 2019 09:19:01 AM CET <- OKAY!
d3b 42% Thu 07 Feb 2019 09:21:04 AM CET
d3b 14% Thu 07 Feb 2019 09:22:56 AM CET
d3b 79% Thu 07 Feb 2019 09:26:03 AM CET <- Nicee!

It’s so interesting how wildly different and unpredictable it is. I should try doing 20 minutes and seeing how much time do I need to concentrate on it.

Typing

Will keep tracking it on Typeracer.

93 WPM 	98.5% 	174 	1/5 
87 WPM 	97.2% 	130 	4/5 
87 WPM 	97.0% 	69 	3/5

Finances

I’ll give ledger another try, I’m not sure why I stopped – it had been working out pretty well.

Added again the nice aliases
alias le="ledger -f ~/s/l/ledger.txt --strict"

alias l="vim ~/s/l/ledger.txt"

Downloading files with wget

Savefrom.net has a Firefox addon. I needed to disable various tracking stuff in configs, and let it generate my 7000+ links from the album. Then I’m trying to download them from the file via the following command: wget -i urls1000 -U "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0" --wait=1 --random-wait --limit-rate=2000k --rejected-log=rejected

wget -i inputfile downloads the urls in the file, everything else is me trying not to get banned by the server. Let’s see if it works out.

Linux

du

Here I learned about du. sudo du -h -d 1 shows the size of the directories in the folder (depth of one, human-readable).

Borg

Borg is an awesome backup program which allows to do most of what I need, the link is the quickstart guide.

sshfs

Is a really neat way to access remote hosts’ folders.

Extracting tar to a specific directory

tar xf file.tar --directory /path/to/directory, the --directory option, as per man tar, is

-C, –directory=DIR Change to DIR before performing any operations. This option is order-sensitive, i.e. it affects all options that follow.

SSH executing remote commands

ssh user@host 'echo "test">> test;'. More examples here

Mysqldump

An excellent way to back it up. If it’s local, one way to do it:

name=$(date '+%Y%m%d_%H%M%S')
mysqldump --all-databases >> "arith-mysql-$name.sql"

Also specifically for nfs, ssh yourname_yoursite@ssh.phx.nearlyfreespeech.net mysqldump --user=youradminusername --password=yourpassword --host=yourprocess.db | gzip >backup-yourprocess-20120627.sql.gz is mentioned on their FAQ

Scripts I’ve written

… will be described in a separate post.

Goals for today:

  • learn the number line on the keyboard
  • see what I want to do with my domains and projects
  • Finish my backup system, and do one big backup of everything
  • look at my steno thing and decide what I want to do with it
  • ssh keys for everything
  • finish the basic 3 stones game bot thing, especially the turns part
  • clean everything old and unneded from pchr8.net, to make backups easier and to save money

  • Download maximum audios and videos from my VK accounts
  • move my blog to jekyll?

Linux

Jekyll new post creation

Okay, the first nice thing that happened today is that I finally automated creating new Jekyll posts! Behold create.sh:

FILE=$(date +%Y-%m-%d)-day$(date +%j).markdown
DATE=$(date +%Y-%m-%d\ %H:%M:%S\ +0100)
echo "Creating file $FILE"
touch $FILE
echo "Adding stuff"

/bin/cat <<EOM >$FILE
date:   $DATE

### Bash and zsh wildcards
From [this SO answer](https://serverfault.com/questions/47933/how-to-delete-all-hidden-files-and-directories-using-bash) I learned that bash and zsh treat wildcards differently:
> With zsh by default an empty wildcard match is treated as an error; whereas with bash it is simply passed unchanged. To make zsh behave the same way you can use the command unsetopt nomatch 

## Stack

## DNB and Typing

Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].

[jekyll-docs]: https://jekyllrb.com/docs/home
[jekyll-gh]:   https://github.com/jekyll/jekyll
[jekyll-talk]: https://talk.jekyllrb.com/
EOM

Bash backup scripts

And while we’re at it, here are some of my yesterday’s backup scripts:

echo "=== Backing up NFS... ==="
echo "= SQL... ="
name=$(date '+%Y%m%d_%H%M%S')

ssh pchr8_pchr8@ssh.phx.nearlyfreespeech.net "mysqldump --all-databases --user=XXX --password=XXX4 --host=XXX > pchr8_mysql_backup_$name.sql
echo "Moving it to its location..."
mv pchr8_mysql_backup_$name.sql ../all/pchr8/db
echo "SQL done."
#echo "Making a tar archive of everything..."
#ssh pchr8_pchr8@ssh.phx.nearlyfreespeech.net "cd /home/public; tar cf " > pchr8_mysql_backup_$name.sql
echo "starting backup!"
echo "Creating mysql dump:"
name=$(date '+%Y%m%d_%H%M%S')
mysqldump --all-databases >> "arith-mysql-$name.sql" 
echo "created!"
echo "adding stuff to the borg thing"
borg create /path/to/backups/arith_borg_repo::arith_complete-$name /var/www arith-mysql-$name.sql /etc/apache2/ 
echo "creating archive"
tar cf arith_repo.tar.gz arith_borg_repo/
echo "archive created!"

Stack / Random

  • Do this for my remappings instead of xmodmap
  • At the end of the day I should really make a more optimal search through this blog.
  • Should I learn by heart the COICOP, just for fun? Memory palaces + anki?

DNB and Typing

Changed my startup xkb line to setxkbmap -option -option 'compose:rctrl, grp:rwin_toggle' umlauted,ruua so I still get the right Shift which I can learn to use!

Also I really like typingclub.com, and the next couple of days will try to force myself to type right, with the correct Shift, without bottoming out my keys, and typing the numbers and special symbols without looking and with the right finger. Also not forgetting about posture and the right position of my hands.

Quotes

“I don’t count my situps, I only start counting when it starts hurting, when I feel pain, that’s when I start counting, cause that’s when it really counts.” -Muhammed Ali (As quoted by Arnold Schwarzenneger in his speech)

Also from that same speech:

People perform better when they have no safety net

English

Sedition is overt conduct, such as speech and organization, that tends toward insurrection against the established order.

Finished “Old Mariner’s ballad”!

Read a number of pages of La Divina Commedia in a format that TIL is called bilingual parallel text, Italian and 1910s-German. It was absolutely fascinating on all possible levels..

Then I painted some random Gothic letters after getting inspired by the German Font the book. Gotic letters, yay!.

Vim plugins

In this blog post I discovered an excellent new plugin I really like: Easymotion. I’ll make an effort to use it as much as possible the next couple of days to learn it as much as possible with my mechanical memory. It’s absolutely brilliant.

Main bindings:

    Default Mapping      | Details
    <Leader>f{char}      | Find {char} to the right. See |f|.
    <Leader>F{char}      | Find {char} to the left. See |F|.
    <Leader>t{char}      | Till before the {char} to the right. See |t|.
    <Leader>T{char}      | Till after the {char} to the left. See |T|.
    <Leader>w            | Beginning of word forward. See |w|.
    <Leader>W            | Beginning of WORD forward. See |W|.
    <Leader>b            | Beginning of word backward. See |b|.
    <Leader>B            | Beginning of WORD backward. See |B|.
    <Leader>e            | End of word forward. See |e|.
    <Leader>E            | End of WORD forward. See |E|.
    <Leader>ge           | End of word backward. See |ge|.
    <Leader>gE           | End of WORD backward. See |gE|.
    <Leader>j            | Line downward. See |j|.
    <Leader>k            | Line upward. See |k|.
    <Leader>n            | Jump to latest "/" or "?" forward. See |n|.
    <Leader>N            | Jump to latest "/" or "?" backward. See |N|.
    <Leader>s            | Find(Search) {char} forward and backward.
                         | See |f| and |F|.

(from :help easymotion) title: “Day 042: "A project manager’s lessons learned"; vim” date: 2019-02-11 10:35:35 +0100

Linux

Improving performance on the Arch wiki has nice ideas. hdparm -t /dev/sdX to measure read speed.

I will later possibly go through the entire page methodically.

DNB and Typing

Typing

typing.com has nice lessons about typing numbers, which I like a bit more than EdClub’s. Next up their advanced symbols to finally learn using the right Shift.

DNB

d3b 21% Mon 11 Feb 2019 12:13:52 PM CET
d3b 43% Mon 11 Feb 2019 12:17:04 PM CET
d3b 57% Mon 11 Feb 2019 12:18:47 PM CET
d3b 71% Mon 11 Feb 2019 12:20:35 PM CET
d3b 21% Mon 11 Feb 2019 12:22:25 PM CET

Python

Decided to read Dive into Python to finally get a systematic understanding of all of the language.

The most important audience for your code is yourself, six month after writing it.

  • Float is accurate to up to 15 decimal places. Why there are more on my system?
  • Why is the “//” operator working like it does with positive/negative numbers?

Vim

Limelight.vim is a really cool plugin. Found it linked here

Interesting

Nasa’s 128 lessons of a project manager. Highlights:

None of these are original–It’s just that we don’t know where they were stolen from!

  1. Wrong decisions made early can be salvaged, but “right” decisions made late cannot.
  2. Never make excuses; instead, present plans of actions to be taken.
  3. One of the advantages of NASA in the early days was the fact that everyone knew that the facts that we were absolutely sure of could be wrong
  4. If you have a problem that requires the addition of people to solve, you should approach recruiting people like a cook who has under-salted, i.e., a little at a time. 25 Know the resources of your center and if possible other centers. Other centers, if they have the resources, are normally happy to help. It is always surprising how much good help one can get by just asking.
  5. Redundancy in hardware can be a fiction. We are adept at building things to be identical so that if one fails, the other will also fail. Make sure all hardware is treated in a build as if it were one of a kind and needed for mission succes
  6. It is mainly the incompetent that don’t like to show off their work.
  7. Mistakes are all right, but failure is not. Failure is just a mistake you can’t recover from; therefore, try to create contingency plans and alternate approaches for the items or plans that have high risk.
    • Here it’s quite interesting how you have two different attitudes to plan-B. I guess the more costly failure is, the more okay Plan-Bs are considered.
  8. NASA Management Instructions (NMI’s) are written by another NASA employee like yourself; therefore, challenge them if they don’t make sense. It is possible another NASA employee will rewrite them or waive them for you.
  9. A working meeting has about six people attending. Meetings larger than this are for information transfer.
  10. All problems are solvable in time, so make sure you have enough schedule contingency– if you don’t, the next project manager that takes your place will.
  11. Just because you give monthly reports, don’t think that you can abbreviate anything in a yearly report. If management understood the monthlies, they wouldn’t need a yearly.
  12. Sometimes the best thing to do is nothing. It is also occasionally the best help you can give. Just listening is all that is needed on many occasions. You may be the boss but, if you constantly have to solve someone’s problems, you are working for him.
  13. Remember, it is often easier to do foolish paperwork than to fight the need for it. Fight only if it is a global issue which will save much future work.
  14. You cannot watch everything. What you can watch is the people. They have to know you will not accept a poor job.
  15. The first sign of trouble comes from the schedule or the cost curve. Engineers are the last to know they are in trouble. Engineers are born optimists.
  16. There is no greater motivation than giving a-good person his piece of the puzzle to control but a pat on the back or an award helps.
  17. Don’t assume you know why senior management has done something. If you feel you need to know, ask. You get some amazing answers that will dumbfound you.
  18. If you have someone who doesn’t look, ask, and analyze, ask them to transfer.
  19. There are still some individuals who think important decisions are made in meetings. This is rarely the case. Normally, the decision-makers meet over lunch or have a brief meeting to decide the issue and than (at a meeting called to discuss the issue) make it appear that the decision is made as a result of this discussion.
  20. In political decisions, do not look for logic – look for politics.
  21. In dealing with international partners, the usual strategy is to go 1 day early, meet with your counterpart, discuss all issues to be brought up at a meeting, arrive at an agreeable response (or a decision to table the issue for later discussion), and agree not to take any firm positions on any new issues brought up at the meeting. This makes it appear to the rest of the world that you and your counterpart are of one mind and that the work is in good hands. All disputes are held behind closed doors with the minimum number of participants.
  22. Too many people at Headquarters believe the myth that you can reduce the food to the horse every day till you get a horse that requires food. They try to do the same with projects which eventually end up as dead as the horse.

Although it’s not part of Jerry’s written Lessons Learned, he consistently told his people the following (unwritten lesson):

“Show up early for all meetings; they may be serving doughnuts”

Finally, Les Meredith (former Director of Space Sciences and Acting Center Director) had this remark to make about Jerry Madden’s 128 Project Managers’ Lessons Learned:

“God only gave us Ten Commandments. Jerry has listed over a hundred instructions for a Project Manager. It is evident a lot more is expected from a Project Manager”

Deutsch

sich mit etw.(Dat) befassen: undertake/concert/deal/occupy/dabble in/with/whatever

Places

https://foursquare.com/v/true-burger-bar/52b02c4211d241652e021bdf – True Burger Bar in Kyiv

Stack

Add all the new English and German vocabulary to anki, finally.

DNB and Typing

I BROKE MY TYPING RECORD!!1111111111

(Can jekyll and/or vim do smileys? Apparently it can if you enter the Unicode value of the emoji directly

Test:

😊

WOOOOOOOHOOOOOOO

Also I still can just paste them.

Okay, then behold.)

✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈✨✨✨🌈✨✨✨✨✨🌈🌈🎊🎊🎊🎊🎊🎉🎊🎊🎉🎉🎉✨✨🔥🌈🌈

I still have no idea how that happened, but it’s quite interesting. We’ll see if and how that continues.

Race #  Speed   Accuracy    Points  Place   Date
83  119 WPM     99.5%       75      2/5     today   
82  87 WPM      97.7%       113     1/2     Feb. 8, 2019    
81  93 WPM      98.5%       174     1/5     Feb. 7, 2019    
80  87 WPM      97.2%       130     4/5     Feb. 7, 2019    
79  87 WPM      97.0%       69      3/5     Feb. 7, 2019    
78  101 WPM     98.5%       119     2/5     Jan. 31, 2019   
77  87 WPM      97.2%       102     2/5     Jan. 31, 2019   

Vim

And again, for unicode characters inside vim: <C-v>U1F60A<esc>

Also, for the table above, to make it align right, I had to change the tabs to spaces. Select and :retab.

Stack

DNB and Typing

I broke my record of all my life and got 93%! Something is definitely happening in my brain. I like this.

    d3b 64% Wed 13 Feb 2019 07:41:58 AM CET
    d3b 93% Wed 13 Feb 2019 07:43:57 AM CET
    d3b 71% Wed 13 Feb 2019 07:47:46 AM CET
    d3b 71% Wed 13 Feb 2019 07:52:30 AM CET
    d3b 57% Wed 13 Feb 2019 07:54:06 AM CET
    d3b 57% Wed 13 Feb 2019 07:55:41 AM CET
    d3b 71% Wed 13 Feb 2019 07:57:31 AM CET
    d3b 79% Wed 13 Feb 2019 07:59:41 AM CET

i3wm

Changed date string in statusbar to show also the week/sprint number and weekday:

tztime local {
        format = "[%U] %a %Y-%m-%d %H:%M:%S"
}

Moving my Wordpress to Jekyll

… since I started disliking the new Wordpress interface and stopped using it, it is kind of a security problem, but there are too many memories there to just delete it.

Using Jekyll Exporter, the Wordpress plugin, I could get all the posts and all the pictures to a new Jekyll blog. I also wanted the private posts, which should have been a one line change in its source, and it was:

 foreach ( $post_types as $post_type ) {
     //$ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = %s", $post_type ) ); // SHSHSH
     $ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' OR post_status = 'private' AND post_type = %s", $post_type ) );
     $posts = array_merge( $posts, $ids );
 }

It created a 307mb file.

Old blog stays online just a bit more, I’ll clean up the posts and stuff and think about how I want to change the home page. We’ll see.

Escaping things

I predictably had problems with my posts containing curly brackets. This is the solution:

{% r.aw %}
{{#set:
 o=true
 |c=8
}}
{% end.raw %}

Four indentations so that it gets recognized as code.

Replacing with newline

%s/aoeu/aoeu\r/g Same syntax as useful, except \r instead of \n for the newline.

\n matches an end of line (newline), whereas \r matches a carriage return. On the other hand, in substitutions \n inserts a null character whereas \r inserts a newline (more precisely, it’s treated as the input )

(from here).

:%s/<\/pre>/\r{% end.raw %}/g  `.

Replace end.raw for endraw, because of this problem which is still around?

Cooking

As I was looking for ideas for small businesses, I found this nice website with small easy microwave recipes: https://www.minmaxmeals.com/recipes/garlic-oatmeal/, and I’ll try today the linked one. In general having such a database of go-to dishes would be quite nice, because I forget about mine often.

Jekyll

Categories

For categories, I again used this nice tutorial.

Excerpt separator

When outputting posts, {{post.excerpt}} either takes the first paragraph or a separator. The separator can be set in config.yml: excerpt_separator: <!--more-->

Posts visibility

published: false in the front matter. I like this more than the official draft mechanism.

Vim

Deleting tags surrounding something

A really elegant way to delete the tags surrounding something: yitvatp

Tag blocks                      *tag-blocks*

For the "it" and "at" text objects an attempt is done to select blocks between
matching tags for HTML and XML.  But since these are not completely compatible
there are a few restrictions.

The normal method is to select a  until the matching .  For "at"
the tags are included, for "it" they are excluded.  But when "it" is repeated
the tags will be included (otherwise nothing would change).  Also, "it" used
on a tag block with no contents will select the leading tag.

Repeat the last used macro

Just discovered this randomly after a typo. @@ repeats the last @-macro I used. This will save me really a lot of time!

Python forcing named arguments in function

In this article, this nice way has been mentioned: def safe_division(*, number, divisor, ignore_overflow, ignore_zero_division): It forces all arguments after * to be named during call: >>> safe_division(number=10**1000, divisor=3**-100, ignore_overflow=True, ignore_zero_division=False)

Stack

Linux LEDs and triggers

You can control LEDs with files! Article.

/sys/class/led has folders, with the most interesting files being brightness and trigger. The first one is self-explanatory – echo 1 > brightness does what you would expect it to do. trigger is interesting, cat trigger gives the possible trigger, which you can activate by echo trigger_name > trigger. I connected disk-read to the scroll LED on my USB keyboard, to get a bit of the nostalgic Pentium 4 feels, and BAT0-charging-blink-full-solid to Caps lock, which makes it solid 1 when full and blinking when charging. That was fun.

Jekyll

Jekyll/Markdown comments

… exist in really a lot of variants which are not portable, the portable ones are complicated.

Thankfully, for Jekyll the following exists:

{% comment %} my comment {% endcomment %}

… and of course the HTML comments, but they will still show up in the source.

Markdown numbered lists

… work with any numbers, in any order!

Jekyll Cyrillic and Unicode categories

seem to be a problem. The suggested approach with HTML Entities didn’t work for me, but this workaround did:

  {% assign selection = site.posts | where:"categories","montañas" | limit:1 %}
  {% for post in selection %}

  {% endfor %}

Changing themes

To change/overwrite individual theme files, just create the needed folder/file and do the changes needed. It will include it to the used theme automatically. (Doing the best menu in history).

Quotes

  • Success is measured in output of value, not input of effort

When to Hold onto Information
If the following conditions are met, it may be better to hold off explaining a new problem to your manager:

  • The situation does not require immediate intervention (i.e. no laws broken, no lives at risk, no bank accounts being drained, etc.)
  • You’re waiting on additional information that will make the scope of the issue clear
  • You control the flow of information, and your audience won’t learn about the issue from other sources
  • It’s possible that the situation can be fixed soon, allowing you to communicate both the problem and solution together
  • You suspect there may be related problems lurking that should be disclosed together

  • “Keeping options open” often means “Not being successful in anything”. (from Shulamit Widawsky’s answer)

Stack

Jekyll

Read more tag

{% if post.excerpt != post.content %}
    <a href="{{ site.baseurl }}{{ post.url }}">Read more...</a>
{% endif %}

Found here.

Linux

Unix date command

Decided to do my sprints system smarter, and decided to set date up to automatically output the week number. I had issues with the padding zero in the export SPRINT=$(date +%U)

The dash after % removes them from the output: export SPRINT=$(date +%-U)

Awesome.

Rsync update behaviour

rsync usually copies files if they are not on the target filesystem. The --update flag makes it check the timestamps, and overwrite if the target file is older than the source file. -c means also check the checksum.

Rsync slash

Trailing slash after the directory name copies the content of the directory, not the directory itself. Not consisten with mv, cp etc.

Vnstat for traffic monitoring

vnstat is the package and the service that needs to be enabled, and in /etc/vnstat.conf the default interface needs to be set.

Mount by UUID

to do this through mount, if for some reason I’ll need to do it manually: sudo mount UUID=%theUUID% /mnt/sth

Taskwarrior and i3

A task gains an +ACTIVE tag if it’s started. I want to use it to get an output of the currently active task in my statusbar.

t +ACTIVE | sed '4!d' gives the line with the currently active task. With sed I can get the needed column: I created a new report in taskwarrior because I did not want to think of columns. Then in the i3wrapper.py I added the following:

    bashCommand = "task a | sed '4!d'"
    bashOutput = subprocess.check_output(['bash','-c', bashCommand]).decode('utf-8').strip('\n')

It works!

Bash and Taskwarrior – tasks with a periodicity

Once every 12 sprints / 3 months brush, once a month backups, I’ll think what else:

for o in $(seq 9 12 52) do
    t add sprint:$o project:h change toothbrush +MOD
done

Vim

Now I can look through this diary with Ag.vim and silver_searcher! :Ag is more than I could wish for.

Stack

  • Add & / && to anki
  • Arch linux add traffic monitoring
    • DONE
  • Add currently “tracked” todo in taskwarrior to i3status
    • DONE

Working on previous stacks

Okay, this is going to be fun!

To ankify

German

  • Staff meeting = Belegschaftversammlung
  • Data cleansing -> Datenbereinigung
  • Electric meter -> Stromzähler (m u. pl.)\
  • Пёстрый –> Zusammengewürfelt\
  • Die Einrichtung –> Institution, estabilishment
  • Die Prognose
  • How I divided them between X und Y –> Wie ich die zwischen X und Y aufteilte.
  • Abweichungswerte – deviation valu
  • km^2 = Quadratmeter = km$^2
  • Die Vergütung.
  • Anomaly Detection - die Erkennung von Anomalien.
  • verwenden
  • 15 minute intervals -> 15-Minuten-Intervalls (auch “im Abständen von 15 Minuten”)
  • Month rhythm -> Monat__s__rhythmus.
  • basically -> im Gr__u__nde
  • plöTZLich, EinflUss, drUck, grOßes, wöchiges, regelmäßig, DatenschUtz.
  • reCHerCHiert, DiagraMM, Kategorie
  • “und dann habe ich wieder von vorne angefangen”
  • “fraghaft” existiert nicht, fragwürdig/flaglich
  • Eingabedatei, not Eingangdatei
  • Datei(f), Daten(pl)
  • draft -> der Entwurf
  • Abschlüss -> Abschluss
  • Nationale Technische Universität „Kiewer Polytechnisches Institut Ihor Sikorskyj“
  • interdisziplinär
  • Load Forecasting -> Lastprognose
  • I should learn the names of the German letters: https://de.wikipedia.org/wiki/Deutsches_Alphabet#Benennung_der_Buchstaben.
  • der Pfad - die Pfade -> trails/paths
    • abseits ausgetretener Pfade – off the beaten track
    • TODO Ankify this
  • Not Synchronizität, Synchronität. (at least in Schaltungstechnik).
  • Figure out bzw.
  • From this German StackExchange answer:
    • Anders
      • Only word that works alone, without saying different from what
      • Der Hund is anders; der andere Hund.
    • Unterschiedlich
      • An important but small attribute that makes things different that you want to accentuate:
        • Wuffi und Kläffi sind unterschiedlich. Sie unterscheiden sich an den Ohren: Wuffi hat Stehohren, Kläffi hat Schlappohren.
    • Verschieden
      • Just different, without any specifics.
        • Natürlich sind Kläffi und Törti verschieden! Es sind schließlich verschiedene Rassen!

    Not from dict.cc, but from my intuition:

    • die Unterschiedlichkeit – the difference in a more abstract meaning.
    • der Unterschied – the difference – especially one in particular.
  • der ZAhler — whoever pays. Der ZÄhler — counter.
  • sich mit etw.(Dat) befassen: undertake/concert/deal/occupy/dabble in/with/whatever

IT

for the % symbol: \% Add to Anki \wedge \vee and other latexy things I’ve used. \& istead of &, like with \%.

  • _ is the black hole register in vim to delete stuff without yanking it
  • Ankify import random and randInt(x, y)
  • Here I learned about du. sudo du -h -d 1 shows the size of the directories in the folder (depth of one, human-readable).
  • Vim newline when searching: in substitutions \r inserts a new line, \n inserts null. When searching \n matchesan end of line (newline)
  • {} in German

English

  • Apostrophes rules!
  • Sedition is overt conduct, such as speech and organization, that tends toward insurrection against the established order.

Timewarrior

Apparently times and intervals are much more easy than I thought! I should actually read man pages sometime, instead of relying on tutorials.

INTERVAL
       An interval defines a block of time that is tracked. The syntax for specifying an interval is flexible, and may 
be one of:

         [from] <date>
         [from] <date> to/- <date>
         [from] <date> for <duration>
         <duration> before/after <date>
         <duration> ago
         [for] <duration>

       Examples are:

         from 9:00
         from 9am - 11am
         from 9:00:00 to 11:00
         from 9:00 for 2h
         2h after 9am
         2h before 11:00
         2h ago
         for 2h

       An interval is said to be 'closed' if there is both a start and end, and 'open' if there is no end date.

Nice examples are, for example, w track 7min "something short" – which records something done the last X minutes including now, as a closed interval.

Stack

  • Python – memorize all different exception types!

DNB

d3b 57% Mon 18 Feb 2019 10:38:29 AM CET
d3b 64% Mon 18 Feb 2019 10:40:15 AM CET
d3b 50% Mon 18 Feb 2019 10:41:48 AM CET
d3b 43% Mon 18 Feb 2019 10:43:54 AM CET
d3b 50% Mon 18 Feb 2019 10:49:25 AM CET
d3b 50% Mon 18 Feb 2019 10:51:01 AM CET
d3b 21% Mon 18 Feb 2019 10:52:45 AM CET
d3b 79% Mon 18 Feb 2019 10:54:51 AM CET

hidden: true

DNB and Typing

d3b 71% Tue 19 Feb 2019 03:29:14 PM CET
d3b 57% Tue 19 Feb 2019 03:31:02 PM CET
d3b 43% Tue 19 Feb 2019 03:32:35 PM CET
d3b 64% tue 19 feb 2019 03:34:10 pm cet
d3b 43% tue 19 feb 2019 03:35:44 pm cet

Done

Deleted VK account. Saw another Verteidigung. Backed up my Android. Finished a ton of small things that I was postponing for weeks.

Backing up Android phone via ADB

Using this tutorial: adb backup -apk -shared -all -f backup-file.adb

To restore: adb restore backup-file.adb

Ledger

-M gives monthly transactions.

Stack

DNB and Typing

d3b 71% Thu 21 Feb 2019 10:40:21 AM CET
d3b 79% Thu 21 Feb 2019 10:41:57 AM CET
d3b 57% Thu 21 Feb 2019 10:43:33 AM CET
d3b 43% Thu 21 Feb 2019 10:45:08 AM CET
d3b 21% Thu 21 Feb 2019 10:46:44 AM CET
d3b 79% Thu 21 Feb 2019 10:53:03 AM CET
d3b 64% Thu 21 Feb 2019 10:54:41 AM CET
d3b 43% Thu 21 Feb 2019 10:56:15 AM CET
d3b 71% Thu 21 Feb 2019 10:57:47 AM CET
d3b 57% Thu 21 Feb 2019 10:59:25 AM CET

Deutsch

  • It’s säkular, not sekulär etc.
  • Geöffnet, not geoffnet
  • kümmert
  • Brasilien
  • hoche Spannungen – no umlaut
  • begann
  • The earlier we came -> je früher wir kamen
  • Ein NN wird trainiert, nicht getraint. (Where did I get this word actually?)

Linux exit codes

To check the exit code of a command you just ran, you need to output the special bash variable $?, so echo $? returns the exit code of the previous command.

Taskwarrior

I decided to make my sprint system a bit less stupid than it is now. I finally rewrote it using overrides.

In .zshrc, first I override the default sprint when adding tasks, then create command which shows my s report:

alias t='task rc.uda.sprint.default=$SPRINT'
alias s='task s sprint:$SPRINT or sprint:c' 

in .taskrc I modified the s report to look like this:

# Current sprint
report.s.description='Current sprint'
report.s.columns=id,project,tags,pri,est,due.relative,description,urgency
report.s.labels=ID,Project,T,P,E,D,Description,U
#report.s.sort=due+
report.s.sort=urgency-
report.s.filter=status:pending

Now when I type s I get my current sprint todo, and when I add tasks they get added automatically to current sprint.

i3lock-color

This is really nice, I had no idea a fork with more features existed! It doesn’t show my keyboard layout correctly, but otherwise it’s perfect. Will be using it from now on.

Tmux resize-pane

You open the tmux command line with C-b :, and to resize a pane horizontally to an absolute size the command is :resize-pane -x %absolute size%.

Vim-pekaboo and vim registers

Is a plugin which lets you preview the register contents before using one. Also you can paste stuff from registers in insert mode by pressing <c-R>.

Stack

  • I should actually spend 1h a day for thinking about business and passive income.
  • Add a cron job to automagically move all undone tasks from the last sprint/week to the current one.
  • Add all the German language I put together a couple of Days ago to Anki

DNB and Typing

d3b 70% Mon 25 Feb 2019 12:16:05 PM CET
d3b 79% Mon 25 Feb 2019 12:17:50 PM CET
d3b 64% Mon 25 Feb 2019 12:19:26 PM CET
d3b 57% Mon 25 Feb 2019 12:21:00 PM CET
d3b 86% Mon 25 Feb 2019 12:22:34 PM CET
d3b 86% Mon 25 Feb 2019 12:24:38 PM CET
d3b 71% Mon 25 Feb 2019 12:27:23 PM CET
d3b 50% Mon 25 Feb 2019 12:28:57 PM CET

Taskwarrior excluding stuff

To exclude tasks of a certain project, the syntax for the filter is project.not:projectname.

Also added a new report for tasks which will never be finished – anki, cleaning, basic org etc., but that I still want to track with timewarrior. t m now returns me all such tasks.

Vim searching at the beginning of line / that start with something

I find myself grepping through the dict.cc raw file, I might build a script to do that for me. But I often need to find a word with the condition that it’s the first thing on a line, instead as partof a bigger sentence.

^ helps. /^Dru gives me the lines which start with “Dru”.

Ledger

Added a date format to my command line alias: alias le="ledger -f ~/p/f/l/ledger.txt --strict --date-format '%Y/%m/%d'" for my date formats.

Also to represent bought currencies, I think the way to do it is:

2019/02/25  Exchanged 100$ for 74.81 at XXX
    Assets:Cash:Wallet  E74.91 @ $100
    Assets:Cash:Fund:USD

Stack

* It would be interesting to do an implementation of [this xkcd](https://xkcd.com/2112/) using data from Twitter with 'intensity' defined as 'more or less interaction that the norm for this user'

DNB and Typing



Bash

I needed to copy all pictures from a folder to another place, while saving the paths and folder names. (from/one/two/three.jpg should become to/one/two/three.jpg)

The images were inside a number of different directories and doing it manually would’ve been hell.

Therefore, first I found all images and wrote their full path to a file: find . -type f -exec file {} \; | awk -F: '{ if ($2 ~/[Ii]mage|EPS/) print $1}' >> ~/allm (I’m not pretending I understand the above line).

Then I wrote this basic script to create the folders and to copy the files inside them. This was much harder than expected, especially because of the spaces inside the filenames, which created problems at every step.

The final code was:

counter=0; # To count how many files have we copied
IFS=$'\n' #makes newline the only separator, not just spaces, in the next line.
for o in $(cat allm) # for every line inside the file allm
do
    echo =========== $counter ==========
    counter=$((counter+1)) #increase counter

    # Everything inside quotes because apparently that's how you do spaces. Also all the names are inside variables, because again apparently that's how you do spaces.

    directory=pictures/$(dirname from_white_210220019/"$o")
    from="from_white_210220019/$o"
    to="pictures/from_white_210220019/$o"

    mkdir -p $directory

    echo "copying (from to)" $from $to
    cp ${from} ${to}
done 

The IFS thing decides how should the elements of the file be split. By default it’s spaces and newlines, we needed to tell it to split only by newlines, explicitly.

The entire solution is quick and dirty (the “from_white_xxx” thing would be the first thing to refactor) but it works, no need for overengineering a quick one-time hack which I’ll prolly never need again.

Keynav scrolling

This is a nice discovery!

Q: Can I use keynav to scroll?
A: Yes! X11 represents mouse scrolling as key presses, so you just add the relevant stanza to your keynavrc. Mouse buttons are 1=left, 2=middle, 3=right, 4=scroll-up, 5=scroll-down, 6=scroll-left, 7=scroll-right. So for example to scroll up with i and down with e:

i click 4,end
e click 5,end

Stack

  • Learn find, awk and other holy shell commands which I usually copypaste without actually taking time to learn the proper syntax
  • Learn bash – again, formally.

Arch linux thumbnails

The package is tumbler.

Fixed my timers (Bash, redirects, >)

I had two problems with my timer system: that it doesn’t work when the files are empty (because of the split I did in the code), and the files that grew exponentially, because they did not get deleted at the end of the timer.

I am not sure why did the > in the timer command leave the previous file contents (I assume it’s some magic with terminals and ^M?), but I fixed it by adding : > outfile to the command at the beginning.

From this tutorial:


   : > filename
      # The > truncates file "filename" to zero length.
      # If file not present, creates zero-length file (same effect as 'touch').
      # The : serves as a dummy placeholder, producing no output.

   > filename
      # The > truncates file "filename" to zero length.
      # If file not present, creates zero-length file (same effect as 'touch').
      # (Same result as ": >", above, but this does not work with some shells.)

My zsh was apparently one of the shells where that doesn’t work, but the first one worked nicely. So the final line in .i3/config is:

    bindsym Mod3+n exec ": > ~/s/sounds/outpomo && utimer -c 15m > ~/s/sounds/outpomo && mpg123 ~/s/sounds/tib.mp3"
    bindsym Mod3+Shift+s exec ": > ~/s/sounds/outpause && utimer -c 5m > ~/s/sounds/outpause && mpg123 ~/s/sounds/cl.mp3"

The files-not-existing thing was fixed by an additional try/catch block. The final (still bad) code looks like this:

    while True:
        line, prefix = read_line(), ''
        # ignore comma at start of lines
        if line.startswith(','):
            line, prefix = line[1:], ','

        j = json.loads(line)

        # Files with the output of utimer:
        tfile="/home/sh/s/sounds/outbash"
        tfile2="/home/sh/s/sounds/outpomo"
        tfile3="/home/sh/s/sounds/outpause"

        def rtime(tfile, color):
            try:
                with open(tfile, "r") as f:
                    # last line of the file
                    try:
                        t=f.readlines()[-1] # If file is empty
                    except IndexError:
                        t="O"
            except IOError: 
                # If the file doesn't exist at all
                t="O"
            # Utime seems to add a \n(^M?); at the end
            # We use it as a way to check that the timer has stopped
            # When it stops, a \n is added.
            if "\n" not in t:
                if t!="O":
                    to=t.split("ing:")[1]
                    j.insert(0, {'full_text': '%s' % to, 'color':'%s'%color})

        tcolor1="#FF0F02"
        tcolor2="#FFFFFF"
        tcolor3="#FA0FF2"

        rtime(tfile, tcolor1)
        rtime(tfile3, tcolor3)
        rtime(tfile2, tcolor2)

Jekyll pagination fun

Pagination – highlighted posts

I wanted to output the first couple of posts in full, and the next ones until the end of the page as excerpts for the first page, and for all the next pages – only the excerpts. This SO answer helped me, I didn’t know about offset and limit in for loops!

  {%- if site.posts.size > 0 -%}
      <h2 class="post-list-heading">Posts</h2>
      <ul class="post-list">
        <!-- This loops through the paginated posts -->
        <!-- If we're on the first page, output the first 3 posts in full-->
        {% if paginator.page == 1%}
          {% for post in paginator.posts limit:3 %}
          <h1><a href="{{site.url}}{{ post.url }}">{{ post.title }}</a></h1>
            <p class="author">
              {% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
              <span class="post-meta">{{ post.date | date: date_format }}</span>
            </p>
            <div class="content">
              {{ post.content }}
              <br>
            </div>
          {% endfor %}
        {% else %}
        <!-- if not on the first page, output only the excepts-->
          {% for post in paginator.posts limit:3 %}
          <h1><a href="{{site.url}}{{ post.url }}">{{ post.title }}</a></h1>
            <p class="author">
              {% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
              <span class="post-meta">{{ post.date | date: date_format }}</span>
            </p>
            <div class="content">
              {{ post.excerpt }}

              {% if post.excerpt != post.content %}
                  <a href="{{ site.baseurl }}{{ post.url }}">Read more...</a>
              {% endif %}
              <br>
              <br>
            </div>
          {% endfor %}
        {% endif %}

        <!-- The remaining posts either way should be excerpts -->
        {% for post in paginator.posts offset:3 %}
        <h1><a href="{{site.url}}{{ post.url }}">{{ post.title }}</a></h1>
          <p class="author">
            {% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
            <span class="post-meta">{{ post.date | date: date_format }}</span>
          </p>
          <div class="content">
            {{ post.excerpt }}

            {% if post.excerpt != post.content %}
                <a href="{{ site.baseurl }}{{ post.url }}">Read more...</a>
            {% endif %}
            <br>
          </div>
        {% endfor %}

Pagination – removing the pages from the header with unless

I’m not sure what happened, but I saw all the generated paginator pages in the menu, all called “Posts”. I removed it by overriding the layout with unless, which is another really nice operator.

The relevant code in _includes/header.html:

        <div class="trigger">
          {%- for path in page_paths -%}
            {%- assign my_page = site.pages | where: "path", path | first -%}
            {%- if my_page.title -%}
            {% unless my_page.title == "Posts" %}
            <a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
            {% endunless %}
            {%- endif -%}
          {%- endfor -%}
        </div>

DNB and Typing



Printing and scanning

scanimage (SANE) is a “a library and a command-line tool to use scanners”.

sudo scanimage -L to see the list of scanners, then to scan (for me also with sudo for some reason): sudo scanimage --device "xerox_mfp:libusb:002:004" --format=png > name.png

Automagically cropping pictures

This tutorial and extension could separate about 30% of the pictures with the default settings. Margins (and margins to the sides of the image!) are important.

Installing GIMP .scm plugins

is done by putting the .scm file to /usr/share/gimp/2.0/scripts/

Creating LaTeX photoalbums

This tutorial is freaking awesome.

Given the number of images I was dealing with manually configuring each one was not an option. What I wanted was a service that would, given my image collection, just print me a photo album of approx 6x4 images, in chronological order, two per page, with a caption below each detailing the image file name and the date taken.

It provides a .tex album file and a Python2 file which reads the Exif data and creates a photos.tex which gets included in the main album file.

Stack

DNB and Typing

Stack

QS: - finally find a semi-automatic way to get my Fitbit data - Hearbeat and sleep as priorities - Nomi too - Write something to centralize it all?

TODO: clean and do something with the following:

sudo chgrp -R www-data /var/www/n.example.com
sudo find /var/www/example.com -type d -exec chmod g+rx {} +
sudo find /var/www/example.com -type f -exec chmod g+r {} +

sudo chown -R myuser /var/www/n.example.com/
sudo find /var/www/example.com -type d -exec chmod u+rwx {} +
sudo find /var/www/example.com -type f -exec chmod u+rw {} +

sudo find /var/www/example.com -type d -exec chmod g+s {} +

========================
chown -R myuser *
chgrp -R www-data *
chmod -R 750 *
chmod g+s *

# read permission ONLY for the owner 
chmod -R 400 /var/www/example.com

# add execute for folders only
find /var/www/example.com -type d -exec chmod -R u+x {} \;

# allow file uploads 
chmod -R u+w /var/www/example.com/

i3

i3-gaps for work/play mode

i3-gaps is fun but kinda nothing more. But I think it has potential for creating a right atmosphere for my work/play time and pomodoros.

I added the following in the config:

# work
bindsym Mod3+w exec feh --bg-scale ~/s/bg/darkwood.jpg; gaps inner all plus 10
# play
bindsym Mod3+p exec feh --bg-scale ~/s/bg/wallpaper.jpg; gaps inner all plus 10

The idea is that there are two main designs, activated by the above keystrokes, one with gaps which I’ll use when I’m not doing anything important, and the other one when I have a timer/pomodoro running. Like a ritual and a way to subconsciously signal to myself that I should not distract myself right now.

We’ll see if it works out.

See if there's a way to do this on all workspaces. Is this what the global/local config thing is about?

yes. gaps inner all plus 5

i3 backgrounds on different workspaces

i3-wpd from Github is nice. Could be another way to ritualize it all. We’ll see.

Privacy

Updated my default search engine to startpage.com instead of DDG. I think the search results are much better.

Python steganography

Decided to take a look again at my Bachelor’s thesis and do a nice rewrite in Python3 of the main code.

Setting date in Linux

The date command can take STRINGS, which as mentioned in the man pages can be quite free-form. I moved my system clock back 1h with sudo date -s "1 hour ago". Wow.

DNB and Typing

For the first time got 100% on D3B! And in general even though the results aren’t the most important thing in D3B they do actually motivate quite a lot. Keeping records and gamification for the win!

    d3b 64% Mon 25 Mar 2019 11:43:46 AM CET
    d3b 100% Mon 25 Mar 2019 11:45:39 AM CET
    d4b 39% Mon 25 Mar 2019 11:48:12 AM CET
    d4b 33% Mon 25 Mar 2019 11:52:23 AM CET
    d4b 44% Mon 25 Mar 2019 11:55:07 AM CET
    d4b 50% Mon 25 Mar 2019 11:58:35 AM CET
    d4b 50% Mon 25 Mar 2019 12:00:39 PM CET

Python keyring

Is a python module to save secrets. python -m keyring [get/set] for help.

Arch adding user to group

To be able to change backlight. sudo gpasswd -a sh video

Clight and backlights

clight -b radeon_bl0 --day-temp=6000 --night-temp=2000 would be nice, but sadly my webcam is covered. But it might be a nice replacement for redshift, sometime.

i3 borders

hide_edge_borders both #<none|vertical|horizontal|both>

Setting time in Linux

date -s 13:17:50 also works. It’s more simple than I remembered.

i3

removed border around all windows, we’ll see how I live with it and whether I need it. In work mode it might get confused with similar windows, in play mode it shouldn’t matter. We’ll see.

DNB and Typing

    d4b 33% Tue 26 Mar 2019 01:36:16 PM CET
    d4b 50% Tue 26 Mar 2019 01:38:22 PM CET
    d4b 50% Tue 26 Mar 2019 01:40:42 PM CET
    d4b 17% Tue 26 Mar 2019 01:42:47 PM CET
    d4b 61% Tue 26 Mar 2019 01:44:48 PM CET
    d4b 50% Tue 26 Mar 2019 01:48:32 PM CET
    d4b 28% Tue 26 Mar 2019 01:50:32 PM CET
    d4b 50% Tue 26 Mar 2019 01:52:31 PM CET
    d4b 22% Tue 26 Mar 2019 01:54:36 PM CET
    d4b 00% Tue 26 Mar 2019 01:57:40 PM CET
    d4b 50% Tue 26 Mar 2019 02:02:24 PM CET
    d4b 00% Tue 26 Mar 2019 02:04:32 PM CET
455 cpm 98.3%

Anki-vim and importing

Anki’s manual says a lot about importing raw cards – and it’s much easier and more flexible to do this than I thought. I might drop anki-vim completely, or write something more minimalistic.

Jekyll create.sh

Added to my “create” bash script a line that at the end opens the created file in vim, because this is what I do every single time.

Urxvt transparency

Added the lines:

urxvt*transparent: true
urxvt*shading: 5

in .Xdefaults, so I get a small transparency in urxvt. Useful to make work/play mode even more defined - I can actually see the background.

cmus-remote

cmus-remote controls cmus from another CLI. Added to .i3/config:

# play/pause toggle
bindsym XF86AudioPlay exec cmus-remote -u
# next
bindsym XF86AudioNext exec cmus-remote -r
# prev
bindsym XF86AudioPrev exec cmus-remote -n

EDIT: And removed them, they interact strangely with workspace changes, later will look into this.

Stack

DNB and Typing

d4b 28% Thu 28 Mar 2019 12:37:31 PM CET
d4b 44% Thu 28 Mar 2019 12:39:30 PM CET
d4b 17% Thu 28 Mar 2019 12:41:11 PM CET
d3b 93% Thu 28 Mar 2019 12:43:25 PM CET
d4b 44% Thu 28 Mar 2019 12:45:26 PM CET
d4b 78% Thu 28 Mar 2019 12:48:09 PM CET
d4b 06% Thu 28 Mar 2019 12:50:11 PM CET
d4b 28% Thu 28 Mar 2019 12:52:09 PM CET
d4b 39% Thu 28 Mar 2019 12:54:13 PM CET
d3b 93% Thu 28 Mar 2019 12:56:02 PM CET
d4b 0% Thu 28 Mar 2019 12:58:40 PM CET
d4b 39% Thu 28 Mar 2019 01:00:35 PM CET

Clipboard

Added the alias alias xc='xclip -selection c' to .zshrc, now I can pipe stuff in my clipboard using echo test | xc. See this SO answer. alias xp='xclip -selection clipboard o' to paste.

HoMe diploma

I’m starting again to work heavily on my diploma. I’ll be documenting most of what I do and learn here, and I think after this this semi-blog will become even more lively. I don’t think anyone will feel bad about me using this as my personal notepad, because this is exactly how this place was envisioned. For the “blog” blog with a bit more curated posts, feel free to go there.

The plan

In the next couple of days - read maximally about interference in languages, first language identification etc. sci-hub.se - do a better cleanup of the tweets dataset (file for preprocessing it in batch instead of the same way in every notebook) - do some basic classification with tokens standing not for words, but for parts of speech, and with commas included, and see if that brings anything interesting (as per the influence/punctuation paper). - Create a working systemm for notes, papers, links etc etc. Most probably Note.vim or whatever was it called, but I need to research what exist. .. Or my wiki, which is nominally for knowledge management, and I’ve never seen a purer use-case for this.

Python

Importing modules

Modules downloaded from Github and placed in the same directory get prioritised automatically, because the first thing inside sys.path is an empty string, which represents the current folder the file runs from.

Encodings

Are hell. I solved the problem of my utf-8 text being represented with weird \wha\te\ver characters while being utf-8 by changing the way csv is written. The old csvwriter.writerow([str(status.id_str).encode("utf-8") got replaced by csvwriter.writerow([str(status.id_str). It was wrong and now I understand why. It was writing the utf-8 bytes in the file, and when I read I got a string with the slashed that was already utf-8, the individual ‘', ‘w’ .. characters, not bytes.

Stack

Add Jekyll footnotes to anki.

DNB and Typing

450 cpm 97.7%

Random

Why we procrastinate

TL;DR procrastination is about negative emotions about doing what we do, not time management.

Jekyll footnotes

For Jekyll footnotes you do

 
This is [^anything] the text.
[^anything]: and the description

Blog

Added a nice post about Pchr8board and edited the Projects page to have excerpts of posts belonging to that category.

Github

Git remove

git rm $whatever removes the file even if it’s in the repo but not locally. Handy for old moved or rmd files.

Github README images

Are done like usual in Markdown: ![description](url)

Adding files starting with dots

git add .

Stack

DNB and Typing

d4b 44% Sun 31 Mar 2019 11:42:18 AM CEST
d4b 50% Sun 31 Mar 2019 11:44:21 AM CEST
d4b 17% Sun 31 Mar 2019 11:46:18 AM CEST
d4b 6% Sun 31 Mar 2019 11:48:20 AM CEST
d4b 39% Sun 31 Mar 2019 11:50:20 AM CEST
d4b 17% Sun 31 Mar 2019 11:52:47 AM CEST
d4b 17% Sun 31 Mar 2019 11:54:49 AM CEST
d4b 67% Sun 31 Mar 2019 11:56:52 AM CEST
d4b 56% Sun 31 Mar 2019 11:59:03 AM CEST
d4b 39% Sun 31 Mar 2019 12:01:05 PM CEST
d4b 6% Sun 31 Mar 2019 12:03:29 PM CEST
d4b 44% Sun 31 Mar 2019 12:05:30 PM CEST

d4b 39% Sun 31 Mar 2019 02:52:21 PM CEST
d4b 50% Sun 31 Mar 2019 02:54:35 PM CEST
d4b 44% Sun 31 Mar 2019 02:56:44 PM CEST
d4b 44% Sun 31 Mar 2019 02:58:43 PM CEST
d4b 44% Sun 31 Mar 2019 03:00:46 PM CEST
d4b 39% Sun 31 Mar 2019 03:03:16 PM CEST
d4b 44% Sun 31 Mar 2019 03:05:19 PM CEST
d4b 39% Sun 31 Mar 2019 03:07:16 PM CEST

Taskwarrior

Tasks tagged +next are now underlined.

Stack

Edit .i3/ to create the multiple scratchpads at startup and put them automatically where I want them – second answer is a good example.

DNB and Typing

450 cpm 97%

d4b 72% Fri 05 Apr 2019 07:03:22 PM CEST
d4b 50% Fri 05 Apr 2019 07:05:21 PM CEST
d4b 39% Fri 05 Apr 2019 07:07:23 PM CEST
d4b 44% Fri 05 Apr 2019 07:09:19 PM CEST
d4b 33% Fri 05 Apr 2019 07:11:17 PM CEST
d3b 79% Fri 05 Apr 2019 07:13:08 PM CEST !
d3b 71% Fri 05 Apr 2019 07:14:44 PM CEST !
d3b 86% Fri 05 Apr 2019 07:16:21 PM CEST !
d4b 44% Fri 05 Apr 2019 07:18:17 PM CEST
d4b 22% Fri 05 Apr 2019 07:20:13 PM CEST
d4b 28% Fri 05 Apr 2019 07:22:41 PM CEST
d4b 00% Fri 05 Apr 2019 07:24:46 PM CEST

Random

Knowledge/plans management

I just discovered didoesdigital.com, which is absolutely excellent on all levels. I’m missing a way to categorize everything I see there.

I should/could make things-I’m-learning pages with links and checklist for things I’m doing/learning. I’m not quite sure what should it look like, but it would definitely be something Jekyll-like. I think I’m slowly going in the direction of Steve Wolfram’s dashboard. Or at least a different vim in a different floating window that opens with another keystroke, i3 would make it easy to do that. In general I need a much better system to track the things I’m learning or reading. Polarized goes in the right direction. And I feel my links wiki will stay just that – a links wiki. Unless I make a seamless interface to it, I don’t really like it for actual knowledge management, even though it’s the absolute best I have until now.

And I must not fall in my typical error about sharpening the saw more that actually cutting trees, even though sharpening the saw is a really pleasant thing to do for me.

EDIT: Just created it at here, we’ll see what happens. I can imagine a dashboard based on it, and some kind of integration for task/timewarrior. Probably something ncurses-based in python?

Trickle lists

This is the application - in general I find the idea really inspiring. I could imagine it on a touchscreen somewhere, or at least on a second desktop. Is it conceptually different from Nomie? Can I add just add another “trickle” board?

Jekyll deploy.sh

Added at the end ./commit.sh, which is a small file with git commit, so now it gets backed up to github automatically every time I deploy a new version on the server.

DNB and Typing

d4b 33% Sun 07 Apr 2019 04:24:36 PM CEST
d4b 33% Sun 07 Apr 2019 04:26:35 PM CEST
d4b 56% Sun 07 Apr 2019 04:28:28 PM CEST
d4b 61% Sun 07 Apr 2019 04:30:24 PM CEST
d4b 28% Sun 07 Apr 2019 04:32:21 PM CEST
d4b 44% Sun 07 Apr 2019 04:34:27 PM CEST
d4b 22% Sun 07 Apr 2019 04:36:19 PM CEST
d4b 39% Sun 07 Apr 2019 04:38:14 PM CEST

Quotes

“Wherever you are, make sure you’re there.” — Dan Sullivan

Diploma

Classifying by parts of speech

nltk.download() downloads everything needed. nltk.word_tokenize('aoethnsu') returns the tokens. From https://medium.com/@gianpaul.r/tokenization-and-parts-of-speech-pos-tagging-in-pythons-nltk-library-2d30f70af13b. For parts of speech it’s nltk.pos_tag(tokens).

The tokenizer for twitter works better for URLs (of course). Interestingly it sees URLs as NN. And - this is actually fascinating - smileys get tokenized differently!

 ('morning', 'NN'),
 ('✋', 'NN'),
 ('🏻', 'NNP'),

EDIT: nltk.tokenize.casual might be just like the above, but better!

EDIT: I have a column with the POS of the tweets! How do I classify it with its varying length? How can I use the particular emojis as another feature?

Ideas

POS + individual smileys might be enough for it to generalize! TODO test TODO: Maybe first do some much more basic feature engineering with capitalization and other features mentioned here:

    Word Count of the documents – total number of words in the documents
    Character Count of the documents – total number of characters in the documents
    Average Word Density of the documents – average length of the words used in the documents
    Puncutation Count in the Complete Essay – total number of punctuation marks in the documents
    Upper Case Count in the Complete Essay – total number of upper count words in the documents
    Title Word Count in the Complete Essay – total number of proper case (title) words in the documents
    Frequency distribution of Part of Speech Tags:
        Noun Count
        Verb Count
        Adjective Count
        Adverb Count
        Pronoun Count

Resources

textminingonline.com has nice resources on topic which would be very interesting to skim through! Additionally flair is a very interesting library not to reinvent the wheel, even though reinventing the wheel would be the entire point of a bachelor’s thesis.

This could work as a general high-levent intro into NLP? Also this.

German

Wann vs wenn

Wann vs wenn: Wann has nothing to do with if, it’s a question asking for a point of time. Wenn is closer to “if”, but it’s also a translation for “when”.

If we can say at what point time instead of when, then we need to use wann.

Wann [=at what time/when] kommt der Bus? \ Bis wann musst du arbeiten?
Thomas fragt Maria, wann genau sie nach Hause kommt.

On the other hand,
Ich gehe nach Hause wenn[!= at what time! just the “when” closer to “if”] ich fertig bin.

Roles

A wann-clause is ALWAYS functioning as the object of the verb.. If I can replace the clause with a thing, then it’s wann.\ Wenn answers to “at what time”, we can basically replace it with “at 3 am”.

When I have finished work, I will call you and tell you when I will be at home.
When I have finished work, I will call you and tell you at what point in time I will be at home.
Wenn ich mit der Arbeit fertig bin, rufe ich dich an und sage dir, wann ich zuhause bin.
At 3 I’ll call you and tell you this thing.

Github reset (undoing last commit/s)

$ git reset --soft HEAD~1 resets to last commit leaving all the changes on disc, but uncommitted.
$ git reset --hard 0ad5a7a6 returns to any previous version.

.gitignore for LaTeX projects

Here, and it’s excellent. I should actually learn git in a normal systematic way. Additionally, what to do when your .gitignore is ignored by git@SO.

Random

Busy person patterns as linked on HN Testosterone seems to have different effects than the stereotypes say, and road/roid rage is actually caused by estrogen spikes.

Cooking

This eggs inside avocado recipe is very interesting. Will try tomorrow. Also this avocado hummus recipe.

DNB and Typing

d4b 56% Tue 09 Apr 2019 08:42:36 AM CEST
d4b 22% Tue 09 Apr 2019 08:45:01 AM CEST
d4b 67% Tue 09 Apr 2019 08:46:57 AM CEST
d4b 67% Tue 09 Apr 2019 08:48:54 AM CEST
d4b 28% Tue 09 Apr 2019 08:50:47 AM CEST
d4b 67% Tue 09 Apr 2019 08:52:42 AM CEST
d4b 00% Tue 09 Apr 2019 08:54:36 AM CEST

Though from now on they should also be available on brainscale.net

Python

Chained try/except blocks

Apparently this is the recommended way to do this, as per this answer and the official Python docs:

def __getattribute__(self, item):
    try:
        return object.__getattribute__(item)
    except AttributeError:
        pass  # fallback to dict
    try:
        return self.dict[item]
    except KeyError:
        raise AttributeError("The object doesn't have such attribute") from None

Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many try and except statements. The technique contrasts with the LBYL style common to many other languages such as C.

Get file name without extension

os.path.splitext("path_to_file")[0]

Bash adding symbols to filenames

Adding a + to all the files in the current directory, before the extension: for file in *.jpg; do mv $file $(basename $file .jpg)+.jpg; done (from here)

English

A Kludge kluge (/klʌdʒ, kluːdʒ/) is a workaround or quick-and-dirty solution that is clumsy, inelegant, inefficient, difficult to extend and hard to maintain.

vim reload file currently open

:e is one way to do it.

DNB and Typing

d4b 56% Wed 10 Apr 2019 10:18:00 AM CEST
d4b 33% Wed 10 Apr 2019 10:19:54 AM CEST
d4b 39% Wed 10 Apr 2019 10:21:51 AM CEST
d4b 17% Wed 10 Apr 2019 10:23:47 AM CEST
d3b 86% Wed 10 Apr 2019 10:25:24 AM CEST !
d4b 56% Wed 10 Apr 2019 10:27:22 AM CEST

d4b 56% Wed 10 Apr 2019 03:46:47 PM CEST
d4b 28% Wed 10 Apr 2019 03:48:45 PM CEST
d4b 39% Wed 10 Apr 2019 03:50:51 PM CEST

d4b 50% Wed 10 Apr 2019 05:47:24 PM CEST
d4b 61% Wed 10 Apr 2019 05:49:20 PM CEST
d4b 44% Wed 10 Apr 2019 05:51:17 PM CEST
d4b 22% Wed 10 Apr 2019 05:53:11 PM CEST
d4b 44% Wed 10 Apr 2019 05:55:03 PM CEST
d3b 71% Wed 10 Apr 2019 05:56:36 PM CEST !
d3b 71% Wed 10 Apr 2019 05:58:09 PM CEST !
d3b 86% Wed 10 Apr 2019 05:59:42 PM CEST !
d4b 39% Wed 10 Apr 2019 06:01:41 PM CEST

Random

Day 100, how nice! I’m glad this diary happened :)

Thesis

Today I’ll try to get as many not-NLP-features as possible – number of things, capitals, punctuation, etc and see if it predicts anything.

Pandas balancing datasets

One way to balance a dataset, to leave an equal number of points in all classes, is the third answer here:

g = df.groupby('class')
g.apply(lambda x: x.sample(g.size().min()).reset_index(drop=True)

For each group, we get a sample from it, with the size of the smallest group. Quite beautiful actually.

Basic non-NLP classification

I added the following columns:

  • char_count, word_count, word_density
  • puctuation_count, title_word_count, upper_case_word_count – though all relative, that is divided by number of words

Basic classification using scikit and the very basic features above. With four languages and the vanilla sklearn.svm.SVC I get the following confusion matrix:

array([[34, 22, 30, 24],
       [26, 49, 24, 29],
       [30, 33, 45, 25],
       [32, 22, 34, 41]])

which is still more than chance!

To print:

Papers with code

PWP is probably the best resource I’ve come across.

Language interference

Reddit about this topic – I think I need to narrow the field of the thesis and focus on two languages.

Ensemble learning

…would be very interesting to use. “Native language identification using ensemble learning” is a nice title. :) And gives me the opportunity to play with really a lot of algorithms.

Recording microphone and speaker

With openbroadcaststudio, obs. For now it creates a video, to extract the audio: ffmpeg -i 2019-04-10\ 18-27-43.flv -map 0:1 -vn output.ac3.

Todo: how to do it without obs, or with obs – how to do it without video.

Taking screenshots at regular intervals

The command is pretty predictable:

while true; do scrot -d 5 '%Y-%m-%d-%H:%M:%S.png' -e 'mv $f ~/Pictures/'; done for every 5 seconds

Stack

  • Remove delay when inserting sudo password

Thesis

Current results

I looked again at the confusion matrix, after having made a copy. It’s quite interesting:

array([[29, 14, 28, 26],
       [38, 57, 36, 27],
       [52, 18, 58, 28],
       [18, 14, 18, 39]])

This is a simple SVM, using extremely simple features, and 2000 examples per class. The columns/rows are: ar, jp, lib, it, in that order. My first error is that Arabic and countries which are around Libya are quite similar in my world, linguistically, and we can see that they are confused quite often, in both directions. Italy and Japan do much better.

  • Get more and better (linguistically more different) data.
  • Work with more interesting features.

Still, ich finde das sehr vielversprechend, and definitely better than chance. And logically it makes sense. I’ll continue.

Countries with the most Twitter users

The list. I’ll stick to Japan, UK, SA, Brazil, India – quite between each other, geographically and linguistically. I leave the US alone, too mixed.

Bounding boxes

This is the picker. DublinCore format is in the identical order as Twitter wants!

Probably the plan would be

  • Getting the dataset
    • Except the 5 languages I already have, add a similar one to the ones already available, to see how much confusion between the two I get at the end.
      • Added Mexico!
  • Preprocessing
    • Replace URLs and @mentions by tags.
    • Replace the actual words with their POS Tags
      • Leaving the Emoticons alone, since they are probably quite geographically distant
      • Leaving the usual punctuation and stop-words alone, since they probably are exactly what I need
    • Remove all usernames which contain ‘bot’ in their username
    • Find all tweets that are similar to each other by whatever metric and remove all of them too
      • This would work much better than what I could manually do, I can’t think of all possible robotic tweets
    • Then tokenize the resulting thing the usual way
  • Ensemble learning
    • I can get a number of classifiers and use some kind of voting procedure
    • BoW is counterproductive in my case, because too many geographical names and topic names. BUT it would be fascinating to get tweets from the same authors a number of years before, and compare if BoW gets less effective for these old tweets. I think it would be too focused for the ephemeral Twitter universe, if there’s an election in Brazil it will happily decide that all tweets containing ‘election’ are Brazilian - a comparison with old tweets would help me test this hypothesis. And give the user a choice at the end if the prediction should be done using everything or everything except BoW.

To research

  • Author profiling
    • By what markers is this usually done? Can I use some of them?

      For tomorrow/later

  • Finish doing the preprocessing script
    • In: the .csv
    • Out: Whatever I can import in Jupyter, with all the features etc

Pandas

Leave rows with values from a certain list

d[d.co.isin(['uk','in'])] leaves the rows where co==’uk’ or co==’in’.
For multiple conditions, df.loc[(df['column_name'] >= A) & (df['column_name'] <= B)]
TODO: Why is .loc used here?

Random/thoughts

  • Would putting an uninterrupted block of learning at the very beginning of my day help me?
  • This might become a very nice experiment – do it for 30 days and see what happens. If I sleep well I’m on my best in the mornings, apparently.
  • Publishing papers with markdown

ssh

Has a config file! This opened a new universe for me too.

Nearlyfreespeech ssh via public key

The key needs to be added from the panel, adding it to the user folder as usual does not work.

Stack

Taskwarrior negating filters

t id!=123, works with everything.

Python2

For unicode strings, do “unicode string”.encode(‘utf-8’)

SSH

Exiting a dead SSH session

SSH can handle commands. From the blog post above: <Enter>~.
SSH parses commands sent after a newline and ~. ~. is the one to exit.

SSH config files

In ~/.ssh/config.

Host host1
    HostName ssh.example.com
    User myuser
    IdentityFile ~/.ssh/id_rsa

allows to just do sh host1.

… Still amazed by Linux and the number of such things. If I ever planned to do Linux much more professionally, I would just sit and read through all the man pages of the typical tools, systematically.

Stack

I need to make this Diensttagebuch searchable from the website, not just locally with :Ag.

The Internet is wonderful

Thesis

This is an excellent paper about Reddit and more focused on orthoographic errors. Will read next!
And this is an awesome annotated dataset, exactly the kind I need.

Stack

Add search to this blog via this simple js

To watch: Hacking democracy with theater

Quotes

It was a small Army Security Agency Station in Southeast Asia that I was doing some work for. They had a shrink and he pulled me aside. In just 10 minutes or so he taught me “breathing”. It wasn’t until the internet that I learned the term mindful breathing. Subsequently I figured out it was some sort of meditation. [..]

He said I was ‘wrapped to tight’. What ever that means. Those guys were all spooks, but I did not have the same clearances. I was an outsider in that regard, but I did eat with them when at their place. I guess he was bored.

He took my blood pressure and then taught me to breathe. Then he took it again. I was surprised at the drop. It hooked me on mindful breathing. It was probably a parlor trick, but it worked. He improved my lifetime health. For that I thank him.
(from reddit)

Linux PDF forms

Okular can fill and save PDF forms. Zathura can open already filled forms.

Converting PDF to PNG, much better method than convert

pdftoppm input.pdf outputname -png
pdftoppm input.pdf outputname -png -f {page} -singlefile It works much better than convert.

Timewarrior

timeww continue continues the last tracked thing

Python multiline comments

Even though stylistically questionable (PEP8 favours multiple multiline comments), one possibility is to use """ mycomment """; when they are not a docstring they are ignored. (source). They have to be indented right though. And feel kinda wrong
Additionally:

triple-quotes are a way to insert text that doesn’t do anything (I believe you could do this with regular single-quoted strings too), but they aren’t comments - the interpreter does actually execute the line (but the line doesn’t do anything). That’s why the indentation of a triple-quoted ‘comment’ is important. – Demis Jun 9 ‘15 at 18:35

Quotes

Get things out of your head and into a system that you fully trust. Everything you do should have positive value – it’s either improving you (I put self care and genuine leisure time in here, but not time wasting), improving a relationship, making money, or making one of those other things more efficient. Do high energy and high focus things when you actually have energy and focus; do mindless things when you feel mindless. Do not skimp on self-care, which includes genuine leisure time, good healthy food, exercise, good personal relationships, and adequate sleep. Aim for the “flow state” in everything you do, because you’ll never be better than when you’re so engaged that you lose track of time and place and just get lost in the moment. (How I get things done)

I find that forcing myself to think about those things at the pace of my handwriting brings a ton of clarity to the ideas I’m struggling with or the life issues I’m trying to figure out. (same source)

it’s easy to sleep well when you get up early and work hard. (same source)

“No more yes. It’s either HELL YEAH! or no.” — Derek Sivers

Random

I need a system to consistently track things I’m trying to optimize in my life. Today I already read N articles about excellent things I can do with my life, and usually it would end at it. Probably the first in line would be reinforcement and mental contrasting.

On a certain level we actually bump aganst the infinitely familiar thing about not knowing what I want.

The plan

  • From now on, if I read something motivational in the morning, it should be one thing. And focus on it, think on it, only on it.

DNB and Typing

460 cpm 98%

d4b 14% Thu 18 Apr 2019 12:54:55 PM CEST
d4b 0% Thu 18 Apr 2019 12:56:50 PM CEST
d4b 11% Thu 18 Apr 2019 12:58:46 PM CEST
d3b 85% Thu 18 Apr 2019 01:00:22 PM CEST !
d4b 50% Thu 18 Apr 2019 01:03:42 PM CEST
d4b 17% Thu 18 Apr 2019 01:05:37 PM CEST
d4b 50% Thu 18 Apr 2019 01:07:32 PM CEST
d4b 61% Thu 18 Apr 2019 01:09:28 PM CEST
d4b 67% Thu 18 Apr 2019 01:11:25 PM CEST
d4b 50% Thu 18 Apr 2019 01:13:19 PM CEST

Pandas

I’m familiar with most of this, but since I find myself googling it every time, I’ll just write it here, so I’ll know where to loo.

Scipy-lectures.org

Scipy Lecture Notes seems like a very interesting place.

Concatenate dafaframes

pd.concat([d, dd]) concatenates them leaving the same columns. pd.concat([d, dd], ignore_index=True) concatenates them leaving the same columns and having a common id column. pd.concat([d, dd], axis=1) merges them horizontally, that is there will be all the columns from the input dataframes.

Seaborn multiple distplots on the same graph

The article

Seaborn plt and labeling

Apparently sns.plt is a bug which has been fixed. Nice. Regardless, the new correct way is import matplotlib.pyplot as plt; plt.....

Pandas multiple conditions filtering

dsa[ (dsa.char_count>190) & (dsa.char_count<220) ]

Jupyter – making cells 100% wide

from IPython.core.display import display, HTML display(HTML("<style>.container { width:100% !important; }</style>")) inside a cell (SO)

Thesis

I have my semi-final dataset, today I’ll clean it, analyze, and output it to some clean.csv file. Along with creating a script that cleans the data, for all the repetitive things I’ll have to do.

Analyzing the dataset

0418-analysis-of-final-dataset.

What I did

  • Added quite a lot of features.
    • token_count != pos_count.
    • Counts of POS are relative.
  • Currently I have many more UK tweets than others - but I should have at least 10000 tweets for each language.

    Interesting stuff

  • Twitter does not count @replies in its character count
    • This is why sometimes we get such bundles of joy of 964 characters:

      ‘@FragrantFrog @BourgeoisViews @SimonHowell7 @Mr_Bo_Jangles_1 @Joysetruth @Caesar2207 @NancyParks8 @thetruthnessie @carmarsutra @Esjabe1 @DavidHuddo @rob22re @lindale70139487 @anotherviv @AndyFish19 @Jules1602xx @EricaCantona7 @grand__wazoo @PollyGraph69 @CruftMs @ZaneZeleti @McCannFacts @ditsy_chick @Andreamariapre2 @barragirl49 @MancunianMEDlC @rambojambo9 @MrDelorean2 @Nadalena @LoverandomIeigh @cattywhites2 @Millsyj73 @strackers74 @may_shazzy @JBLittlemore @Tassie666 @justjulescolson @regretkay @Chinado59513358 @Louise42368296 @TypRussell @Anvil161Anvil16 @DuskatChristie @McCannCaseTweet @noseybugger1 @HilaryDean15 @DesireeLWiggin1 @M47Jakeman @crocodi11276514 @jonj85014 If it was in the Scenic several weeks after she was reported missing.Her body must have been put there.!\nWho by ?The people who hired the Scenic ! How hard is that to understand ?\nThis algorithmic software gives a probability of the identity of each contributer to the sample !\n😏’

  • Otherwise, we get a pretty similar distribution. Except also the 200 characters effect that’s especially pronounced in SA - do they use old clients or something similar? Burndown

Now playing: The Godfather II Soundtrack

Possible ideas for additional cleanup

  • I can just remove from the text the all the @mentions except the first two. That would still give me a difference between replying to one or to multiple people, but I would assume would fare much better with various NLI stuffs.

Thesis

Stylometry

Can I use some of the insights/methods/ideas from stylometry for this? (After reading this article about Beowulf.

Quotes

Will become a problem. I can just remove all tweets containing any quotes symbols(', ") after checking how many are there.

Stack

DNB and Typing



Stack

DNB and Typing

d3b 79% Sat 20 Apr 2019 11:18:34 AM CESTh
d3b 71% Sat 20 Apr 2019 11:20:10 AM CEST
d3b 71% Sat 20 Apr 2019 11:21:44 AM CEST
d3b 100% Sat 20 Apr 2019 11:23:16 AM CEST
d4b 56% Sat 20 Apr 2019 11:25:31 AM CEST
d4b 50% Sat 20 Apr 2019 11:27:26 AM CEST
d4b 50% Sat 20 Apr 2019 11:29:24 AM CEST
d4b 17% Sat 20 Apr 2019 11:31:18 AM CEST
d4b 40% Sat 20 Apr 2019 11:33:13 AM CEST
d4b 50% Sat 20 Apr 2019 11:35:15 AM CEST
d4b 56% Sat 20 Apr 2019 11:37:06 AM CEST

Thesis

Stopwords

What would happen if I actually used them as one of my features, leaving the non-stopwords text alone? Here’s a long list

Scikit-learn

Label-encoder

sklearn.preprocessing.LabelEncoder for converting categorical data to a numerical format.

>>> from sklearn import preprocessing
>>> le = preprocessing.LabelEncoder()
>>> le.fit([1, 2, 2, 6])
LabelEncoder()
>>> le.classes_
array([1, 2, 6])
>>> le.transform([1, 1, 2, 6])
array([0, 0, 1, 2]...)
>>> le.inverse_transform([0, 0, 1, 2])
array([1, 1, 2, 6])

Latex

Subfigures / subfloats, pictures side by side

\begin{figure}[ht!]
    \centering
    {%
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{/home/sh/p/ms/p/p/pics/scanned/1888.png}
        \caption{Picture 1}
        \label{fig:1}
    \end{subfigure}
    %
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{/home/sh/p/ms/p/p/pics/scanned/1888.png}
        \caption{Picture 2}
        \label{fig:2}
    \end{subfigure}
    }%
\end{figure}

DNB and typing

505 cpm 98.8%
535 cpm 98.1%

Quotes

“When I look into the future, it’s so bright it burns my eyes.” — Oprah Winfrey (as quoted here)

Interesting

This HN thread has an interesting consensus that Colemak > Dvorak. Also:

I firmly believe that any differences or gain that people attribute to Dvorak is attributed to finally learning how to properly type.

Hmm.

Thesis

I need a plan. Which I will formulate later today. Meanwhile, any of the papers by Volkova seem very relevant to what I’m trying to do. Though I think after a number of them I’m not getting any additional value from them. We’ll see.

Papers will be numbered in green colour with numbers [1], parts in the paper will be numbered in green in a circle and marked (1).

Main points

  • Shorter texts are harder to analyze – try to download more tweets from the users? And mix them to remove style.
  • Grammar checks and replacements are fascinating to do and analyze, do them
  • Baseline for accuracy
  • Download and look at the reddit dataset

Papers

NLI with User-generated Content [1]

Main points
  • The dataset and the L2 project of the Uni of Haifa
  • It has interesting baselines which I can use in my thesis as example..
  • (1) is an example why geography =! language
  • Filtering data from multi-language countries.
  • They have 230 million sentences, much more than I do. Is this the number of examples I need?
  • n-grams etc are very context/dependent, what I mean with TW and political stuff happening. They should yield high acc on training set but generalize poorly.
  • Spelling and grammar
    • original word and correction offered by spell checker
    • Grammar checked by LanguageTool (2)
  • Frequencies of function words
  • Trivial baseline for classification tasks
  • Nice table of how much the features were relevant, p.3596 (3)
  • "”the personal style of whe user may dominate thesubtler signal of his or her native language”
  • Substitutions as suggested by spell checker should be fascinating.
  • Shorter texts are much harder (6)
    Todo
  • Download tweets by the same users to get a bigger corpus of things I can compare them from. Or, to protect myself from the influence of stylistics, just get many many more tweets.
    • If it goes bad – just categorize users with Twitter meta-data as features, and by downloading their last X tweets in a certain language.
  • Much easier to do native/nonnative and language family than language
    Interesting language:
  • To the best of my knowledge,
  • Related but different
  • accurate, albeit not perfect, proxy for the NL of the author.
  • Reasonably robust to

NATLID: Native language identification [2]

Main
  • g authorship profiles
  • NLI is challenging even for humans.
  • in a CNN smaller (2-3) filter sizes work better (3)
  • Ensemble model, with a voting scheme proportionate to the acc of the models (4)
  • Spoken responses are easier to NLI because the written ones are supposed to be more formal and thought-out.
    • Which might be a win-win for my Twitter data. Should be much less thought out than essays, and much more of the L1 should “shine” through them!
  • Highest misclassification between close languages. - This is why I added BR to MX.
    Todo
  • g arc length, downtoners and intensifiers, production rules, subject agreement – as features. (2)

A brief survey of text mining: Classification, clustering and Extraction techinques [3]

Main
  • hard vs soft classification: hard is when you get a result, soft is where you get a probability for result.
    • SVM do hard classification, but you can modify them to give a probability
  • Naive Bayes works for independent input variables..
  • SVM rarely need feature engineering because it selects support vectors itself. It’s robust to high dimensionality. Text classif. is mostly sparse data - a really okay use case for SVMs. (3) is a description of why SVM work so well for NLI.
  • (4) “Text representation has a very large dimensionality, but the underlying data is sparse.” - ESPECIALLY SO FOR MY USE CASE.

  • In topic models, docs are a mixture of topics, where a topic is a prodbability dist over words
TODO
  • Read through again, understand and grok (1) all vector space models and math.
  • Grok Naive bayes.

Text classification: A recent overview [4]

Main
  • Text classification is not too different from ML, main problem is text representation.
  • BoW is not less effective then counting, because words are unlikely to repeat
    • Especially so in my use case!
  • Imbalanced data problem - cost sensitive learning is needed (3)
  • Accuracy is not a good metric for an inbalanced dataset.
    • Both of the above point to a source [4]
Todo
  • g Latent Semantic Indexing
  • g source [4] in this paper
Ideas
  • Ensemble learning, with 2 versions: one with text-dependent (BoW, n-grams), and one without, give results for both (or give the user a choice if I make it an app at the end)

Worst case scenario plan

Just do native vs nonnative, which should be pretty easy. Define native as “UK”

For tomorrow:

  • g adaptor grammar collocations, Stanford dependencies, CFG rules, Tree Substitution Grammar fragments. (Reddit paper, (2))
  • g weaker but more robust (3)

Pandas

Feature importance

Inspecting the importance of features when running Random Forest:

feature_importances = pd.DataFrame(rf.feature_importances_,
                                   index = X_train.columns,
                                    columns=['importance']).sort_values('importance',                                                                 ascending=False)

pandas shuffle

df.shuffle(frac=1) uses the shuffle function for this.

Language

  • for illustration purposes and with no loss of generality, ..

    Order after groupby()

    It’s kinda logical, but if I group stuff, it gets saved in the same order.

The internet is wonderful

vim.wasm

Vim has a default escape keymap

Ctrl-[. This is better than my qj configured one actually.

API Design

API Documentation

An example of how to document one

Uploading files (“Why multipart mostly sucks”)

nice, esp. their description of youtube’s resumable upload.

Java Spring @Services

This is a tutorial where they move the business logic to a @Service, which is another nice example. Also I have not seen .htm in a long time.

Test a REST API with curl

The tutorial

 curl -F file=@/home/sh/nl http://localhost:8080/upload
 curl -v localhost:8080/download/file

Curl examples is even better.
` curl -i -X POST http://localhost:8080/delete -d ‘filename=test’\\ Everything after -d` is data.

Exception handling in Sprint

A number of methods described well

Springboot install

via sdkman: sdk install springboot

Programs

pinta is a nice simple image editor for linux.

Recording terminals with asciinema

asciinema rec to start recording, Ctrl-D or exit to stop recording. It’s really really neat!

Swagger API documentation

Tutorial;

CURL debugging REST (with GET, PUT, etc)

curl -X PUT -F file=@/home/sh/nl http://localhost:8080/files/nll

curl -X DELETE http://localhost:8080/files/nl

curl -F file=@/home/sh/nl http://localhost:8080/files/ 
(or to be precise)
curl -X POST -F file=@/home/sh/T http://localhost:8080/files/

Data is sent with -d "id=value"

Spring testing

My future client

Firefox extension bug and choosing a profile

firefox --ProfileManager opens the profile dialog.

Git add (git add * vs git add -A vs git add .)

Summary:

  • git add -A stages all changes
  • git add . stages new files and modifications, without deletions
  • git add -u stages modifications and deletions, without new files

(from SO)

DNB






English

“Buy the farm” in North American slang for dying.

When a military pilot with a stricken airplane attempted to crash land in a farmer’s field, he would destroy a portion of the farmer’s crops for which the US government paid reimbursement to the farmer. If it were a bad crash-landing destroying most of the crops then the crash would cause the buying of the whole farm

Firefox resistfingerpringing setting

The flags privacy.resistfingerprinting.* in about:config. Let’s test this and see what happens.

Presentations format

Clear is better than clever uses a nice way to publish a presentation: slide on top and any test notes on the bottom. Never seen that before and it’s nice.

Articles

Kernighan’s layer

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it? Main points:

  • Implement below your ability, and you get to debug in the “flow” area.
  • Implement at your ability, and the debugging will be frustrating, but you gain skill.

Quotes

stop starting and start finishing (HN)

Stack

Chrony would solve most of my NTP problems.

Latex absolute positioning of images

\begin{picture}(50,50)
\put(200,-300){\hbox{\includegraphics[scale=0.3]{file}}}
\end{picture}

(from SO)

Adding LaTeX to Jekyll/Markdown/Webpages via Mathjax

This is freaking amazing.

Mathjax. For inline math:

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>

This gets added to whatever template in Jekyll, usually _layouts/post.html. Used this in my MPT notes. Where was this my first 6 years of uni?

DNB



Latex multiple pictures on one page

\begin{figure}[ht!]
    \vspace{8mm}
    \centering
    {%
    \begin{subfigure}[b]{0.4\textwidth}
        \includegraphics[height=0.4\textheight]{/home/sh/p/ms/p/p/pics/scanned/1888.png}
        %\caption{Picture 1}
        \label{fig:1}
    \end{subfigure}
    \begin{subfigure}[b]{0.4\textwidth}
        \includegraphics[height=0.4\textheight]{/home/sh/p/ms/p/p/pics/scanned/1889.png}
        %\caption{Picture 2}
        \label{fig:2}
    \end{subfigure}
    }%
\end{figure}

\vspace{8 mm}

\begin{figure}[ht!]
    \vspace{8mm}
    \centering
    {%
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[height=0.37\textheight]{/home/sh/p/ms/p/p/pics/scanned/1900.png}
        %\caption{Picture 1}
        \label{fig:1}
    \end{subfigure}
    \qquad
    \begin{subfigure}[b]{0.6\textwidth}
        \includegraphics[height=0.37\textheight]{/home/sh/p/ms/p/p/pics/scanned/1927+.png}
        \caption{Picture 2}
        \label{fig:2}
    \end{subfigure}
    \qquad
    }%
\end{figure}

… I feel the above is wrong on many levels, but I’ll leave this here. I need to research better pictures with different sizes and floats. Or just read a book about latex from A to Z

Vim comments plugin

Nerdcommenter. To comment: <leader>cc. <leader>cn for forced nesting. To toggle: <leader>c<space>.

If the topmost selected line is commented, all selected lines are uncommented and vice versa. <leader>cA goes to end of the line, inserts a comment and goes into insert mode.

Latex % character at the end of the line

A % allows you to go to a newline without adding a space.

Zathura side-by-side view

Side-by-side view is toggled by d. Also set first-page-column 1:1 changes which page gets shown first.

LaTeX page width

\paperwidth, not “pagewidth”.

Stack

  • Remember that Eisenhower Matrix is a thing and that it used to help me quite a lot before.
  • I should formalize all the checklists I created for myself and use them.
  • Look into Energy Management vs Time management
    • https://hbr.org/2007/10/manage-your-energy-not-your-time
    • https://www.coachingpositiveperformance.com/energy-management-vs-time-management/
    • etc.

Markdown

  • A | character doen’t play nice with bullet point lists (*) - why?
    • Seems to be related to tables

Timewarrior “multitasking”

You can’t do simultaneous stuff, but you can have simultaneous test. From SO:

    timew start MONITORING PROJECT1 # monitoring all day, starting with project 1
    timew start MONITORING PROJECT1 PROJECT2 # adding project 2 to the pool
    timew stop PROJECT1 # done with project 1, still monitoring and working at project 2
    timew start MONITORING PROJECT2 PROJECT3 # adding project 3
    ... # something similar with PROJECT4 and PROJECT5
    timew stop # done for today

To read

The Nitrous Oxide Philosopher

DNB



Quotes

“Think in the morning, act in the noon, read in the evening, and sleep at night.” Blake

Stack

  • Formalize my Sprint reviews.
  • Three works a week of PI – how do I actually keep track of this? I need an infrastructure.

Markdown

Block-level attributes in Jekyll/kramdown/markdown

This describes amongth other things block-level stuff for Markdown. This is potentially a solution for different footnotes and various other small design tweak I’d like to have on this blog. I can just add a CSS class and then in CSS see what I want to do with it.

Git diff a file between revisions

git diff HEAD^^ HEAD file.md – where HEAD^^ is “two revisions back”. Also the option --compact-summary gives number of insertions and deletions.

Anki steps

It’s an interesting thing to research someday. This discussion and similar ones can be a reference, along with looking at the graphs and targeting 80% retention.

In general I really should invest an hour or so to learn everything about Anki, so far it’s been the single most effective tool I have for my memory but am using it on a default and primitive level.

For now I changed Steps to “1 10 60” and “10 60”, new interval to 30%.

To print for The Road

  • https://mnielsen.github.io/notes/quotes/quotes.html
  • https://www.cl.cam.ac.uk/~afb21/CognitiveDimensions/CDtutorial.pdf
  • https://github.com/progit/progit2/releases/download/2.1.146/progit.pdf
    • till page 123 or so
  • https://colah.github.io/posts/2015-09-Visual-Information/

After another small pause, here comes another längliches post!

Urxvt -name and settings

I had been trying to get urxvt to play with i3 scratchpads, but when I set the -name setting I got a vanilla URxvt look.

You evidently configured the font for a specific application instance rather than for an application class. (SO). To make your settings always apply, set URxvt.font rather than urxvt.font, etc.

Solved my problem.

Though at the end, I spent some time looking for a way to grep “name” instead of “class” for URxvt in bspwm and gave up, now typing this on a st terminal and loving every second of it!

st

Is the terminal I might start to use everywhere.

In config.h I changed the font to be static char *font = "DejaVu Sans Mono:pixelsize=12:antialias=true:autohint=true";

Bspwm

Decided to give it a try, loving it!

Scratchbox

To implement the scratchbox, used the method described in the Arch wiki.

In bspwmrc,

t -c scratchterm &
bspc rule -a scratchterm sticky=on state=floating hidden=on

In sxhkdrc,

super + minus
    ~/s/scratch

In ~/s/scratch,

#!/usr/bin/env bash
id=$(xdotool search --class scratchterm | head -n 1)
echo $id

if [ "$id" != "" ]
     then
       bspc node "$id" --flag hidden -f
       fi

I added |head -n 1 so it can better deal with possible multiple terminals of this class, in case I have to restart bspwm for whatever reason.

Random

  • The hype cycle of working memory training
    • near transfer is much more likely and proven than far transfer
    • in general doesn’t look to optimistic
    • High IQ/WM people benefit the most
    • High spacing seems the best for transfer
      • might be related to all those other “pauses are good you learning” effects
  • Spectrometer using a CD
  • ‘I’ve become very isolated’: the aftermath of near-doomed QF72
    • Like a bad partner, the computer’s systems went crazy then stopped communicating with me.

    • I’ve become very isolated. When you’ve been to the Moon, you can only talk to astronauts.

  • The Copenhagen interpretation of ethics
    • Excellent.
    • The Copenhagen Interpretation of Ethics says that when you observe or interact with a problem in any way, you can be blamed for it. At the very least, you are to blame for not doing more.

    • The program was helping as many people as it could, the only change was explicitly labeling a number of people it wasn’t helping as a “control group”. The response?
      “They should immediately stop this experiment, ” said the Manhattan borough president, Scott M. Stringer. “The city shouldn’t be making guinea pigs out of its most vulnerable.”

Arch compiling AURs from source

Didn’t have to do this a long time:

  1. makepkg -Acs
  2. sudo pacman -U x.pkg.tar.xz

Bash dtb create.sh script

Updated the script to create a markdown dtb file to the following:

FILE=_posts/$(date +%Y-%m-%d)-day$(date +%j).markdown
DATE=$(date +%Y-%m-%d\ %H:%M:%S\ +0100)

if test -f "$FILE"; then
        vim $FILE
        exit 1
fi

echo "Creating file $FILE"
touch $FILE
echo "Adding stuff"

/bin/cat <<EOM >> $FILE
date:   $DATE

EOM

vim $FILE

Now it’s closer to create_or_open.sh and doesn’t overwrite anything if run again by error, doesn’t add any unused parts, and opens the file if it exists already.

Bash check if file exists

if test -f "$FILE"; then
        vim $FILE
        exit 1
fi

Bash exit script

exit 1 or whatever status code.

Bash suppress output of command (bash redirection)

SO:

command > /dev/null 2>&1 redirects both stdout and stderr to /dev/null;

command &> /dev/null & works for me too, though it may not work in all shells. command > /dev/null still shows errors.

Progress notes

Added to anki everything until this page on the pro git ebook

LSD and installing fonts in st and urxvt

LSD is a very nice replacement for ls. To set it up, I needed to download the individual fonts from Nerd fonts, cp-ing them to /usr/share/fonts, then running fc-cache -f -v.

To set up the new DejaVu font in urxvt, this is the line in .Xdefaults:

URxvt.font: xft:DejaVuSansMono Nerd Font Mono:pixelsize=12
URxvt.boldFont: xft:DejaVuSansMono Nerd Font Mono:pixelsize=12:weight=bold
URxvt.letterSpace: -1

And in st, config.h is:
static char *font = "DejaVuSansMono Nerd Font Mono:pixelsize=12:antialias=true:autohint=true";

AUR has a BIG nerd-fonts-complete package with all the fonts.

bspwm, polybar and multiple monitors

Following the advice in this article:

bspc monitor HDMI-0 -d 1 2 3
bspc monitor eDP -d 4 5 6 7 8 9 0 a b c

in bspwmrc, and

polybar example &
polybar big &

in launch.sh, and

[bar/big]
monitor = HDMI-0

[module/bspwm]
used = %name%
label-occupied = %name% 
label-urgent = %name%!
label-empty = 

in polybar/config.

Also to make the tray appear only on the right monitor, I commented out ; tray-position = right on the HDMI monitor, now it appears again on eDP.

They work a bit different than i3 – the workspaces I list in each of the monitors in bspwmrc are accessed sequentially via the keyboard. That is, in the config above, f1..f4 get accessed with Mod+1..4, and Mod+5..x access the I..X ones. I think they get cycled from the left monitor to the right one, but definitely not in the order the monitors are set up in bspwmrc and not alphabetically.

bspwm config changes

Stolen mostly from dotfiles in this repo:

bspc config pointer_follows_monitor true # brings pointer to focused monitor (see workspaces)

and in polybar/config

[module/bspwm]
label-empty =

Amongst other things – I’m not sure how to move my windows from the HDMI workspaces if I disconnect the second monitor from the computer, partly it means I’m (I think, for now) limited to a number of workspaces in each of the monitors. I’m not sure I miss the flexibility of this process in i3 - it might be a good opportunity to play with a much more structured number of workspaces. Maybe I don’t need the flexibility as much as I think.

bspwm/firefox go fullscreen (F11) but stay inside the bspwm window

full-screen-api.ignore-widgets in about:config (from here) is the best thing since sliced bread. I can F11 firefox, but it doesn’t occupy my entire monitor, just removes tabs/url/…, and I can still use Tree tabs. It’s very close to what I used to do with pentadactyl. This is freaking awesome.

pikaur full system upgrade

Works the same way as with pacman. Interesting that I never thought about this. sudo pikaur -Syu

redshift change day/night temperature

Updated startup.sh to use redshift with a warmer nighttime temperature: redshift -l 51.34:12.38 -t 6500:3000

Also I’m not sure I like the use -l both for location provider and lat/long info. I think I understand the logic, but still..

Stack

  • Add spoilers to Jekyll.
  • Check again laptop-mode
  • In general document all my settings well in one place.

Random

Quotes

If you never heal from what hurt you, you’ll bleed on people who didn’t cut you

Spoilers in HTML and now Markdown (kramdown)!

CLICK ME

# I need to add

markdown="1"
to all HTML tags where I want to write markdown. This one is inside a child without the setting.
print("hello world!")
Got this from here

I am a child with the markdown setting within a child with a markdown setting

I should look into markdown options which would allow me to do more flexible CSS – and I could create a vim mapping to make them quick.

Firefox Vimium switch to tab N

Added the following to the Vimium settings, now I can switch to tab N by pressing the respective number on the keyboard:

    map 1 firstTab count=1
    map 2 firstTab count=2
    map 3 firstTab count=3
    map 4 firstTab count=4
    map 5 firstTab count=5
    map 6 firstTab count=6
    map 7 firstTab count=7
    map 8 firstTab count=8
    map 9 firstTab count=9
    map 0 firstTab count=0
My entire Vimium config
# Insert your preferred key mappings here.

map L Vomnibar.activateEditUrl
map  l scrollLeft
map  h scrollRight

map  B goBack

map  o LinkHints.activateMode
map  a LinkHints.activateModeToOpenInNewTab
map  A LinkHints.activateModeWithQueue

map  <c-p> togglePinTab
map  <c-к> togglePinTab



map  , showHelp
map  о scrollDown
map  л scrollUp
map  р scrollLeft
map  д scrollRight
map  пп scrollToTop
map  П scrollToBottom
map  яР scrollToLeft
map  яД scrollToRight
map  <с-у> scrollDown
map  <с-н> scrollUp

map  в scrollPageDown
map  г scrollPageUp
map  к reload
map  пы toggleViewSource

map  ш enterInsertMode

map  Р goBack
map  Д goForward
map  пг goUp
map  пГ goToRoot

map  пш focusInput

map  а LinkHints.activateMode
map  А LinkHints.activateModeToOpenInNewTab
map  <a-а> LinkHints.activateModeWithQueue

map  . enterFindMode
map  т performFind
map  Т performBackwardsFind

map  хх goPrevious
map  ъъ goNext

map  нн copyCurrentUrl
map  на LinkHints.activateModeToCopyLinkUrl

map  з openCopiedUrlInCurrentTab
map  З openCopiedUrlInNewTab

map  Л nextTab
map  О previousTab
map  пе nextTab
map  пЕ previousTab
map  п0 firstTab
map  п; lastTab


map  ц moveTabToNewWindow
map  е createTab
map  не duplicateTab
map  ч removeTab
map  Ч restoreTab

map  щ Vomnibar.activate
map  Щ Vomnibar.activateInNewTab

map  Е Vomnibar.activateTabSelection

map  и Vomnibar.activateBookmarks
map  И Vomnibar.activateBookmarksInNewTab

map  па nextFrame

map  ь Marks.activateCreateMode
map  ё Marks.activateGotoMode

map  <a-з> togglePinTab

map  ББ moveTabLeft
map  ЮЮ moveTabRight

map  м enterVisualMode
map  М enterVisualLineMode
map 1 firstTab count=1
map 2 firstTab count=2
map 3 firstTab count=3
map 4 firstTab count=4
map 5 firstTab count=5
map 6 firstTab count=6
map 7 firstTab count=7
map 8 firstTab count=8
map 9 firstTab count=9
map 0 firstTab count=0

Vimium close pinned tab

With x, it’s nice, because my usual <C-w> doesn’t close pinned tabs and I have to unpin them to close them.

Markdown inserting images with caption

Apparently this is the officially right way to do it (see SO):

<figure>
  <img src="https://pchr8.net/assets/image.jpg" alt="my alt text"/>
  <figcaption>This is my caption text.</figcaption>
</figure>

I changed it by adding the path in image.html, since apparently you can’t have curly brackets inside includes (I’m not sure how the SO answer works).

Since I may end up doing this often, I created a new include for dtb based on this answer:

<figure class="image">
    <img src="{{site.url}}{{site.baseurl}}/assets/{{ include.url }}" alt="{{ include.description }}">
  <figcaption>{{ include.description }}</figcaption>
</figure>

to be used as

{% include image.html url="thesis/firstdata.png" description='Figure 1. Language of the collected tweets.' %}

On Linkedin there’s a nice description of what should the “related work” section look like.

Thesis mercator bounding boxes

In the notebook “Drawing_bb_on_merc_map” there are now a couple of functions that given the DublinCore coordinates output a mercator map with the rectangles highlighted.

h1 / h2 in Jekyll

Apparently you can’t use h1 in your own content: SO and overwriting /assets/css/minima.scss doesn’t seem to work for me. Я подумаю об этом завтра for now using ugly HTML with the post-title class hardcoded.

Technical writing errors

3 shell scripts to improve your writing, or “My Ph.D. advisor rewrote himself in bash.” is an excellent description of typical errors in technical writing. One of the pages I see that make me want to archive everything linked here and on the Link Wiki just in case it disappears. Also,

In that sense, peer reviewers are the guardians of the scientific community’s most limited resource: our collective attention span.

Sins

  • weasels="many|various|very|fairly|several|extremely\
    |exceedingly|quite|remarkably|few|surprisingly\
    |mostly|largely|huge|tiny|((are|is) a number)\
    |excellent|interestingly|significantly\
    |substantially|clearly|vast|relatively|completely" 
  • passive voice
  • Duplicates

Stack

  • Should I add important quotes I want to read often in Anki instead of creating my own solution for basically the same thing?
  • Python built-ins worth learning

Language / German

  • 10-er – it’s like ‘sechziger’, ‘neunziger’ etc. - just never seen it. It works to say ‘десятки’ too (as opposed to ‘1-er’)
  • Vorkommastelle, nachkommastelle

Quotes

Let the past die, kill it if you have to.

Quotes

There are two sorts of comments - “What” comments and “Why” comments.

“What” comments tell you what the code is doing. In a lot of cases, depending on the language, the need for these can be reduced by writing clear code. This is much easier in, say, Python than Assembly. Even in Python though, sometimes you can be doing something a bit subtle where a 2 line comment can clear things up. These comments aren’t irreplaceable because with a bit of reading and work, you have all the information to work out what is happening.

“Why” comments are much more important - telling the reader WHY the code is doing whatever it is that it’s doing. The ‘trim()’ comment referenced in the article is a great example of a Why comment - all the reading around the code wouldn’t give you an explanation (although sometimes git blame will).

Many ‘what’ comments are superfluous, almost no ‘why’ comments are - they are the collective memory of design decisions that otherwise lives in people’s heads. (HN)

Linux sandboxing

For programs I don’t trust, Firejail seems okay. firejail <appname>.

Android ADB Push

Still works as I remembered it. adb push <sourcefile/s> <location>, where location in my case is storage/sdcard0 for the memory and storage/FD... for the sdcard. adb shell is very nice also.

Stack

  • I should create additional vim maps for a better way to access other registers. I should create at least one more p/y/yy/d/dd commandd set for them and keep them separatee from the main ones.
    • Or just let vim have it’s own copy/paste registers and make pasting the OS ones a special case

Quotes

In college, I ran a painting business. Every painter I hired had to buy their own brushes. This was one of the first things I learned. Throwing a standard brush at new painters didn’t work. The “company” brushes were quickly neglected and degenerated into a state of disrepair. But painters who bought their own brushes took care of them. Painters who bought their own brushes learned to appreciate the difference between the professional $20 brush they owned and cheap disposable dollar store brushes. Having their own brush engendered a sense of enduring responsibility and craftsmanship. (from Codinghorror “The Programmer’s Bill of Rights)

rsync progress based on all files with pv

Allegedly there’s an official way, though I could not get it working: rsync -a --info=progress2 src dest What works is the second answer: rsync -aix /source remote:/dest | pv -les $(df -i /source | perl -ane 'print $F[2] if $F[5] =~ m:^/:') >/dev/null, and the general way rsync -ai /source remote:/dest | pv -les [number of files] >/dev/null.

To find number of files in general, ` find /source wc -l`.

Scratchpad with the DTB in bspwm

If it starts appearing on the wrong monitor, I can drag it to the right one, and its location will be remembered.

Repeat command with sudo in bash/zsh

sudo !!. This is awesome.

Pareto charts

TIL about Pareto charts, and they look very interesting. pareto chart

To take the example below, in order to lower the amount of late arrivals by 78%, it is sufficient to solve the first three issues.

Checklists

are the next thing that will save my life, we’ll see if they stick.

Week review

Random / Psychology

Карта чуств is absolutely brilliant. Feelings

Vim-mediawiki-editor

vim-mediawiki-editor might make the links wiki fun again for me.

Pandas

Jupyter/pandas output entire text in column without truncating

pd.set_option('display.max_colwidth', -1)
d[['co','otext']]

Pandas count occurrences of value inside a df row (and of values inside a list in a column)

I need to work on my descriptions. d['pos'] contains a list inside every row. I need to count the occurrences of a value inside this list. So I transform the list in a Series and then do value_counts, and each element of the list will be in its own column. The value of each column will be the number of occurrences.

d['pos'].apply(pd.Series.value_counts)

I can do .fillna(0) at the end to put a 0 instead of NaN.

Though this feel awfully slow. (And why doesn’t simply .tolist work?)

(SO)

Pandas latex code output

Apparently if text between two $s in the output of a command gets parsed like latex?

Quotes

Michael Crichton invented the term Gell-Mann Amnesia as a reference to Nobel-winning physicist Murray Gell-Mann, who remarked that even though the newspapers were always wrong about his area of expertise (physics), he always found himself trusting them about everything else. (SSC)

Thesis

0530_final_dataset.csv contains the final cleaned-up dataset with tokens, parts of speech, URIs/hashtags/mentions as their own POS, etc.

Zsh taskwarrior statusline indicator

Changed the statusline to the following:

function task_indicator {
    if [ `task +READY +OVERDUE count` -gt "0" ]  ; then
        #printf "%b" "\u$OVERDUE"
        printf "%b" "!!!"
    elif [ `task +READY +O count` -gt "0" ]  ; then
        #printf "%b" "\u$DUETODAY"
        printf "%b" "!!"
    elif [ `task +READY +A count` -gt "0" ]  ; then
        printf "%b" "!"
    else
        printf "%b" "\u$OK"
    fi
}
task="\$(task_indicator)"
addprompt=$task

Now in zsh the statusline gets changed based on the amount of important tasks still pending. More simple than what was before.

Quotes

“I’ve come up with a set of rules that describe our reactions to technologies: 1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works. 2. Anything that’s invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. 3. Anything invented after you’re thirty-five is against the natural order of things.” — Douglas Adams

“Be here now”

Aaaand from this Reddit thread:

  • “The mind is its own place, and in itself can make a heaven of hell, a hell of heaven.” From Milton’s ‘Paradise Lost’
  • “Don’t kill the person inside you who wants to be alive.” Every time I feel down and/or have suicidal thoughts, I think about the part of me who went through so much shit to get to this place. I don’t want to throw away the effort of that person.
  • Now I try and loosen up…moods come and moods go…I respect my feelings and those of others.
  • “My cat wouldn’t understand where i went.”
  • “If you’re going through hell, keep going.” - Winston Churchill
  • – My meds keep me goin, fuck a quote. – Yeah I was about to quote: “300mg buproprion” -Dr. Baker Fuckin inspirational!
  • “Bend, but don’t break.”
  • ” Fireflies love the dark too.”
  • “Only after disaster can we be resurrected. It’s only after you’ve lost everything that you’re free to do anything. Nothing is static, everything is evolving, everything is falling apart.”
  • None of these keeps me going. For me it’s curiosity and nothing else.
  • I think the saddest people always try their hardest to make people happy because they know what it’s like to feel absolutely worthless and they don’t want anyone else to feel like that. - Robin Williams
  • “Death doesn’t stop depression, it just spreads it to somebody else.”
  • “A smooth sea never made a skilled sailor” Franklin D. Roosevelt
  • ‘Get busy living or get busy dying’. From The Shawshank Redemption.

Stack

  • Make finally a uniform and nice vim/bspwm/… keybinding system.
  • Learn vim formally, all movements and everything, and get rid of my “vim antipatterns”

Vim

Vim digraphs

:digraphs to see the available digraphs. <C-k>+%digraph% inserts it. For example, <C-k>+Pd → £

Vim movements

  • '. - move to last modified line.
  • D - delete everything until the end of the line.
  • C - change everything until the end of the line
  • U - undo all changes to this line
  • S - substitute everything inside this line
  • <C-a> - increment number at character
  • <C-x> - decrement number at character
  • F/f – move to prev/next occurrence of character
  • T/t – move to before prev/next occurrence of character

Learn to use my ;->: mapping

Using I/we/passive in a Bachelor’s thesis

No easy answer, but I liked here the joke “In your particular case, an inclusive we could be used to recognize the nematodes collaboration :) – Dr. belisarius May 10 ‘11 at 13:01”

  • I asked another young professor whether one could use “I” and she said “Only if you want to sound like an arrogant bastard”, and observed that only old people with established reputations can get away with it.

  • The passive voice should not be used to avoid writing I or we. If the entire thesis is written in the passive voice, it is much harder to read, and the sentences within it1 have to be reworded awkwardly so that some good transitions between the sentences within a paragraph are lost. On the other hand, if some sentences seem to require the passive voice, by all means those sentences should be written in the passive voice. But the passive voice should only be used where it is justified, that is, where its use improves readability of the thesis.

TL;DR use “we”, don’t use passive unless needed; don’t use “I” ever.

Also in Germany it’s bachelor’s thesis, apparently.

Bachelor’s thesis tenses

This is also really nice:

Past tense

Work done

We collected blood samples from . . . Consequently, astronomers decided to rename . . .

Work reported

Jankowsky reported a similar growth rate . . . In 2009, Chu published an alternative method to . . .

Observations

The mice in Group A developed, on average, twice as much . . . The conversion rate was close to 95% . . .

Present tense

General truths

Microbes in the human gut have a profound influence on . . . The Reynolds number provides a measure of . . .

Atemporal facts

This paper presents the results of . . . Section 3.1 explains the difference between . . . Behbood’s 1969 paper provides a framework for . . .

Future tense

Perspectives

In a follow-up experiment, we will study the role of . . . The influence of temperature will be the object of future research . . .

(As linked in the answer, taken from Effective Writing | Learn Science at Scitable.

qutebrowser

qutebrowser yanking URLs and markdown

This is amazing. ym yanks the URL with the title, like this: word choice - Bachelor thesis or Bachelor’s thesis - English Language & Usage Stack Exchange.

qutebrowser passthrough mode

<C-v> enters passthrough mode, <Shift+Escape> to exit. It works very well with Jupyter-vim.

Thesis vim marks

m means what it always means, n is the place I’ve been working at the last time, d is the end of the thesis.

Stack

Resizing/converting/… a video with ffmpeg

ffmpeg -i input.mkv -s 640x480 -c:a copy output.mp4

Jupyter/pandas show all columns / limit maximum number of columns to show

pandas.set_option('display.max_columns', None).

qutebrowser adding javascript bookmarklets

javascript bookmarklets/quickmarks · Issue #221 · qutebrowser/qutebrowser · GitHub

:bind ,insta jseval alert("Hello World")

Qutebrowser config.py

A Python config file is excellent. qutebrowser/configuring.asciidoc at master · qutebrowser/qutebrowser · GitHub For now this, then we’ll see:

 https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc

config.bind(',l', 'set tabs.position left')
config.bind(',t', 'set tabs.position top')

config.bind(",j", "set content.javascript.enabled true")
config.bind(",J", "set content.javascript.enabled false")

config.bind(",t", "set tabs.show multiple")
config.bind(",T", "set tabs.show switching")
config.bind(",h", "set tabs.show never")

c.url.searchengines = {'DEFAULT': 'https://startpage.com/do/search?query={}', 
        'g': 'https://google.com/search?q={}', 
        'c': 'http://dict.cc/?s={}', 
        'd': 'https://duckduckgo.com/?q={}', 
        'd': 'https://en.wiktionary.org/wiki/Special:Search?search={}',
        'w': 'https://en.wikipedia.org/wiki/Special:Search?search={}',
        'y': 'https://youtube.com/results?search_query={}'
        }

mono = '10pt monospace'
small_mono = '9pt monospace'

c.hints.mode = 'number'

«««< HEAD , All of the individual settings ======= All of the individual settings

  • 5 Whys - Wikipedia - “5 Whys is an iterative interrogative technique used to explore the cause-and-effect relationships underlying a particular problem.”

    The vehicle will not start. (the problem) Why? - The battery is dead. (First why) Why? - The alternator is not functioning. (Second why) Why? - The alternator belt has broken. (Third why) Why? - The alternator belt was well beyond its useful service life and not replaced. (Fourth why) Why? - The vehicle was not maintained according to the recommended service schedule. (Fifth why, a root cause)[2]

    9cda76db80bd5b2c27d9886a9c01191c0676eac5

Qutebrowser private windows

exist. qutebrowser --temp-basedir -s content.private_browsing true

IntelliJ Idea

  • Shift+Enter starts a new line without breaking the current one.
  • To focus the code with ideavim, the custom property suppress.focus.stealing=false worked.

Music

Rclone and backing up Google Drive

rclone is nice. I followed the guide in Google drive, and the magic command to copy all content is rclone sync "drive:Google Photos" /mnt/data/Backups/GP, about 300kb/s, and about 4 hours left.

Games

  • Greed is absolutely wonderful and much more interesting than I thought at the beginning.

Pandas apply() memory hell

This is a nice read about how Pandas’ apply needs to store the Series it creates, that there’s no magic, and that inelegant loops can sometimes be faster. Relevant is the official Enhancing performance guide, that I should read.

Tensorflow

Estimators

This is one of the best tutorials I’ve found. Todo: userscript that gives me back the real URL from outline.com.

Tensorflow tensors and graphs

Tensors

A tensor is a generalization of vectors and matrices to potentially higher dimensions. Internally, TensorFlow represents tensors as n-dimensional arrays of base datatypes.

A tf.Tensor object represents a partially defined computation that will eventually produce a value. tf.Tensors do not have values, they are just handles to elements in the computation graph.1

Rank	Math entity
0	Scalar (magnitude only)
1	Vector (magnitude and direction)
2	Matrix (table of numbers)
3	3-Tensor (cube of numbers)
n	n-Tensor (you get the idea)ank	Math entity
0	Scalar (magnitude only)
1	Vector (magnitude and direction)
2	Matrix (table of numbers)
3	3-Tensor (cube of numbers)
n	n-Tensor (you get the idea)

Graphs

A computational graph is a series of TensorFlow operations arranged into a graph. The graph is composed of two types of objects.

  • tf.Operation (or “ops”): The nodes of the graph. Operations describe calculations that consume and produce tensors.
  • tf.Tensor: The edges in the graph. These represent the values that will flow through the graph. Most TensorFlow functions return tf.Tensors.

Python

Python functools partial functions

functools.partial(func[,*args][, **keywords])\

Return a new partial object which when called will behave like func called with the positional arguments args and keyword arguments keywords. If more arguments are supplied to the call, they are appended to args. The partial() is used for partial function application which “freezes” some portion of a function’s arguments and/or keywords resulting in a new object with a simplified signature. For example, partial() can be used to create a callable that behaves like the int() function where the base argument defaults to two

Python lambda for hiding arguments

Same to above, also from Tensorflow: Here we wrap up our input_fn call in a lambda to capture the arguments while providing an input function that takes no arguments, as expected by the Estimator.

input_fn=lambda:iris_data.train_input_fn(train_x, train_y, args.batch_size)

Python argparse

A nice example from the estimator example in tensorflow:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', default=100, type=int, help='batch size')
parser.add_argument('--train_steps', default=1000, type=int,
                    help='number of training steps')

args = parser.parse_args(argv[1:])

input_fn=lambda:iris_data.train_input_fn(train_x, train_y, args.batch_size), steps=args.train_steps)

Pandas pop column

pandas.DataFrame.pop — pandas 0.24.2 documentation. Works like a list .pop, df.pop('columnname'). Especially handy for ML.

Qutebrowser

Qutebrowser userscripts

Created my first qutebrowser userscript!

#!/bin/bash
echo "open http://outline.com/$QUTE_URL" >> "$QUTE_FIFO"

Qutebrowser edit URL

go - set-cmd-text :open {url:pretty}. wO opens a new window.

youtube-dl and mpv play audio

mpv $url --vid no plays it as audio file.

tmux scroll up

<C-b> PgUp gives me copy mode.

amixer selecting an audiocard

They can be found in alsamixer. Then -c 2, where 2 is the device/card number.: amixer -c 2 set PCM 5%+

Linux output logs continuously

I always forget this: tail -f /var/log/

Linux undelete file on ext filesystem with extundelete

extundelete /dev/sda4 --restore-file directory/file I’m shocked this works, and it can do a lot of interesting stuff - files, directories, list of deleted files, etc etc etc.

Python

Getopt

15.6. getopt — C-style parser for command line options — Python 2.7.16 documentation, especially the part optlist, args = getopt.getopt(args, 'abc:d:') – the options with a colon following need to have a value. Otherwise GetOptError will be raised.

Pandas Counter

Counter is much faster than count() in cases when you need to count multiple objects – you don’t have to iterate once for each object.

Jupyter notebook tqdm

Use from tqdm import tqdm_notebook as tqdm instead of usual vanilla tqdm.

Vim

vimdiff

vimdiff file1 file2 opens a nice vim session with two buffers. [c and ]c jump back and forward between changes. (See http://vimcasts.org/episodes/comparing-buffers-with-vimdiff/)

Switch splits’ position in vim

<C-w> <C-r> just rotates all the splits, and <C-w> x to switch the current window with the next one. (split - Swap the position of two windows - Vi and Vim Stack Exchange)

Vim search history

:history / (Is there search and replace history in vim? - Vi and Vim Stack Exchange)

Vim

Vim resize splits / vsplits

For a split window: You can use Ctrl-w + and Ctrl-w - to resize the height of the current window by a single row. For a vsplit window: You can use Ctrl-w > and Ctrl-w < to resize the width of the current window by a single column. Additionally, these key combinations accept a count prefix so that you can change the window size in larger steps. [e.g. Ctrl-w 10 +] (Resize splits more quickly | Vim Tips Wiki | FANDOM powered by Wikia)

Vim move tab

:tabm -1 moves it to the left; accepts absolute and relative parameters

Vim go back to previous buffer

(Especially handy if you’ve jumped to a global mark): <C-o>

Python

Python __dict__ object

Linux Follies: Python’s __dict__

Each object has a .__dict__ attribute, which contains the objects’ fields. They can also be directly edited.

ML

To read

Intro to tf.estimator and tf.data Good practices in Modern Tensorflow for NLP

Tensorflow

Shapes and ranks and tensors and stuff

pandas print_full to output stuff with max everything

def print_full(x):
    pd.set_option('display.max_rows', len(x))
    pd.set_option('display.max_columns', None)
    pd.set_option('display.width', 2000)
    pd.set_option('display.float_format', '{:20,.2f}'.format)
    pd.set_option('display.max_colwidth', -1)
    print(x)
    pd.reset_option('display.max_rows')
    pd.reset_option('display.max_columns')
    pd.reset_option('display.width')
    pd.reset_option('display.float_format')
    pd.reset_option('display.max_colwidth')

(from SO)

Tensorflow

tf.squeeze to remove dimensions of [1]

If I had a tensor of dimension [1, 2, 3], tf.squeze() would turn it into [2, 3]. tf.squeeze  |  TensorFlow Core r1.14  |  TensorFlow.

It removes any dimensions of shape 1 it finds. If I provide an axis parameter, it will only look at that dimension.

Languages

fixum – a fixed pay.
Elided - definition of elided by The Free Dictionary tr.v. e·lid·ed, e·lid·ing, e·lides

1.
    a. To omit or slur over (a syllable, for example) in pronunciation.
    b. To strike out (something written).
2.
    a. To eliminate or leave out of consideration.
    b. To cut short; abridge.

First seen as “[elided 10 identical lines from previous traceback]” in Tensorflow/Python

Learning Tensorflow

For a more systematic understanding: * jtoy/awesome-tensorflow: TensorFlow - A curated list of dedicated resources http://tensorflow.org is a list of nice stuff, not necessarily meant to be read in the same order * astorfi/TensorFlow-Roadmap: Organized & Useful Resources about Deep Learning with TensorFlow has a more “more GIFs to the god of GIFs” feel to it, but is meant to be read in a sequential order, and the resources look very nice.

Qutebrowser focus tab N keybindings

Now number keys focus tabs, as I had on Firefox:

config.bind('1', 'tab-focus 1')
config.bind('2', 'tab-focus 2')
config.bind('3', 'tab-focus 3')
config.bind('4', 'tab-focus 4')
config.bind('5', 'tab-focus 5')
config.bind('6', 'tab-focus 6')
config.bind('7', 'tab-focus 7')
config.bind('8', 'tab-focus 8')
config.bind('9', 'tab-focus 9')
config.bind('0', 'tab-focus 10')
config.bind('<Alt-1>', 'tab-focus 11')
config.bind('<Alt-2>', 'tab-focus 12')
config.bind('<Alt-3>', 'tab-focus 13')
config.bind('<Alt-4>', 'tab-focus 14')
config.bind('<Alt-5>', 'tab-focus 15')
config.bind('<Alt-6>', 'tab-focus 16')
config.bind('<Alt-7>', 'tab-focus 17')
config.bind('<Alt-8>', 'tab-focus 18')
config.bind('<Alt-9>', 'tab-focus 19')
config.bind('<Alt-0>', 'tab-focus -1')

Also found this really nice config file: maxx/dotfiles - .config/qutebrowser/config.py at c6611e7ef3ab93a712b8e37e784fed1b38fc1174 - Gitea: Git with a cup of tea

Tensorflow shapes [], [None], None or ()

() and [] are equivalent.

placeholder with [] shape takes a single scalar value directly. Placeholder with [None] shape takes a 1-dimensional array and placeholder with None shape can take in any value while computation takes place. (tensorflow - What is the difference between [], [None], None and () for the shape of a placeholder? - Stack Overflow)

Linux

less for continuous data

Except the command line flag I always forget for tail (tail -f some.log), less can do the same. After opening a file, pressing F/<Shift-f> puts you in the end and automatically updates if the file changes.

tee

tee writes the output to a file while simultaneously showing it onscreen. Example from Linux tee Command Explained for Beginners (6 Examples) is ping google.com | tee output.txt

scp to a non-standard port

scp -P 1337 from to:folder, it uses a capital P.

zip add to zipfile while ignoring directories

zip -j fileone filetwo ~/home/me/some/directory/file myzipfile.zip. -j means “junk directory structure”

zsh history

I can use !2332-style stuff inside commands as I type them! mycommand !23 if !23 is test would run as mycommand test.

IPFS (Interplanetary Filesystem)

IPFS is the Distributed Web – it looks very interesting, I should read the whitepaper or some basic intro (A Beginner’s Guide to IPFS – HackerNoon.com)

Set up vim keybindings in bash/zsh/… via inputrc

Use vi shortcuts in terminal | Vim Tips Wiki | FANDOM powered by Wikia – add

set editing-mode vi
set keymap vi-command

to ~/.inputrc or /etc/inputrc and restart terminal.

Bash scripting

Increment variable in bash an math in general

How to increment a variable in bash? - Ask Ubuntu var=$((var + 1)) is the most portable one.

Redirecting stdout and stderr in bash

some_command >file.log 2>&1 is the only one that works for me in all cases. (shell - Redirect stderr and stdout in Bash - Stack Overflow)

Bash arbitrary number of arguments and their number

"$@" are the arguments one can iterate through, and "@#" is their number.

Recording audio from speakers

This answer: sound - How to record output to speakers? - Ask Ubuntu mentions “Sound recorder”, and it works very well. Has weird settings about staying on top, running on startup etc that have to be changed.

9fb017224a344dc5f028b5a6b8000a8afb30f6fb

Linux cal calendar alias

Finally cal is cal -m -w, which gives me Monday as starting date and shows the week numbers.

Week review pages script

Now names files after the week number, not the date.

FILE=./Week/$(date +%-U).markdown
DATE=$(date +%Y-%m-%d\ %H:%M:%S\ +0100)

“Clear screen and run command” zsh/bash alias

alias c="clear"
alias cc="clear; "

c remains, cc now clears the screen before next command is run. I noticed I’ve been doing this manually quite often, especially for todo stuff. Now cc s puts the output of s on the top of the terminal.

Wild random idea – since perspective on my screen, especially at the bottom of my screen, bothers me so much, could one make an eye-tracking thingy, calculate how much the screen output should be changed on x and y, and automatically do this, so that visually it looks like all the aspect ratios are preserved? Not sure how hard is this to implement, but either way I’m not touching this.

Linux screen scrolling

Python – how to run a Python script inside live shell

Or, from the same SO thread, one can do just import filename_without_extension, even if it doesn’t follow the structure with main() etc., in my experience.

Tensorflow

Indexing and slicing multi-dimensional arrays or tensors in pandas, numpy, Tensorflo

This is probably one of the most SEO titles I’ve ever created, but I think it applies to all of them.

Tensorflow add one dimension (expand dims, expand_dims)

# 't' is a tensor of shape [2]
tf.shape(tf.expand_dims(t, 0))  # [1, 2]
tf.shape(tf.expand_dims(t, 1))  # [2, 1]
tf.shape(tf.expand_dims(t, -1))  # [2, 1]

Delete files older than X days/hours via linux find

Also relevant is mtime, ctime, and atime - modification time, change time, access time.

mtime changes when you write to the file. It is the age of the data in the file. Whenever mtime changes, so does ctime. But ctime changes a few extra times. For example, it will change if you change the owner or the permissions on the file.

Tensorflow disable verbose logging; set environment variables before running script in Linux

TF_CPP_MIN_LOG_LEVEL=3 python3 tensors.py does the magic needed

Qutebrowser open in new tab

Inserted the following in config.py: config.bind('a', 'set-cmd-text -s :open -t'), to make a an alias for O

Linux find parents of a process

This is really really neat when running shell scripts that run other shell scripts etc. ps fax gives a nice tree. Can be combined with other stuff, so ps faux also works. TODO actually read through the man pages about this.

Pandas remove duplicates efficiently (using only a subset of columns)

d.drop_duplicates(subset=['text'])

Markdown strikethrough uses two tildes

For this, markdown uses two tildes (like this).

(Should I write headers for these posts in /r/savedyouaclick style?)

Asciiquarium as screensaver with alock

Tensorflow variable scopes

The goal of variable scopes is to allow for modularization of subsets of parameters, such as those belonging to layers (e.g. when architecture of a layer is repeated, the same names can be used within each layer scope).

Random

scikit-learn vectorizer passing tokens

Pandoc

Pandoc is freaking awesome.

Some nice references:

Markdown tables widths

Bash kill running shell script

The %% tells the bash built-in kill that you want to send a signal (SIGTERM by default) to the most recently suspended background job in the current shell, not to a process-id.

Intermezzo

Had a long and wonderful vacation, and as it usually happens – I regret not keeping better records of what happened. In general, I feel like I’m losing some touch with my ability to write and to do at least semi-artistic things – and I believe this to be a great loss (for me, not for humanity).

Now playing: Музыка для никого - Агата Кристи (минус на пианино). Currently in the plane and without a connection, so untypically there will be no links.

During this trip home we organized another “we have a projector, make a ~20min presentation about whatever interests you” thing, and it went even better than the first – it’s not hard to get people to talk about stuff they are interested in. And it’s a wonderful way to get exposed to a lot of awesome stuff you didn’t know existed – topics ranged from vaccinations to roleplaying to how to play a flute.

Then I took part in my first D&D game, and it was interesting. Not going to get into it heavily, but it’s fascinating how everything is organized to be playable, and I think I see the appeal of it all. Also it looks 10/10 like something I would love – I’m not really sure why I don’t.

The month leading to it were probably one of the least pleasant of the last couple of years – thesis, very unpleasant uni stuff, a couple of all-nighters I could not properly recover from. My coscience was about as fragmented and stressed-out and burned-out as it gets, I think. So after 3 days at home the best thing happened:

Then I went to a 2 week camping thing in the Karpathians.

Now playing: Летов - все идет по плану

И взагалі мій куточок в Інтернет, маю право на що завгодно – продовження буде українською.

Так от, похід по Карпатах – це було настільки тотальне очищення дуже фрагментованої свідомості. Він був значно ващим ніж заплановано, і днів шість (а заплановано було три дні) треба було просто йти вперед. Навіть по-людськи не було часу годинку відпочити і понасолоджуватися на привалі. Плюс було трошки складно з маршрутом, один траверс який був набагато гірше маркованим у середині ніж його початок збив з дороги десь на день. І рюкзаки були значно важчі ніж було б правильно. І вилилось це все в просто 6 днів нервів але особливо тупо фізичного навантаження. І насправді це те, що, думаю, було особисто мені потрібно.

Now playing: Давайте делать паузы в словах

А, ще були гори, багато гір. Дивишся назад - бачиш прекрасний вид. Проходить 40 хв, знову дивишся - він став ще прекраснішим. І ти бачиш гори-гори-гори яких не бачив раніше. І розумієш, що це саме ти своїми ногами піднявся на цю висоту.

Але чи не основне те, що дав цей похід - це Н днів майже без телефону і без Інтернет у будь-якому вигляді. І найбільшу очистку дало саме це. (Окрема галочка – місця без телефонного звʼязку. Коли ти десь на горі, не бачив ніяких зустрічних туристів дня два, розумієш, що до найближчого місця де зможеш подзвонити йти годин 6.) І відчуваєш тоальну свободу, словами не передати яку. Свобода-пустота-ямогувсе, розумієш що для щастя тобі - конкретно тобі - треба небагато. Що проблеми - це шукати дрова, щоб не змерзнути. Прості древні проблеми. Розумієш, скільки умовностей і абстракцій ти собі постворював в т.н. “реальному” житті, і наскільки те, що відбувається тут з тобою на декілька порядків реальніше.

Відчуваю, що гублю ці увідомленя – навіть зараз, пару тижнів після кінця походу. І це теж у мене було - це все про свободу і т.п. не просвітлення після якого все інакше (я не впевнений, що взагалі вірю у такі просвітлення). Такі усвідомлення треба поновлювати, і речі/події які дають такого плану речі теж потрібно повторювати. Пригадую, що було у собору в Кьольні, що було коло Синевиру, що було під час минулих поїздок автостопом. Записувати це може трошки нагадати, але не дасть той самий afterglow котрий на шкірі і глибший за свідомість.

Now playing: Команда нашего двора - Визбор

Не останнім фактором, мені здається, там була тема чисто фізичних зусиль. Коли ти робиш 140% від того, на що (думаєш) здатен. Доходиш на вершину гори. Бачиш просто вау вид навколо, навіть не робиш спробу сфоткати - все рівно нічого не передати, і чимось це вже порожні для тебе категорії. Максимально стараєшся відчути, про-жити це. В тілі всі ті характерні ендорфіни від фізичної роботи, яка так очищає душу.

А на дворі 12 ранку, і ти розумієш, що тобі ще 2 таких подвига сьогодні. Звʼязку немає і не буде, телефон вимкнений, десь у тебе тренується якась нейромережа, але це так далеко і чимось не-реально. Згадуєш людей з твого реального життя, обличча ніби як зі сну.

І ще важливим було чітке розуміння того, що тобі навіть в чисто фізичному плані не так багато потрібно - в плані їжі, 39 душів в день, чистої голови. І хоча все рівно буду її мити, розуміння що 6 днів підряд можна цього не робити і все буде ОК теж робило все світлішим і простішим, чи що. Типу постворювали собі абстрактні системи і умовності, живемо в цьому гіперреальному світі, вирішуємо проблеми в рамках цієї системи - а так не завжди було і можна інакше. (Не в плані, що це погано, але швидше, що цікаво це бачити – бо контакт з простим і реальним втрачаєш тим більше, чим більше часу не маєш контакту з простим і реальним).

Now playing: Ostatnia prośba wędrownego grajka (та сама “Переведіть мене через майдан” польською).

Коли дійшли до цивілізації ми були раді бачити цивілізацію, все ж.

І друга частина відпочинку була ідеальною – лежали в кроватці, гарно їли у місцевій колибі, ходили до озера, потім поверталися, ad infinitum. Але телефона все одно не сильно включали. (Пригадую наскільки фізично дивно було друкувати щось на телефонній клавіатурі). В перший вечір зʼїли 10 блюд з колиби на двох.

Баноші, деруни з былими грибами, млинці з ягодами, ось це все.

I весь другий тиждень був тотальний-тотальний відпочинок, і фізичний і когнітивний. І цей формат дуже спрацював - і я його використовуватиму у майбутньому. Можливо, зі значно простішим походом, де на тебе не давить необхідність щось робити щосекунди, а просто релакс без телефона, з гамаками, вогнищем, і т.п.

У будь-якому випадку, Київ був гарним і я був дуже радим його бачити.

Повернувся додому, все було нормально. Галочка 1 - фраза “З дороги завжли треба помити руки і вмитися, щоб змити з себе пил і погляди людей”, і фраза друга-єврея одного street performer про те, що “людей нужно удивлять”.

Позже, вероятно, последует похожий постикак о планах на следующий год.

Over and out. (Y)

Work/play balance in i3 statusbar

Every productivity thought I’ve ever had, as concisely as possible - Alexey Guzey has been extremely inspiring. I added “work/play” to my statusbar, just for fun, with the following code to the statusbar wrapper script:

bashCommand2 = "date +%R" #returns %H:%M in 24h-format
bashOutput2 = subprocess.check_output(['bash','-c', bashCommand2]).decode('utf-8').strip('\n')
time=bashOutput2.split(":")
hour=int(time[0])
minute=int(time[1])

if hour in {9, 12, 15, 18, 21}:
    if minute>5 and minute<35:
        wp="P"
    else:
        wp="W"
else:
    if minute<5 or (minute>30 and minute<35):
        wp="P"
    else:
        wp="W"

j.insert(0, {'full_text' : '%s' % wp, 'name' : 'wp'})

TODO – py3status

Stumbled upon Modules — py3status 3.20 documentation, and this looks like a much better alternative to the above. I’d need to move the python script in a separate file and that’s okay, everything else is absolutely wonderful.

Jekyll hide page from navigation

Out of all the ways I’ve found and described here, this is so far the cleanest one.

title: Some Title
layout: default
exclude: true

and then

 {% unless page.exclude %}
        <a class="page-link" href="{{ page.url | prepend: site.baseurl }}">
            {{ page.title }}
        </a>
    {% endunless %}

Unpack Java jars

Apparently java files are archives! Laut Extracting the Contents of a JAR File (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files) it’s jar xf jar-file [archived-file(s) to extract].

Pandas and numpy have different std/stdev standard deviation functions!

Both are correct, one divides by N, the other by N-1.

t df.std()==np.std(df, ddof=1). Somethingsomething delta degrees of freedom. ddof=0 can also be passed to pandas.

Python redirect stdout/output to file

This is really really neat!

def redirect_to_file(text):
    original = sys.stdout
    sys.stdout = open('/path/to/redirect.txt', 'w')
    print('This is your redirected text:')
    print(text)
    sys.stdout = original
 
    print('This string goes to stdout, NOT the file!')

(from Python 101: Redirecting stdout - The Mouse Vs. The Python)

Pyplot / matplotlib creating multiple subplots

Creating multiple subplots using plt.subplot — Matplotlib 3.1.0 documentation

fig, (ax1, ax2) = plt.subplots(2)
fig.suptitle('Vertically stacked subplots')
ax1.plot(x, y)
ax2.plot(x, -y)

(or fig, (ax1, ax2) = plt.subplots(1, 2) if we want them side by side)

Pandas groupby plot without index

pandas.core.groupby.DataFrameGroupBy.plot — pandas 0.16.2 documentation has use_index, which decides if the values will be graphed using index as x (side-by-side) or one on top of the other.

ML

Most of this while I’m reading the “Attention is all you need” paper. The most important resources will be The Illustrated Transformer – Jay Alammar – Visualizing machine learning one concept at a time and 9.3. Transformer — Dive into Deep Learning 0.7 documentation.

Definitions

  • BLEU is a metric of how good machine translation is.
  • Gentle Introduction to Transduction in Machine Learning

    Induction, deriving the function from the given data. Deduction, deriving the values of the given function for points of interest. Transduction, deriving the values of the unknown function for points of interest from the given data. Relationship between

  • Positional encoding in the Transformer is very well described at 9.3. Transformer — Dive into Deep Learning 0.7 documentation, with a visualization. Needed because there is no notion of the order of words in the architecture 2 We can’t do n=1..10 because sentences have different lengths, and word 3 out of 10 is not the same as 3 out of 3.
    • “The intuition here is that adding these values to the embeddings provides meaningful distances between the embedding vectors once they’re projected into Q/K/V vectors and during dot-product attention” 3
  • Subword algorithms are ways to represent words that use elements bigger than characters but lower than a word embedding, for example prefixes and suffixes, to better handle unseen words. Byte-pair and word-piece encodings are used by the Transformer.[^swa]
  • In essence, label smoothing will help your model to train around mislabeled data and consequently improve its robustness and performance. 4

[^swa] (3 subword algorithms help to improve your NLP model performance)

Resources

Stack

  • I should make a better Bash timer that counts till the end of the hour, so I don’t have to do this in my head
  • I should make a vim keybinding or script that automagically creates Markdown references. (I’d be surprised if this hasn’t been done)

English

Anaphora: * Repetition of something (rhetoric) * Pronouns and references to something already mentioned to avoid repetition (she, it, etc.)

English Pronunciation

Google has nice animations for this!

  • Query = [kwee ree]
  • Paradigm = [pa ruh daim] or American [peh ruh daim]

Linear algebra

I’ll be following this: 9.1. Attention Mechanism — Dive into Deep Learning 0.7 documentation

  • Inner product is the generalization of the dot product. Result is a scalar. 5

Python assert statement

UsingAssertionsEffectively - Python Wiki assert condition, message -> if condition is false, it returns an AssertionError.

Pandas

apt-get purge and zsh

zsh does its own wildcard stuff, and apt-get purge nvidia* doesn’t work because of this. apt-get purge nvidia\* does (or with ‘’s). Same story as with scp, I’m surprised I keep having issues with this.

Linux see history of apt-get

Linux z-commands (zcat, zless, zgrep, zdiff)

ML/Tensorflow logits meaning

Logits are the inputs to the softmax function:

the vector of raw (non-normalized) predictions that a classification model generates, which is ordinarily then passed to a normalization function. If the model is solving a multi-class classification problem, logits typically become an input to the softmax function. The softmax function then generates a vector of (normalized) probabilities with one value for each possible class.

ML attention animated

After all this time, I found this excellent animated example of attention and transformer and RNNs: Visualizing A Neural Machine Translation Model (Mechanics of Seq2seq Models With Attention) – Jay Alammar – Visualizing machine learning one concept at a time. From the same source, A Visual Intro to NumPy and Data Representation – Jay Alammar – Visualizing machine learning one concept at a time look very nice. I should resurrect my link wiki instead of pasting it all here.

Coding fonts

Python

Interesting python syntax

Interesting Python syntax I’ve seen in the Transformer Google repo:

  • /= assignment operator, which is like +=.
  • X if Cond else Y:
stats = ({
        "loss": train_loss
    } if history is None else misc.build_stats(history, callbacks))
  • Can be also used in returns:
    return evaluate_and_log_bleu(
        self.predict_model, self.params, self.flags_obj.bleu_source,
        self.flags_obj.bleu_ref, self.flags_obj.vocab_file,
        self.distribution_strategy if self.use_tpu else None)

Kinda relevant is code golf - Tips for golfing in Python - Code Golf Stack Exchange.

Python rich comparison operators

object.__lt__(self, other)
object.__le__(self, other)
object.__eq__(self, other)
object.__ne__(self, other)
object.__gt__(self, other)
object.__ge__(self, other)
  • The correspondence between operator symbols and method names is as follows: x<y calls x.lt(y), x<=y calls x.le(y), x==y calls x.eq(y), x!=y calls x.ne(y), x>y calls x.gt(y), and x>=y calls x.ge(y).

Stack

I should really create a vim thingy that automatically creates footnotes from a link. I can imagine it as a keystroke which generates a random footnote name and puts you on the last line of the file, with the footnote name prefilled, and in insert mode. Or another one that lets you specify a footnote name.

Keras

Tensorflow GloVe embeddings

Intellij IDEA vim plugin

It supports the following :set commands: ideavim/set-commands.md at master · JetBrains/ideavim · GitHub. Especially relativenumbers is nice.

Qutebrowser :buffer/gt command to search tabs

:buffer works as a best-match tab filtering thingy, this in nice with 30+ tabs when tab number doesn’t cut it anymore

Tensorflow

Tensorflow Datasets easiest way to look inside with an iterator

iter(dataset).__next()__

Tensorflow Keras Callbacks

How to compute f1 score for named-entity recognition in Keras

NER PRC and F-score (F1, metrics, precision, recall)

… uses only tags. As in, we don’t count the “not a name” tags at all during calculation of PRC. Otherwise the results would be too good. This is a NER-specific thing, though.

Current qutebrowser config.py

# https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc

config.bind(',l', 'set tabs.position left')
config.bind(',t', 'set tabs.position top')

config.bind(",j", "set content.javascript.enabled true")
config.bind(",J", "set content.javascript.enabled false")

config.bind(",T", "set tabs.show multiple")
config.bind(",n", "set tabs.show switching")
config.bind(",h", "set tabs.show never")

config.bind(",o", "spawn --userscript outline.sh")
config.bind(",m", "spawn mpv {url} --vid no")

c.url.searchengines = {'ss': 'https://startpage.com/do/search?query={}', 
        'g': 'https://google.com/search?q={}', 
        'c': 'http://dict.cc/?s={}', 
        'DEFAULT': 'https://duckduckgo.com/?q={}', 
        'd': 'https://en.wiktionary.org/wiki/Special:Search?search={}',
        'w': 'https://en.wikipedia.org/wiki/Special:Search?search={}',
        'y': 'https://youtube.com/results?search_query={}'
        }

mono = '10pt monospace'
small_mono = '9pt monospace'

c.hints.mode = 'number'

c.auto_save.session = True

# Numbers to tabs

config.bind('1', 'tab-focus 1')
config.bind('2', 'tab-focus 2')
config.bind('3', 'tab-focus 3')
config.bind('4', 'tab-focus 4')
config.bind('5', 'tab-focus 5')
config.bind('6', 'tab-focus 6')
config.bind('7', 'tab-focus 7')
config.bind('8', 'tab-focus 8')
config.bind('9', 'tab-focus 9')
config.bind('0', 'tab-focus 10')
config.bind('<Alt-1>', 'tab-focus 11')
config.bind('<Alt-2>', 'tab-focus 12')
config.bind('<Alt-3>', 'tab-focus 13')
config.bind('<Alt-4>', 'tab-focus 14')
config.bind('<Alt-5>', 'tab-focus 15')
config.bind('<Alt-6>', 'tab-focus 16')
config.bind('<Alt-7>', 'tab-focus 17')
config.bind('<Alt-8>', 'tab-focus 18')
config.bind('<Alt-9>', 'tab-focus 19')
config.bind('<Alt-0>', 'tab-focus -1')

config.bind('A', 'hint all tab-bg')

config.bind('a', 'set-cmd-text -s :open -t')

config.bind('e', 'open-editor')

config.bind('>', 'tab-move +')
config.bind('<', 'tab-move -')


config.bind('<Ctrl-P>', 'tab-pin;; tab-move 1')

pip install from github

Pip install from github is surprisingly easy: pip install git+https://github.com/guillaumegenthial/tf_metrics.git

Tensorflow metrics ignored if loss doesn’t get defined

So I don’t forget, Metrics ignored when using model.add_loss() (like in VAE example) · Issue #9459 · keras-team/keras · GitHub currently happens.

Intellij ideavim toggle case

Added the following to .ideavimrc: map <leader>c :action EditorToggleCase<CR>

Tensorflow

Using ‘categorical_crossentropy’ instead of ‘sparse_categorical_crossentropy’, give weird unintuitive errors

ML / NER / Stack / To read

This is a really nice tutorial with the basics that’s not too basic: Sequence Tagging with Tensorflow

Tensorflow gradient propagation

  • ValueError: No gradients provided for any variable in Tensorflow - Stack Overflow

    When you do annotation_pred = tf.to_float(tf.argmax(out, dimension=4, name='prediction')), you get an index of the max value in your tensor. This index can’t be derivated, thus the gradient can’t flow throught this operation.

    So as your loss is only defined by this value, and the gradient can’t flow throught it, no gradient can be calculated for your network.

Argmax is okay if I don’t calculate my loss through it.

Python / Numpy ellipsis (…)

  • Cookbook/Indexing - SciPy wiki dump

    The ellipsis (three dots) indicates “as many ‘:’ as needed” This makes it easy to manipulate only one dimension of an array, letting numpy do array-wise operations over the “unwanted” dimensions. You can only really have one ellipsis in any given indexing expression, or else the expression would be ambiguous about how many ‘:’ should be put in each.

English vocabulary

  • glib - superficial, shallow, persuasive but insincere in nature.
  • retrodict - Wiktionary - to attempt to estimate the previous state from the present.

German RE / AW

Outlook. What is the meaning of “AW” in an email header? – AW == RE in most other languages

Remark.js presentation change font size inside slide

.remark-slide-content {font-size: 40px;}

(from Font size · Issue #104 · gnab/remark · GitHub)

Also relevant are the content classes mentioned in how to adjust the font of a specific sentense/paragraph/word ? · Issue #230 · gnab/remark · GitHub:

Some text is .large[larger] and some is .small[smaller].

<style>
  .large { font-size: 130% } 
  .small { font-size: 70% }
</style>

Moving to a new apt

Ausstattung für die erste eigene Wohnung - Checkliste is a nice checklist :)

Taskwarrior modifier .isnt for “not equal”

Edited my “someday” report:

report.sd.filter=status:pending sprint:s sprint.isnt:srv

sprint:s seems to catch srv too, which I don’t want. Not anymore. Also Taskwarrior - FAQ is the list of such modifiers.

Attribute modifiers make filters more precise.  Supported modifiers are:

  Modifiers         Example            Equivalent           Meaning
                    due:today          due = today          Fuzzy match
  not               due.not:today      due != today         Fuzzy non-match
  before, below     due.before:today   due < tomorrow       Exact date comparison
  after, above      due.after:today    due > tomorrow       Exact date comparison
  none              project.none:      project == ''        Empty
  any               project.any:       project !== ''       Not empty
  is, equals        project.is:x       project == x         Exact match
  isnt              project.isnt:x     project !== x        Exact non-match
  has, contains     desc.has:Hello     desc ~ Hello         Pattern match
  hasnt,            desc.hasnt:Hello   desc !~ Hello        Pattern non-match
  startswith, left  desc.left:Hel      desc ~ '^Hel'        Beginning match
  endswith, right   desc.right:llo     desc ~ 'llo$'        End match
  word              desc.word:Hello    desc ~ '\bHello\b'   Boundaried word match
  noword            desc.noword:Hello  desc !~ '\bHello\b'  Boundaried word non-match

Intellij idea

In intellij idea you can set more options for each breakpoint after right-clicking on it; especially “disable until breakpoint X is hit”, where X can be disabled.

Keras2 eager execution

.. is not there by default all the time; the hard-to-find answer for this is adding model.run_eagerly=True after model.compile().

Tensorflow / python Dataset iterator

Of course, the following also works:

[x[1][1]['mycast'] for x in dataset.enumerate(5).__iter__()]

Tensorflow padding

… add what you tell it to add, even if you’ve use tf.one_hot() on the data before. Then you get weird zeros in the result of the one hot encoding.

Tensorflow

Tensorflow custom cost functions with different weights

Tensorflow F-score / PR

Tensorflow per-element multiplication

If I * a tensor by another tensor I get a per element multiplication. I keep forgetting this for some reason

Intellij idea debugging editing values

I can even edit EagerTensors by right click -> Edit value! Quite a weird UI but still nice

CRF and probability tutorial / explanation / presentation

I really should resurrect my link DB.

Sandeep Aparajit: Tutorial: Conditional Random Field (CRF) is a nice 108-page presentation spanning basic probability theory and flowing to Bayes, marginals, CRF etc etc, very very self-contained.

To read / stack

Generative VS Discriminative Models - Prathap Manohar Joshi - Medium

Library for debugging ml stuff

Overview — ELI5 0.9.0 documentation “.. is a Python package which helps to debug machine learning classifiers and explain their predictions.”

Tensorflow custom metrics return

Keras custom metrics raises error when update_state returns an op. · Issue #30711 · tensorflow/tensorflow · GitHub - forget about returning ops in custom metrics, internal Google TPU issue thing. It’s supposed not to work. Error was:

TypeError: To be compatible with tf.contrib.eager.defun, Python functions must return zero or more Tensors; in compilation of <function Function._defun_with_scope..wrapped_fn at 0xb34ec5d08>, found return value of type <class 'tensorflow.python.framework.ops.Operation'>, which is not a Tensor.

Tensorflow documentation

tf.assign_add - TensorFlow Python - W3cubDocs - is this another place to read readable TF documentation?

Tensorflow eager execution – again; this time with Intellij idea breakpoints

model.run_eagerly=True is not enough – when creating a custom Metric, as mentioned in metrics.py, tf.config.experimental_run_functions_eagerly(True) is also needed.

As added bonus - if this is not enabled, Intellij Idea debugging also doesn’t work. As in the breakpoints get ignored.

Intellij idea breakpoints

I should read this sometime: Breakpoints - Help | IntelliJ IDEA

Qutebrowser Stack

I should create a better ym that supports copying markdown links that have |s in them. Using Add ability to yank inline by jgkamat · Pull Request #4651 · qutebrowser/qutebrowser · GitHub most probably.

Tensorflow boolean mask

tf.boolean_mask  |  TensorFlow Core r2.0 is something similar to what I do with tensor*mask, but it removes the rows where the condition is not fulfilled.

Tensorflow

Mixing keras and tf.keras is bad karma; only the same one should be used and it should be tf.keras.

Tensorflow Keras stuff outside layers

AttributeError:’Tensor’ object has no attribute ‘_keras_history’ – inneka.com

Everything should be done by:

  • Using keras.backend functions,
  • Lambda layers,
  • Designated keras functions with the same behavior.

When you are using tf operation – you are getting tf tensor object which doesn’t have history field. When you use keras functions you will get keras.tensors.

Python unittest

  • When creating a TestCase, all vars set up in setUp should belong to the class – self.xxx
  • The functions run in alphabetical order but it’s not something I should depend on

Stack / ideas

Some kind of ML language switcher that trains on my input – I write something in L1, delete, write same keystrokes on L2 => training instance. Also based on window class and time maybe?

Tensorflow ‘could not find valid device for node’

“Could not find valid device for node.” while eagerly executing. - means wrong input type.

Python shell get last value

_ does the magic. Can be used in expressions too.

Zsh calculator inside CLI

# Put these in your .zshrc (No need to install a plugin)
cc() python3 -c "from math import *; print($*);"
alias cc='noglob cc'
# You can use `cc` just like `=` from above. All functions from the math module of Python are available for use. 

(As suggested by arzzen/calc.plugin.zsh: zsh calculator - with support for basic math)

Usage: cc 3+3

Zsh disable globbing

If a command is prefixed by noglob, then no globbing is performed on its arguments (source: wildcards - Disable glob qualifiers in zsh - Unix & Linux Stack Exchange)

Tensorflow object has no attribute _keras_history

AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute '_keras_history disappears if we dont’t use eager execution inside the metric, fine if we use it inside the model. That is tf.config.experimental_run_functions_eagerly(False) inside metrics.py solves this, but model.run_eagerly=True is fine.

https://github.com/tensorflow/addons/pull/377 re output_masks and it being blocked

tf.keras vs tf.python.keras

tensorflow - What is the difference between tf.keras and tf.python.keras? - Stack Overflow

Tensorflow

tf.keras.backend.in_train_phase  |  TensorFlow Core r2.0 selects x if training, y otherwise. This will be very handy later.

Intellij Idea folds

Just discovered that Ctrl + and Ctrl - unfold and fold stuff.

Ideavim actionlist

IdeaVim actionlist

Added the following to .ideavimrc:

map J :action NextTab<CR>
map K :action PreviousTab<CR>
map <leader>j :action EditorJoinLines<CR>

Python print all class variables

print(vars(object))

Random

Tensorflow eager execution

Makes everything slower by about 2-4 times.

German

Random

Chaostreff – Eigenbaukombinat

Taskwarrior end of year sprint renaming

The usual yearly ritual:

for o in $(seq 52) 
do
t sprint.is:$o modify sprint:2019-$o rc.bulk=0
done

Here a couple of things are interesting. Firstly, sprint.is:$o means basically sprint==$o. In cases where sprint==2, this helps against catching stuff life sprint==20 in the filter.

rc.bulk=0 is an override of the setting bulk which decides how many changes at the same time is too many. Regardless of the value of the confirmation setting. Here I set it to infinity, and this way I don’t get one question for each sprint.

Also Setting Up Multiple Project Areas with Taskwarrior – Steve Dondley is quite interesting – I’ll do something similar for work and home, except that I’ll use the existing t/tw aliases instead switching it like he does. But I might consider something like this so that t at work gives me the work tasks and my home tasks at home.

cp copy to target directory by overwriting the contents

linux - How to force ‘cp’ to overwrite directory instead of creating another one inside? - Stack Overflow

-T, --no-target-directory treats target as a normal file, not a directory. -v is also quite handy.

Lastly, I’m not sure how does taskwarrior work. When I try to delete ~/.task it gets recreated with the standard files, but empty ones, as if it was a clean taskwarrior install. I don’t see any task-like processes running. I’m not sure how is this possible.

Random / other / toread

Super Guide to the split-window tmux Subcommand (and Beyond) – Steve Dondley looks awesome. In general I’d like to spend 2020 by learning to use existing tools better - the taskwarrior .is attribute is something I had to look for.

German random

The Ctrl key in Germany is “Strg”, pronounced “Steuerung”

English random

refuse - Dictionary Definition : Vocabulary.com Refuse as a verb is re-FYOOZ, as a noun it’s REF-yoss.

Adding numbers in Bash

integer arithmetic - How can I add numbers in a bash script - Stack Overflow

num=$((num1 + num2))
num=$(($num1 + $num2))

.. which is what I used in the updated create.sh script. FILE=_posts/$(date +%Y-%m-%d)-day$((365+$(date +%j))).markdown

Tensorflow

  • TODO - why can’t tf.convert_to_tensor() convert stuff to other types (int64->float32) and I have to use tf.cast() afterwards?
  • tf.in_train_phase() – both x and y have to be the same shape
  • In a custom layer, compute_mask() can return a single None even if there are multiple output layers!

German

Erfahrungsmäßig

Semantic highlighting

This is actually really nice as idea, and as usual someone on the internet thought about this more than I did: Making Semantic Highlighting Useful - Brian Will - Medium

I somehow really like the idea of having color giving me actual semantic information about the thing I’m reading, and there are a lot of potentially cool stuffs that can be done, such as datatypes etc. It’s very connected to my old idea of creating a writing system that uses color to better and more concisely mark different letters, like the apparently defunct Dotsies but even more interesting.

Zsh autosuggestions (fish-like)

This is interesting: zsh-users/zsh-autosuggestions: Fish-like autosuggestions for zsh

Less noisy autocomplete than the default, should look similar to this: fish autocomplete

As a side note I like the cat explanation.txt part for screenshots.

Number bases in bash

bash - Value too great for base (error token is “08”) - Stack Overflow – tl dr bash/zsh see “018” as an octal number because it starts with 0. To fix this, we explicitly set the number base: 10#$varname.

I updated my create.sh with this. Now the lines are like this:

FILE=_posts/$(date +%Y-%m-%d)-day$((365+10#$(date +%j))).markdown

Hammock driven development (video); towatch

Hammock Driven Development - Rich Hickey - YouTube looks like an interesting video. Also it’s transcripted! talk-transcripts/HammockDrivenDev.md at master · matthiasn/talk-transcripts Rich Hickey – Hammock Driven Development – melreams.com is a post about the same.

Intellij idea bookmarks!

Ctrl+Shift+3 to toggle bookmark 3, and Ctrl+3 to jump to it

Tensorflow

Building a data pipeline for tf.Dataset. title: “Intermezzo - 2”

Три истории про Мерзебург

Вот про Мерзебург надо писать на русском языке, на самом деле, хотя нереально объяснить почему.

Сижу за идеально пустым столом комнатки где провел предыдущие 4 года. Вокруг какие-то непонятные бумаги на полу, какие-то ручки, как будто после урагана.

Now playing: Stravinsky - Le sacre du printemps / The Rite of Spring

Господи, сколько же всякого происходило тут за последние 4 года.

Сижу за знакомым столом, который на идеальной высоте, куда идеально ложатся локти. Хотя все вещи кроме общажной мебели отсюда увезены, чудом осталась свечка и спички. Сейчас она горит и пахнет воском, тоже до боли знакомый запах, с точностью до всех нот - конкретно такие свечки и покупал 4 года подряд. И писал на таких листочках А4, тем же почерком, той же рукой.

Candle.

Свеча выглядит как будто она догорит сегодня, и это лучшее и самое правильное совпадение этого мира.

Комнатка прошла полный круг - а изменился ли я?

А еще - город где была сфокусирована моя жизнь довольно долгое время. Сейчас тут пустая комната, за окном - темнота, хорошие люди в городе и самом общежитии в общем-то остались, но само нахождение тут как-то просто странно. Очень хороший повод порефлексировать о том, как можно себя чувствовать совершенно чужим в каком-то городе, особенно по вечерам. Помню летние месяцы тут - за окном лето, ты в напрочь пустом общежитии маленького городка восточной Германии, чувство свободы и пустоты, лето, бесконечное лето, лето как состояние. С работой это все будет стираться, и надо пытаться себя учить замечать маленькие детали в изменениях сезонов, иметь хоть какие-то ритуалы связанные с разными порами года, чтоб это не сливалось и чувствовать, к приеру, лето, про-живать, пере-живать сезоны. Постик об этом, отчасти.

Но это все лирика, лирика которая не должна отвлекать нас от того, что на самом деле важно -

Окна

Слева от меня два огромных окна, традиционно жертвы моей любимой темы писать на окнах и давать хорошим людям писать на моих окнах. Очень много этих надписей связаны с вполне конкретными людьми и воспоминаниями.

Все что следует написано очень многими разными почерками и размерами и цветами, кроме левой половины первого окна.

Window.

Окно 1, левая половина

Life is a non-0-sum game.

"Nothing exists except atoms 
and empty space. Everything 
else is opinion" - Democritus 
    ____ - - -
 
SIT,  BE STILL AND LISTEN, 
BECAUSE YOU ARE DRUNK 
AND WE'RE ON THE 
EDGE OF THE ROOF 
                - RUMI
    __________

BE A LIGHT UPON YOURSELF.
    ___________
    ___________

I make my own coincidences, 
synchronicities, Luck, 
    and Destiny.

    ____________

Rule your mind,  or it will rule you.

    ____________

Безумие, безумие, безумие.
              (с) М.

 Рисунок роботов, вид сверху. 

Окно 1, правая половина

L'occhio del lupo Amazon

P: admin123

       __________

Рисунок круга с точкой внутри

Leave tonight 
or live and 
die this way.


padik is where your
    semki shells lie


 Еще одна схема робота, одного,
вид прямо 

 Рисунок слона, подписан Ellina

Antal
Szerb: Reise
im Mondlicht

Это все
часть пути

Now playing: Händel - Sarabande, просто самая сильная извесная мне композиция. Мурашки по коже.

Продолжаю.

Window.

Окно 2, левая половина

-- Что мне терять 
на этоп этапе?
-- Этап.

Ойген

Matthew 6:33
    TachibanaPC2998

Wovor laüfst
du weg?

 Непонятный рисунок с квадратиками, кружочками и штрих-пунктиром. 
    
    We were dringking
       with Ukrainians!

    19:01

 Рисунок короны

 Рисунок трех синусоид, суммирующихся в 1 

 Две неразборчивых надписи

6C | 2-3

   Wo bist du?
 Sergej

 Еще одна неразборчивая надпись

Buch "Krabat"
 (↳ O.Preußler)

 Смайлик 

         Логитип BMW 

 Рисунок земли, над ней шар,
вокруг шара концентрические стрелочки
Под ним: "2001"

I fucking like
  weather

сука

SOKOLY
(I.M.T. SMILE)

Окно 2, правая половина


 Большой рисунок 
каббалисткого Древа Жизни,
с буквами на иврите внутри 

10:45 am

Мыло для бульбашек

 Рисунок лица в очках 
Сережа ня :3

"Я тебя щелкну
как семку!"
    (с) Женя

 Рисунок Дао  

25см 
(i) 1:17

 Странный рисунок лошади (?)
перехоящей в ботинок (?) 

   Der kleine Prinz
   ist bei mir! 
    - Yasmin
  
    P.S. 
    lies das 
    Parfüm!

 Рисунок графика
и минимумов в нем 

    PRIMETIME 
         SPIRIT

Он хотел историй
Он ее получит [sic]

HN

GL DF
   ALeX

Инсмут

Тут еще будет уместен этот линк на пост, написанный когда я только-только приехал сюда: Файне місто Мерзбург | Я сам, соломка, чай.

Сложно написать что-то общее про Мерзебург и мое отношение к нему. Если бы писал, то “блеск и нищета” точно бы звучало. Чем-то очень темный город, маленький, по-своему в некотором роде некоторым образом уютный, без лишних претензий. Но все же, темный, давящий, причем давящий с самого начала. Все хорошее, что я мог про него говорить, было скорее стокгольмским синдромом и рационализацией.

Если город маленький, общение с людьми приобретает чуть больше граней. И общение с городом-вообще, где ты знаешь в лицо всех кассирш ближайшего магазина, единственного филиала банка, где четыре года подряд ходишь в одну аптеку и тебя там узнают, и ты узнаешь всех (двух) людей, которых ты там когда-либо видел за прилавком.

Как будто личности, которые часть этого города, имеют более прочную позицию в нем, имеют чуть большее значение. Ты встречаешь дедушку на лавочке, болтаешь с ним - дедушка важен, лавочка важна, озеро, около которого она, тоже важно. Ты не анонимен и лавочка не анонимна. Все имеет больший масштаб и связь между всем сильнее.

Вне этого - если что-то тебя давит, то город беспощаден, и тебе в нем не затеряться и не отвлечься. Сенека что-то писал про то, что постоянные переезды и путешествия – признак беспокойного духа. Мне кажется надо иметь нереально спокойный дух, чтоб мочь долго жить в маленьком городке.

Не Инсмут

А если иметь спокойный дух - условия в принципе идеальные. Маленький универсистет, университет в 50 метров от общежития. 200 метров дальше - спортивный комплекс. Там можно играть в теннис с людьми, которых туда приглашаешь. По дороге туда встречаешь всех. А в тренажерном зале встречаешь местами преподавательницу немецкого языка, местами - ректора, который стоит и ждет своей очереди на тренажер у тебя над душой, что очень неловко всем.

Мерзе это город где к тебе могут просто зайти и пригласить выйти погулять, и ты идешь и просто гуляешь по территории и по Tiergarten, до которого метров 500. Это город где шикарно гуляется ночью. И шикарно разговаривается ночью.

Это город, в котором нереально хорошо видны звезды, все, и ночью можно ходить на них смотреть в кукурузные поля (до которых метров 700). Где есть крыша, на которую можно залазить и оттуда смотреть на затмение.

Это город где ты идешь в магазин за едой и это интересно, и это развлекаловка, и ты резко понимаешь в чем может быть прелесть шоппинга.

Мерзе меня многому научил. От того, как это, когда вокруг у тебя Мерзебург, где мало что происходит, а ты хочешь чего-то интересного - и ты учишься to make your own fun и организовываешь вещи.

Эти 4 год атут были мне очень необходимыми и уместными, продлились ровно столько, сколько нужно, и закончились в идеальное для этого время.

В эти секунды тушится свечка.

Спасибо тебе, свечка, спасибо тебе, столик.

Спасибо тебе, здание 5B.

Спасибо тебе, Мерзебург, спасибо за все.

Tensorflow py_function in mapping and Raggedtensors

    one, two= tf.py_function(func = py_mix, inp=[one, two],  Tout = (tf.int32, tf.int32))

one is a RaggedTensor. This gives an error:

TypeError: Tensors in list passed to 'input' of 'EagerPyFunc' Op have types [<NOT CONVERTIBLE TO TENSOR>, int32] that are invalid. Tensors: [tf.RaggedTensor(values=Tensor("RaggedFromVariant/RaggedTensorFromVariant:1", shape=(None,), dtype=int32), row_splits=Tensor("RaggedFromVariant/RaggedTensorFromVariant:0", shape=(None,), dtype=int64)), <tf.Tensor 'RaggedFromVariant_1/RaggedTensorFromVariant:0' shape=(None,) dtype=int32>]

one.to_tensor() converts it to Tensor and this works.

Additionally, if I set Tout to be only one value, I get a nice descriptive error: OperatorNotAllowedInGraphError: iterating over tf.Tensor is not allowed: AutoGraph is disabled in this function. Try decorating it directly with @tf.function.

Giving a type for both outputs fixes this.

Tensorflow RaggedTensor and Tensor evaluation

Ragged tensors  |  TensorFlow Core gives a nice breakdown of the ways to evaluate a Tensor in general:

  • print(rt.to_list())
  • print(rt[1].numpy())
  • Printing the constutuents of it:
    • print(rt.values)
    • print(rt.row_splits)

Python type hinting

Allegedly one of the best tutorials to start with: Type hinting and annotations — Python for you and me 0.4.alpha1 documentation, link found here: A deep dive on Python type hints · Vicki Boykis. That blog in general is quite interesting, she’s the same person who wrote IT runs on Java 8 · Vicki Boykis.

Random - good small datasets

From the same blog above, Good small datasets · Vicki Boykis is nice. TIL datasets can have documentation.

Tensorflow SequenceExamples to and from String

tf.train.SequenceExample.FromString(se.numpy()).SerializeToString()==se, logically. They can be parsed without an extract function and tf.io.parse_single_sequence_example()

Python truthy and falsy

TIL that values considered true/false without being explicitly True/False have a name, and from python - What is Truthy and Falsy? How is it different from True and False? - Stack Overflow here’s a handy list of them:

All values are considered “truthy” except for the following, which are “falsy”:

  • None
  • False
  • 0
  • 0.0
  • 0j
  • Decimal(0)
  • Fraction(0, 1)
  • [] - an empty list
  • {} - an empty dict
  • () - an empty tuple
  • '' - an empty str
  • b'' - an empty bytes
  • set() - an empty set
  • an empty range, like range(0)
  • objects for which
    • obj.__bool__() returns False
    • obj.__len__() returns 0

A “truthy” value will satisfy the check performed by if or while statements. We use “truthy” and “falsy” to differentiate from the bool values True and False.

Truth Value Testing

Intellij idea shortcut for closing tab

Ctrl+F4 closes the current tab, which is not too easy to type. But I set a nice shortcut Ctrl-I which is not, action is “Close all unmodified”, it closes all the tabs I usually close manually - all internal TF stuffs that open when debugging and that I don’t want to change or edit (but breakpoints are okay, and they don’t seem to count as “modification”)

qutebrowser edit current url

go is the default shortcut for this.

Tensorflow masking function not_equal

This is very nice and easy and easy to forget: mask = tf.not_equal(inputs, '')

It has sisters such as tf.math.less, etc.

Tensorflow python unittests check for equality of two tensors

tf.assertEqual(x, y) exists, can be used in unittests as is, if it raises an error the test automatically fails.

Intellij idea generate tests

This is awesome! Right click on class name -> Generate -> Test, and this creates a boilerplate file with the right name and right methods.

English

DNB

And let’s come back to an old favourite of this Diensttagebuch…

Today's Sets
1.D3B 86% 1m. 27s.
2.D4B 56% 1m. 48s.
3.D4B 28% 1m. 48s.
4.D4B 39% 1m. 48s.
5.D4B 39% 1m. 48s

Taskwarrior .zsh alias current sprint change

Changed zsh alias to alias s='task s sprint.is:$SPRINT or sprint:c', it didn’t have the .is before showing me 40, 41… for sprint 4 etc.

Taskwarrior seq recurring tasks commands

For next year:

10270  for i in $(seq 4 9 52)\nt add project:h +MOD  sprint:$i change toothbrush
10272  for i in $(seq 4 4 52)\nt add project:h +MOD  sprint:$i Master monthly backup

Adding concat.sh to dtb

One thing which I continuously missed was a way to quickly search through all the files visually - :Ag as fuzzy search is a really nice solution, but I still like the usual way. So now the following was added:

This is purely a text file that I plan to work with as a text file (though it gets compiled to .html during deployment), and we’ll see what happens next with it.

Random / interesting

Compass rose - Wikipedia, especially the names of the winds. I wonder if they could become names for hostnames/servers or something.

CNN Tutorial - Machine Learning

Simple Introduction to Convolutional Neural Networks is really nice and has pictures of swans.

Tensorflow

tf.math.count_nonzero() works for booleans, as in “number of True elements in tensor”

Python mutable/immutable dictionaries/lists changing inside a function

Tutorial: Why Functions Modify Lists, Dictionaries in Python just got bitten by this again :) TL;DR lists and dicts are mutable, therefore if I pass them to a function and it does stuff to it they will get changed outside the function too. dict.copy() helps.

English / ML - ablation study/analysis

(20) In the context of deep learning, what is an ablation study? - Quora, may God forgive me for a Quora link -

An ablation study typically refers to removing some “feature” of the model or algorithm, and seeing how that affects performance.

and

An ablation study is where you systematically remove parts of the input to see which parts of the input are relevant to the networks output.

First seen in page 3 of Deep contextualized word representations

Knowledge wikis

Gabor Melli’s Research Knowledge Base looks to be basically what I’ve tried to do. His layout for the posts is also interesting, for example see here: Personal Blog - GM-RKB It has a Context, Example(s), Counter-Example(s), and References. But I can't find any meta-level page describing this Gabor Melli’s Knowledge Base (GM-RKB) - GM-RKB. Usually the more interesting topics contain other stuff, such as Meaningless Universe Theory - GM-RKB the References contain actual quotes.

I really really really want to resurrect my own wiki.

Tensorflow v1

    x = e.__call__(myinput)

    sess = tf.Session()
    sess.run(tf.global_variables_initializer())
    result = sess.run(x)

The tf.global_variables_initializer() gets rid of “Attempting to use uninitialized value” errors.

CNN visualization (ML)

How to visualize convolutional features in 40 lines of code has very cool pictures of intermediate layers of a CNN, along with pictures that seem to fit to it. This is realyl really cool.

qutebrowser bindings

qutebrowser/.config/qutebrowser/autoconfig.yml · 39516940c80b70bab059e563a129709882f4a41e · Jay Kamat / dotfiles · GitLab has very interesting bindings, with interesting commands like fake-key and stuff, along with per-websites(?) bindings; javascript whitelisting.

CNN tutorial

Again I come back to this nice resource: 6.4. Multiple Input and Output Channels — Dive into Deep Learning 0.7.1 documentation

It has a very nice explanation of CNNs and in/out channels and stuff.

Especially output channels:

Regardless of the number of input channels, so far we always ended up with one output channel. However, as we discussed earlier, it turns out to be essential to have multiple channels at each layer. In the most popular neural network architectures, we actually increase the channel dimension as we go higher up in the neural network, typically downsampling to trade off spatial resolution for greater channel depth. Intuitively, you could think of each channel as responding to some different set of features\o(6.4. Multiple Input and Output Channels — Dive into Deep Learning 0.7.1 documentation)

Duckduckgo I’m feeling lucky

This is awesome! Works with a backslash: \tf.nn.maxpool

Vim “Done” map/macro

The following inside the .vimrc moves the selected line to the end of the file and takes the cursor back: map <C-d> dGp''

For details, cursor movement - How do I jump to the location of my last edit? - Vi and Vim Stack Exchange.

From the first answer:

The \`. command will bring you to your last change.

The \` goes to a mark, and . is a “special” mark which is automatically set to the position where the last change was made. See :help `. for some more information.

There is also `` which will bring you back to where the cursor was before you made your last jump. See :help \`\` for more information.

Another useful mark is \`^; this is the position where the cursor was the last time when insert mode was stopped. See :help \`^.

See :help mark-motions for some more general info about using marks (including some other “special” marks that are automatically set).

Python ModuleNotFoundError ‘requests’

To get requests one has to install requests-html. requests might already be installed.

Why did I get ModuleNotFoundError instead of ImportError? Apparently it’s new in Python 3.6 and it’s a subclass of ImportError, just more precise; catching ImportError would work for it too.

Programming cases name

From naming - What are the different kinds of cases? - Stack Overflow:

  • Flat case: myvariable
  • Kebab case: my-variable (this is the most famous. Other names include: caterpillar case, dash case, hyphen case, lisp case, spinal case and css-case)
  • Camel case: myVariable
  • Pascal case: MyVariable (other names: capital camel case)
  • Snake case: my_variable (other names: c case)
  • Macro case: MY_VARIABLE (other names: upper case)
  • Cobol case: COBOL-CASE (other names: Train case)

unittest @skipUnless Python unit testing

models/transformer_main_test.py at master · tensorflow/models uses a neat thing:

@unittest.skipUnless(tf.test.is_built_with_cuda(), 'requires GPU')
def test_train_1_gpu_with_dist_strat(self):
  FLAGS.distribution_strategy = 'one_device'
  t = transformer_main.TransformerTask(FLAGS)
  t.train()}

Linux keyboard compose key

Yet another change to the layout - now compose lives on rwin: setxkbmap -option -option 'grp:rctrl_toggle, compose:rwin' v4,ru &

This makes the entire file as follows:

setxkbmap -option -option 'grp:rctrl_toggle, compose:rwin' v4,ru &
xrandr --output HDMI-2 --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-1 --off --output DP-1 --off --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-2 --off
xcape -e 'Control_L=Escape' -t 100  &
xmodmap ~/s/mod4 &
keynav &

English

A Snowclone is a cliché and phrasal template that can be used and recognized in multiple variants.

Examples:

  • Eskimo words for snow
  • In space, no one can X
  • X is the new Y
  • The mother of all X
  • X-ing while Y
  • To X or not to X
  • Have X, will travel
  • X considered harmful

Another explanation of Transformer - “The Annotated Transformer”

The Annotated Transformer seems the very best explanation I’ve found. It’s a Jupyter notebook, very detailed and containing an implementation. Link found here: course-nlp/8-translation-transformer.ipynb at master · fastai/course-nlp which in turn is a Jupyter Notebook used in this nice Youtube video lecture: Introduction to the Transformer (NLP video 17) - YouTube.

In this post I present an “annotated” version of the paper in the form of a line-by-line implementation. I have reordered and deleted some sections from the original paper and added comments throughout.

In general everything posted by the Harvard NLP team is very interesting for me especially: Code. It’s all nicely visualized and/or with source code.

Linux watch command

It runs a command continuously and updates the screen when the output changes. Found in my zsh history, watch nvidia-smi is one example.

Heaps’ law

Heaps’ law - Wikipedia “is an empirical law which describes the number of distinct words in a document (or set of documents) as a function of the document length (so called type-token relation)”. In “See also” it has quite a large amound of other “laws” which may be interesting.

NLP Reddit

Natural Language Processing exists and is surprisingly active.

Keras Transformer Bert implementation

kpot/keras-transformer: Keras library for building (Universal) Transformers, facilitating BERT and GPT models is a non-official Transformer and Bert implementation using Keras >= 2.0

Stanford CS 224N - Natural Language Processing with Deep Learning

Stanford CS 224N | Natural Language Processing with Deep Learning has lectures, slides etc etc etc. Based on the lecture 06 from 2019, it’s freaking awesome, I really like the way the slides are done. I really really really like the way slides are done. In general that course would answer most of the questions I’ll ever have

It also has literature suggestions, all free to read online. Very glad I found it.

Ambient sleeping pill

Ambient Sleeping Pill – Internet Radio for Sleep, Meditation & Relaxation is what it says it is. Background music is okay. “For sleep, meditation or study”. Nice alternative to brain.fm

Intellij idea “Add as content source” getting ignored that leads to “module not found” in Python depending on the order of the files of $PYTHONPATH and/or sys.path

I had two modules, both marked as source roots, with conflicting subfolder names. It could not find modules inside the second folder. Right click → Unload modules helped; I could unload the conflicting module, after this it happily started importing the files from the second source root. This is a band-aid fix but for now it works; TODO later find out a better way to solve these problems.

If not, there are always uglier hacks like sys.path.extend(['folder_marked_as_source_root_that_doesn't_seem_to_get_added_to_$PATH'])

Emulate Python prompt during debugging in Intellij Idea

An interactive shell can be used during debugging in intellij idea! See Interactive console during debug? – IDEs Support (IntelliJ Platform) | JetBrains

Keras saving model ‘Not JSON Serializable’ error

Cannot export Keras model TypeError: (‘Not JSON Serializable:’, b’\n…’) · Issue #27112 · tensorflow/tensorflow - yet another reason to use Keras’ own methods. tf.concat -> tf.keras.layers.Concatenate etc etc etc.

Keras loading weights from only some layers of the model

machine learning - How to load only specific weights on Keras - Stack Overflow

If your first 9 layers are consistently named between your original trained model and the new model, then you can use model.load_weights() with by_name=True. This will update weights only in the layers of your new model that have an identically named layer found in the original trained model.

Transformer & BERT ML article

NLP — BERT & Transformer - Jonathan Hui - Medium is probably the best explanation of the Transformer and BERT I’ve even seen.

Fill paragraph, Knuth and psychologically bad breaks

Implement Fill Paragraph for coments · Issue #2737 · intellij-rust/intellij-rust

This is fascinating problem, originally solved by Knuth himself, and a primarily example of dynamic programming: www.eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf. However interesting the problem might be, I’d rather my IDE solved it, and not me :-)

TODO - read it sometime maybe, I’ve skimmed through it and it looks very interesting.

Intellij Idea ideavim plugin remove keybinding

Predictably to remove a keybinding imported from .vimrc in .ideavimrc the usual syntax is used: unmap <C-h>

Intellij Idea Ideavim go to last modified line

The vim shortcut '' works in ideavim as well!

General idea about Tensorflow and writing stuff for it

It’d be nice to have fixed values (and especially dimensions!) for my tensors that I use for testing stuff such as layers. If my input tensors’ dimensions are predictable, like [10, 9, 8, ...] for each dimension, I’d be able to recognize them immediately at various stages without having to think about it. For a level up, I can consider for example Fibonacci numbers or similar, that have different divisors, so that the program will fail early and predictably if I do something wrong.

Otherwise I kinda like the approach of Tensor Considered Harmful, especially the part where dimensions have human-readable names.

Deutsch / Jour fixe

TIL: Jour fixe ist ein in einer kleinen Gruppe von Personen fest vereinbarter, regelmäßig wiederkehrender Termin (Regeltermin), zum Beispiel „jeder zweite Donnerstag im Monat“. In der Arbeitswelt wird zu diesem Regeltermin meist eine Besprechung durchgeführt.

reStructuredText for Python documentation

7. Documenting Python — Python Developer’s Guide is something I can try to follow. PEP 287 – reStructuredText Docstring Format | Python.org has more examples.

Getting permanent links to files - GitHub Help tells me to press y for the URI to update to the permanent link to that version of the file.

Ideavim search seems “smart” by default, ignores case unless I use case in my search.

Taskwarrior project:

project:myproject can be replaced by pro:myproject

Meta - Diensttagebuch

Updated the layout to output 10 posts in full and 10 as links on the first page, instead of the previous 3/7.

English Idioms

See the writing on the wall - Idioms by The Free Dictionary — “To notice and interpret apparent signs or indications that something will or is about to happen in the future, especially something bad or unfortunate.”, “To know something is about to happen”. Found here.

Random

Spent a lot of time understanding why do i3 and my mouse and Intellij Idea not work, fix was removing the headphones that were pressing a mouse button on the laptop.

Change volume on different soundcard

Added the following lines to .config/i3/config:

bindsym Mod1+r exec amixer -c 1 set PCM 5%+ && amixer get Master -D pulse | egrep -o '([0-9]+)%' | egrep -o '[0-9]+' | xargs -0 volnoti-show
bindsym Mod1+c exec amixer -c 1 set PCM 5%- && amixer get Master -D pulse | egrep -o '([0-9]+)%' | egrep -o '[0-9]+' | xargs -0 volnoti-show

bindsym Mod1+Shift+r exec amixer set Master 5%+ && amixer get Master -D pulse | egrep -o '([0-9]+)%' | egrep -o '[0-9]+' | xargs -0 volnoti-show
bindsym Mod1+Shift+c exec amixer set Master 5%- && amixer get Master -D pulse | egrep -o '([0-9]+)%' | egrep -o '[0-9]+' | xargs -0 volnoti-show

Now there are two shortcuts for two volumes :)

Use vim to change encoding of file

:set fileencoding=utf8, then :w newfilename.

Qutebrowser clear all finished downloads

Added this to config.py: config.bind('<Ctrl-I>', 'download-clear')

Python string sanitization

Different ways to ‘sanitize’ a list of strings to ensure they don’t contain any of the contents of another ‘ignored’ list

Tensorflow Dataset API split to train/test

Splitting a tf Dataset is surprisingly hard. Best option is

test_dataset = all_dataset.take(1000) 
train_dataset = all_dataset.skip(1000)

Along with stuff like this if you know the dataset size:

train_size = int(0.7 * DATASET_SIZE)
val_size = int(0.15 * DATASET_SIZE)
test_size = int(0.15 * DATASET_SIZE)

(Though I don’t see any fuction to get a dataset size from the Dataset).

Both from Split a dataset created by Tensorflow dataset API in to Train and Test? - Stack Overflow

Tensorflow running eagerly TODO

What is the difference between setting run_eagerly while compiling a tf.keras model vs setting it after compilation vs tf.config.experimental_run_functions_eagerly(True)?

Tensorflow saving models blues

As of Di 03 Mär 2020 17:11:47 CETA, it seems saving weights both in .h5 format and tf format is broken. For TF format, [TF2.0] Bug when saving weights with custom layers · Issue #26811 · tensorflow/tensorflow, you should use .h5; For .h5, Tensorflow 2.x seems to use the same names of Variables if they are unnamed, which creates conflicts when saving. The fix is to name all the variables: Custom layer weights all have the same name by default · Issue #36650 · tensorflow/tensorflow

Zinc for common colds

This paper: Zinc for the common cold—not if, but when says that it’s conclusive evidence that it helps at <24h after the start and that it reduces the risk of colds. I’m not sure I understand what’s the right dose though

Python imports

Python ‘No module named’ error; ‘package’ is not a package - Stack Overflow TL;DR Beware of conflicting filenames.

I keep getting bitten by this - if I have a folder called something and inside it something called something.py and want to import something from the folder, it will take something to mean something.py instead of the folder.

Quoting the most helpful answer:

I was using the same name for both a sub-package (directory) and a module (file) within it.

For example I had this:

    /opt/mylib/myapi
    /opt/mylib/myapi/__init__.py
    /opt/mylib/myapi/myapi_creds.py        # gitignored file for user/pass
    /opt/mylib/myapi/myapi.py              # base module, load creds and connect
    /opt/mylib/myapi/myapi_dostuff.py      # call myapi.py and do work

The script ‘myapi.py’ imports credentials from myapi_creds.py via this statement:

    from myapi.myapi_creds import my_user, my_pass
 
Testing the module 'myapi.py' resulted in this error:
 
    $ ./myapi.py
    Traceback (most recent call last):
      File "./myapi.py", line 12, in <module>
        from myapi.myapi_creds import my_user, my_pass
      File "/opt/mylib/myapi/myapi.py", line 12, in <module>
        from myapi.myapi_creds import my_user, my_pass
    ModuleNotFoundError: No module named 'myapi.myapi_creds'; 'myapi' is not a package

The solution was to rename myapi.py to myapi_base.py so it’s name does not collide with the sub-package name.

Markdown code in quotes

Is there a way to put code blocks in block quotes? - Meta Stack Overflow TL;DR Code is indented four spaces, but inside a quote (>) they have to be indented five spaces.

English - dingbat

dingbat - Wiktionary - crazy person - typographical ornament (like arrows) - small device/gadget the correct term for which is forgotten/unknown

Scipy normality test

scipy.stats.normaltest — SciPy v1.4.1 Reference Guide - function returns amongst other things p-value that the sample comes from a normal distribution.

Meaning of buffer_size= in dataset.shuffle()

tensorflow - Meaning of buffer_size in Dataset.map , Dataset.prefetch and Dataset.shuffle - Stack Overflow

It affects how random the shuffle is. A buffer size of 1 would not shuffle at all, one bigger than the dataset would be perfect. It’s basically the size of the randomly created bucket from which we pick the next element.

German - Geburtsname

Geburtsname: Vorname oder Nachname - Das versteht man darunter - FOCUS Online

Müssen Sie in einem Formular Ihren Geburtsnamen angeben, handelt es sich um Ihren Nachnamen, den Sie bei Ihrer Geburt erhalten haben. Sofern Sie nicht geheiratet und den Namen Ihres Ehemanns oder Ihrer Ehefrau angenommen oder eine Namensänderung beantragt haben, können Sie hier Ihren aktuellen Nachnamen angeben.

Bash/terminal command with a certain percent chances of running

[ $[$RANDOM % 10] = 0 ] && do_this || do_that “s gives roughly a 1 in 10 chance of do_this running, and a 9 in 10 chance of do_that running. You can omit || do_that to just have a 10 percent chance of do_this running.” (seen here: Clear Your Terminal in Style - Adam.)

Vim vimmotion plugin in visual mode

The vim vim-easymotion plugin (easymotion/vim-easymotion: Vim motions on speed!) also works in select/visual mode!

EDIT: there’s an intellij idea plugin! Just wow

Intellij Idea / Ideavim / Easymotion plugin

I’m very very very glad about this, this is one thing that I missed from vim! AlexPl292/IdeaVim-EasyMotion: EasyMotion emulation plugin for IdeaVim

To activate I had to add set easymotion after setting the leader key in .ideavimrc.

I just to not-forget about it.

Matplotlib/pyplot reset styles

If I set a style like paper with plt.style.use('paper') it changes some settings (esp. in Jupyter Notebook) that don’t get overwritten by the next calls to plt.style.use(). For this, plt.style.use('default') exists. (Found here: python - How to recover matplotlib defaults after setting stylesheet - Stack Overflow)

Matplotlib have lines of the same colours when cycling / set line colour explicitly

Found here: python - How to set same color for markers and lines in a matplotlib plot loop? - Stack Overflow

The idea is to access the colour cycle directly:

    ax = plt.gca()
    color = next(ax._get_lines.prop_cycler)['color']
    plt.plot(x, y, linestyle='', markeredgecolor='none', marker=marker.next(), color=color)

Also I learned that there’s a nice way to get a value for ax when I don’t have it: ax=plt.gca() And that I should look into itertools because this is really neat (TODO: Look into itertools):

marker = itertools.cycle(('o', 'v', '^', '<', '>', 's', '8', 'p'))
marker=marker.next()

Matplotlib get list of available styles

The list of available styles in matplotlib: plt.style.available

To use: plt.style.use('paper')

Matplotlib adjust subplots

When creating a plot with many subplots via a loop I had the issue that they were too close together. Fixed with plt.subplots_adjust(): matplotlib.pyplot.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)`

matplotlib.pyplot.subplots_adjust — Matplotlib 3.1.2 documentation

Matplotlib subplots

TODO add what I finally understood about the location of the subplots

Tensorflow Keras reset states of everything

Everytime I call model.fit() it does NOT reset the weights, DOES reset the hidden states (such as RNN/LSTM), does NOT reset optimizer settings. machine learning - keras.fit() re-initialises the weights - Stack Overflow

If I want to reset them, keras.backend.clear_session() should clear the info from the previous model.

Toread

How to Make Yourself Into a Learning Machine - Superorganizers - fascinating practical use of the Zettelkasten method, amongst other things - don’t have time for this now but I will read it later. + Using Anki to Remember Everything You Read | Hacker News as my source.

Adding to this:

TODO Qutebrowser

  • Create a better ym that automatically escapes things like |
  • Resurrect pchr8.net/f/ since I really really miss it as my place to organize stuff

Qutebrowser tab-give keybinding

Added config.bind('tg', 'set-cmd-text -s :tab-give') to qutebrowser config.py. set-cmd-text is nice, -s means add space to the end, and now I know more about qutebrowser modes in general - for example, I can do keybindings even while I’m inserting a :command. The further it goes the more I love qutebrowser.

Intellij idea debugger

Debug tool window - Help | IntelliJ IDEA

If I click and the Debugger pane disappears, Alt+5 makes it appear again in the previous state.

cat compressed files with zcat

This is very nice: zcat auth.log.3.gz

Choose default webcam

lenovo - 18.10: how to set system default webcam? - Ask Ubuntu

mv /dev/video0 /dev/video0.original
ln -s /dev/video2 /dev/video0

Keras / Tensorflow why saving a subclassed model is hard

Very nice R-centric explanation, but should be valid for Python too: Saving and serializing models

A subclassed model differs in that it’s not a data structure, it’s a piece of code. The architecture of the model is defined via the body of the call method. This means that the architecture of the model cannot be safely serialized. To load a model, you’ll need to have access to the code that created it (the code of the model subclass). Alternatively, you could be serializing this code as bytecode (e.g. via pickling), but that’s unsafe and generally not portable.

TODO Tensorflow model saving / prediction

Why am I getting wildly different accuracies and losses after loading the model from .h5 file, when model.weights for both are identical and predictions (using model.predict()) too? This probably has something to do with me misunderstanding datasets, how exactly?

Tensorflow/Keras

Githubusing keys instead of passphrase

This is very nice and concise: Setup SSH keys for use with GitHub/GitLab/BitBucket etc, along with this series: Generating a new SSH key and adding it to the ssh-agent - GitHub Help

TL;DR generate a key, add it to Github, add it to the ssh-agent as

$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add ~/.ssh/id_rsa

Test the results as

→ ssh -T git@github.com                     
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

If the key is in a non-default location, Host github.com HostName github.com User jaeaess IdentityFile ~/.ssh/id_rsa_github_jaeaess is needed in the ~/.ssh/config file.

To push without being asked for passwords, the remote needs to be changed from HTTPS to SSH:

$ git remote remove origin
$ git remote add origin git@github.com:AquilineAdaeze/gitformyMac.git

Since it doesn’t seem to be persistent, the unsafe way (even though it’s considered unsafe in general) is to add ssh-add -q ~/.ssh/id_rsa_github to startup.

Intellij Idea copy absolute path

To copy absolute path of a file, Ctrl+Shift+C works.

Transformer Keras load a trained model and do some changes

Very interesting discussion: Loading a trained model, popping the last two layers, and then saving it · Issue #8772 · keras-team/keras

For the Sequential model, model.pop() also exists but not for the Functional one.

For a Functional model, after getting a model from an .h5 file, we can do things such as: new_model = Model(model.inputs, model.layers[-3].output)

Changed font in the Terminal

Changed the font from Fira Code Light to Fira Code Medium (EDIT: now Bold. True-bold text still gets rendered as extra-bold, which is very nice too!). It works much better on not-bright-enough screens that stand in front of too-bright windows.

Tensorflow saving model weird errors about init things

I could not save a Tensorflow Keras model, the issue was that I passed arguments from init as: self.whatever = whatever, then changed self.whatever to a different data type (string to b’ytes’ w/ .encode in my case), then in the get_config() function then I happily said {'whatever': self.whatever,} which then could not be encode()‘d.

Random / interesting

Granular convection - Wikipedia is the process where biggerr parts of something float above when surrounded by smaller parts of something and vibration.

History is happening

I’m not sure this is the place for this (oh wait, my blog, I decide the rules, it is now), but since the universe is interesting right now, I feel like preserving some parts. Not necessarily like a diary, just links that I feel will represent this interesting time better than many words could.

German

The Mad Hatter in Alice im Wunderland in German is Der Hutmacher!

Mediawiki + SMW update

This was so so so easy, oh my God. Even though I was updating basically everything from a very old version, to a different PHP and MariaDB version.

TL;DR move files, install manually my one extension needed, export/import mysql table data, point the wiki to the newly created table/db, run php maintenance/update.php and it just magically took care of everything. Only gotcha was that I forgot the db prefix, which gave me DBQueryError after restore; error in update.php on Project:Support desk, solved with the first google result. This was so much easier than expected.

EDIT2 - forgot about Extension:ParserFunctions - MediaWiki, and a couple of smaller ones. So:

# End of automatically generated settings.
# Add more configuration options below.

enableSemantics('pchr8.net');
wfLoadExtension( 'ParserFunctions' );

wfLoadExtension('CategoryTree');
$smwgShowFactbox=SMW_FACTBOX_NONEMPTY;
wfLoadExtension('NewestPages');

EDIT3: Had to move the /images/ folder with its content. To check for them, Gallery of new files - Fiamma works

Now live again at pchr8.net/f/

EDIT4: properties seem to be broken and capitalized, which makes semantic search unusable. I’ll deal with it later.

Jonatan Hui blog

Jonathan Hui blog Mostly ML stuff in a static html blog.

zsh setting and checking environment variables

If I do: export PYTHON_PATH=$(pwd), then check it via $PYTHON_PATH hoping to see something like:\ zsh: command not found: Fr 20. Mär 19:48:01 CET 2020 - this won’t happen, as this is a path, and the result would be same as cd $PYTHONPATH, therefore outputting nothing and leaving me with the impression that the value was not being set.

History is happening

My favourite corona-Dashboard has a nice new option to “align by date of 100th case”: Coronavirus charts

It looks like this today:

Corona Dashboard

Bash print full path to a file

I’m so glad this exists and I don’t have to do pwd+ls+copypaste anymore!

# realpath example.txt
/home/username/example.txt

Not a default shell built-in, readlink -e (or -m or -f) does the same.

(shell - bash/fish command to print absolute path to a file - Stack Overflow)

Quotes

Moses was fond of repeating at this time a quote often used in Albany. “You can get an awful lot of good done in the world if you’re willing to let someone else take the credit for it.” (The power broker by Robert A. Caro, p.315)

xclip using it right

Copy and paste at the Linux command line with xclip | Opensource.com

The line is yourcommand | xclip -sel clip which is aliased to xc, so yourcommand | xc.

scp port forwarding

If I have something running on servername:6006 reachable only from 127.0.0.1 (on the server itself), I can do this: ssh -L 4000:127.0.0.1:6006 servername

Which makes it available for me from my localhost as 127.0.0.1:4000

To check if the thing running on servername can be reached from outside, netstat -tulpen

A Guide to SSH Port Forwarding/Tunnelling - Boolean World

qutebrowser tabs width

Added this to qutebrowser’s config.py, two keybindings to make the tabs width smaller and back, to save screen space.

config.bind('<Ctrl-L>', 'set tabs.width 10%;; set tabs.favicons.scale 0.8;; set tabs.indicator.width 0;;set tabs.title.format {index}:{current_title}')
config.bind('<Ctrl-R>', 'set tabs.width 20%;; set tabs.favicons.scale 1;; set tabs.indicator.width 2;;set tabs.title.format {audio}{index}: {current_title}')

English

tetchy - “Easily annoyed or irritated; peevish, testy or irascible.”

Podcasts

Lost in Larrimah - Whooshkaa has 6 episodes 20 mins each and it sounds interesting.

Python formatting

PyFormat: Using % and .format() for great good! is a website dedicated completely to Python formatting that I could read through someday.

History is happening

Tutto bene (from Coronavirus: Italy bans any movement inside country as toll nears 5,500 | World news | The Guardian)

Random / Interesting

Why do color TVs make black and white snow? | Hacker News

The other question is “why don’t you see that noise when the TV is tuned in?” The TV has automatic gain control. When the signal is weak, it will amplify it up to the right level. If the signal is just background noise, then it will amplify that background noise until it’s at the “right level” for a proper TV signal. So, the gain is lower for stronger signals, and very high when there is no signal at all.

the artefacts created in the black and white picture by the colour signal are hardly noticeable, but they are enough to recover the colour from a black and white recording! The Unofficial Colour Recovery Wiki | Fandom

Programmer competency matrix

Programmer Competency Matrix – Sijin Joseph, I don’t agree with everything but looks like a nice blueprint

Random

xkcd

Picture from xkcd what-if 0034 found on this article about evaluating LMs: Evaluation Metrics for Language Modeling and hotlinked from what-if 0034.

Qutebrowser

Added to config.py:

c.tabs.pinned.frozen = False
c.tabs.title.format_pinned = "{current_title}"

German / Deutsch

Cabinfever is der Lagerkoller.

Kitty - the terminal emulator

Added bindsym $ms+Return exec ~/.local/kitty.app/bin/kitty to ~/.config/i3/config kitty - the fast, featureful, GPU based terminal emulator — kitty 0.17.1 documentation is really awesome actually, and noticeably faster than any other terminals I’ve used.

TODO - read through the documentation linked above, esp wrt zooming and config.

<Ctrl+Shift+F2> opens the config file. In general I love everything about Kitti for now, in all the tiny little details.

Changes:

font_family      FiraCode-Bold
font_size 10.0
cursor_blink_interval 0.5
scrollback_lines 5000
strip_trailing_spaces smart

background_image ~/test.png
background_image_layout tiled
background_tint 0.7

Random / interesting

Waffle House Index - Wikipedia

If you get there and the Waffle House is closed? That’s really bad… — Craig Fugate, Former Head of the Federal Emergency Management Agency

Qutebrowser writing python userscripts

Just wrote this and put it into ~/.local/share/qutebrowser/userscripts/yank.py.

This is an userscript that allows me to escape my only problematic markdown character (|) when copying with ym:

#!/usr/bin/python3
import os

title = os.environ['QUTE_TITLE']
title = title.replace("|", "\\|")

url = os.environ['QUTE_URL']

with open(os.environ['QUTE_FIFO'], 'w') as f:
    f.write("yank inline \"[{}]({})\"".format(title, url))

Added config.bind('ym', 'spawn --userscript yank.py') to config.py

Python set environment variables

Why did I need to use with open(..) as f: in the above script and couldn’t just do os.environ['sth']='sth else'?

Taskwarrior task annotation

It took seeing qutebrowser/taskadd at master · qutebrowser/qutebrowser to learn that you can annotate tasks in taskwarrior! task 123 annotate my annotation that can be long adds a visible line with the annotation under the task that is shown whenever the task is shown. This is awesome and I should read manpages sometimes.

Keyboard layout

I should finally put it in order, especially given that I mostly don’t use the left-hand part of the left-hand typing layout, I started today by putting my ` and ~ no LALT+SHIFT+apostrophe by adding this:

key <AD01> { [ apostrophe,!quotedbl, grave, asciitilde] };

to /usr/share/X11/xkb/symbols/v4

Making Fiamma / Semantic Mediawiki alive again

{{=}} template

Using Template:= - Wikipedia as an example, I created a page located at = - Fiamma which I can include as {{=}} to replace URIs in parameters in my Template:B - Fiamma template. I’m not sure how would I edit all pages containing equal signs in parameters but this is a nice start. My source is Help:Template - Wikipedia, first bullet point.

Same works for |, for which there’s already the default template {{!}}.

New javascript bookmarklets qutebrowser userscripts!

The old venerable bookmarklets I wrote about here Updated Fiamma “Add link” bookmarklet (now there are two of them!) | Я сам, соломка, чай. are as dead as it gets, I’ll write one userscript to rule them all :) Or one userscript and one vim script to expand it.

Current iteration is:

#!/usr/bin/python3
import os
from urllib.parse import quote_plus

def urlencode(string):
  return quote_plus(string)

def replace(original):
    new = original.replace("|", "-")
    return new

title = os.environ['QUTE_TITLE']
url = os.environ['QUTE_URL']

newTitle = replace(title)
newUrl = replace(url)

et = urlencode(newTitle)
eu = urlencode(newUrl)

fiammaUrl = 'https://pchr8.net/f/index.php'
url = fiammaUrl+'?title='+et+'&action=edit&preload=Template:NewLink&preloadparams[]='+eu+'&preloadparams[]='+et

with open(os.environ['QUTE_FIFO'], 'w') as f:
    f.write("open -w {}".format(url))

Pages to test this on:

Running userscript in qutebrowser

I had issues with commands executing too early, for example before the previous one has executed. So:

config.bind('B', 'spawn --userscript open_fiamma_page.py')
config.bind('T', 'hint inputs --first;; later 20 leave-mode;; later 20 open-editor')

Lastly for some reason the “later” sometimes are interpreted as starting at the same time, not from the time the last command finished executing.

Vim macros for the vimwin

(sorry)


" let @H = 'gg??c??bi??c??b{{B|^[^[^[j0i|^[^[^[ji|j?kb^[^[^[ji|^[^[^[o}};q' " For the 5 lines
" let @L = 'ji{{$?kb%?kb#set:\^Mk=?kD^[o|+sep=,}}^[' " For the tags
" let @C = 'i[[C;tj?kb?kb?kbategory: ^[^[^[A]];q' " For each individual category 
" let @F = 'jjVG:norm! @C\^M' "Apply that to all lines till the end
" let @d = '@H@L@F'
" let @q = '^[A^[bbbbbbi|??^B?kb^[:%s/=/{{=}}/ge^M'

" Summed up:
let @C = 'i[[C;tj?kb?kb?kbategory: ^[^[^[A]];q' " For each individual category
let @H = '^[A^[bbbbbbi|??^B?kb^[:%s/=/{{=}}/ge^Mgg??c??bi??c??b{{B|^[^[^[j0i|^[^[^[ji|j?kb^[^[^[ji|^[^[^[o}};qji{{$?kb%?kb#set:^Mk=?kD^[o|+sep=,}}^[jjVG:norm! @C^M:x^M'
" let @d = '@H@L@F'

The above changes text like:

https://www.pchr8.net/d/dtb/
Diensttagebuch - A purely technical blog about things I did on particular days, for future reference and search.
5


tag1, tag tag2, tag3

Cat1
Cat2
And a category with space

to


{{B|https://www.pchr8.net/d/dtb/
|Diensttagebuch - A purely technical blog about things I did on particular days, for future reference and search.
|5
|6
}}
{{#set:
k=tag1, tag tag2, tag3
|+sep=, }}

[[Category: Cat1]]
[[Category: Cat2]]
[[Category: And a category with space]]

For the above, jekyll had issues with utf-8 encoding and the escaped characters, so I copy-pasted them with my mouse from my terminal.

Additionally it converts the equal sign to its template, and saves-and-closes gvim.

… And with the glorious new page Waffle House Index - Wikipedia - Fiamma a new era for that wiki starts again!

This raises the question about what is the role of this blog, but I think here we’ll stick to IT stuff

Vim script omit “Pattern not found” error

..especially when writing macros that replace stuff. The magic is the e option at the end:

:%s/x/y/ge

And the vim macro / script doesn’t break anymore.

DTB Master file

Added some things to the concat.sh script, it’s even more ugly now but the resulting page is okay:

echo "Concatting all existing days"
cd _posts
echo \
layout: page
title: Master file
permalink: /master/
"\
> ../master_file.md

History is happening

Hilariously aggressive Covid-19 propaganda banners in China - SupChina

Not gathering for a feast is so you can eat in the future, Not visiting others is so you still have relatives in the future

Everyone you encounter on the streets now is a wild ghost seeking to take your life

Stay in and don’t wander around, You have AC, television, and wifi as your friends

Kitty zoom (=change font size)

To zoom in/out in Kitty:

map ctrl+shift+equal change_font_size all +1.0
map ctrl+shift+minus change_font_size all -1.0

Fiamma qutebrowser userscript

Edited the userscript to pass selected text as a third parameter to the NewLink template, to which I added the third parameter, and removed the automatic closing of the window from the vim macro.

i3 keybindings to move to / select a screen / output

# focus outputs
bindsym $ms+o focus output DP-1-1
bindsym $ms+e focus output HDMI-2
bindsym $ms+u focus output eDP-1

Disable GPU in Tensorflow via environment variable

How to disable GPU with TensorFlow? - Data Science Stack Exchange

import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"

.. or set it from outside the script.

tf.shape(x) vs x.shape

..is 1 hour 58 minutes of debugging if it’s inside of a dataset.map(). It seems to return None inside .map(), and None==1 is False instead of an exception.

German

  • papierdeutsch – Wiktionary - in trockener, komplizierter deutscher Sprache; im Papierdeutsch. Found when looking for a synonim for ‘baldigst’
  • abwertend – Wiktionary - opposite of ‘lobend’/’positiv’. Found it as description of ‘papierdeutsch’ :)

Giving names to screen sessions

To set a name to a screen session to make attaching it easier, you either set it as parameter during screen creation (screen -S screenname) or set it from inside an attached screen by typing <C-a> :sessionname screenname. It will look like that:

There are several suitable screens on:
	74720.trying_to_run_GPU	(03/28/20 00:33:28)	(Attached)
	70666.whatisthis	(03/28/20 00:20:53)	(Detached)

(Setting a name for a screen session - Unix & Linux Stack Exchange)

To attach it I can use only its name: screen -raAd whatisthis

TODO actually read the man pages and have a better understanding of these flags instead of treating them like incantations.

watch command set interval and highlight changes

This is nice! To watch a file grow in size, except watch ls -lar you can do watch -d -n 1 ls -lar. -d makes it highlight the differences, and -n for some reason is the interval. (-i was taken I guess).

Use only one GPU for training in Tensorflow

I keep googling this, so: export CUDA_VISIBLE_DEVICES=2

And to set an environment variable before running the script (in bash at least) it’s TEST=foo; echo $TEST (shell - How do I set an environment variable on the command line and have it appear in commands? - Unix & Linux Stack Exchange). export is just to make it available for other commands.

Random

It’s quite cute how google interprets me looking for kitty paths linux as cat paths linux, as in I believe that they are kinda similar in many contexts.

That said, it’s very refreshing to see a program where reading the config file documentation on its official website doubles as basic tutorial for the program, since all the keyboard shortcuts used in the example config are the real ones.

Tensorboard & SSH tunnelling

Not sure why this surprises me, but I can first start a SSH shell that does a tunnel (.. and opens a SSH shell), then from it start the thing on the port that I am tunnelling. This almost looks like something I could automate if I do it often enough.

English

ferine - Wiktionary - “pertaining to wild, menacing animals” - same in Italian. First seen here: Ninco Nanco - Wikipedia.

German

speiseöl | Übersetzung Englisch-Deutsch is basically any cooking oil.

Book about baking bread

If you want to learn more about the process and jump off the deep end, Peter Reinhart’s book “The Bread Baker’s Apprentice” is a great place to start. It is detailed without being pedantic, simple without being over-simplified, and oriented for the home baker without forgetting the reasons that professionals do things the way they do.

Why do you need to refrigerate bread dough overnight? - Seasoned Advice

Qutebrowser edit url in editor

config.bind('E', 'set-cmd-text -s :edit-url') added to config.py allows me to press E and the command will be prefilled.

Interesting arguments 6:

-b, --bg: Open in a new background tab.
-t, --tab: Open in a new tab.
-w, --window: Open in a new window.
-p, --private: Open a new window in private browsing mode.

Keyboard layout changes

Made the following changes and bumped the version to v5:

// Changing aoeu for umlauted letters

    key <AC01> { [	    a,	A, adiaeresis,	s]	};
    key <AC02> { [	    o,	O, odiaeresis,	n]	};
    key <AC03> { [	    e,	E, ediaeresis,	t]	};
    key <AC04> { [	    u,	U, udiaeresis,	u]	};

// Adding ~` to the better key for this

    key <AD01> { [  apostrophe,	quotedbl,	grave,	asciitilde] };
    key <AD02> { [	comma,	less,   r, asciitilde] };
// Adding parentheses in a better place

    key <AD08> { [	    c,	C,	Up,	 parenleft	]	};
    key <AD09> { [	    r,	R,	BackSpace,	parenright		]	};

    key <AD07> { [	    g,	G,	bracketleft,	braceleft		]	};
    key <AD10> { [	    l,	L,	bracketright,	braceright]	};

// Numbers!

    key <AB01> { [   semicolon,	colon,1,	exclam] };
    key <AB02> { [	    q,	Q,	2,	at		]	};
    key <AB03> { [	    j,	J,	3,	numbersign		]	};
    key <AB04> { [	    k,	K,	4,	dollar		]	};
    key <AB05> { [	    x,	X,	5,	percent		]	};
    key <AB06> { [	    b,	B,	6,	asciicircum]	};
    key <AB07> { [	    m,	M,	7,	ampersand]	};
    key <AB08> { [	    w,	W,	8,	asterisk]	};
    key <AB09> { [	    v,	V,	9,	asterisk]	};
    key <AB10> { [	    z,	Z,	0,	asterisk]	};

// A new delete key
    key <AC06> { [	    d,	D,	KP_Delete,	asterisk]	};

Now I have brackets on my right hand letters :) I’ll think later what other symbols I still have not learned by heart and move the below. (Numbers, maybe?)

Fiamma userscript update

Updated the userscript to the following, now it removes stuff Mediawiki doesn’t like from the name of the page (but not from the Title, which is not part of the URL!)

#!/usr/bin/python3
import os
from urllib.parse import quote_plus

def urlencode(string):
  return quote_plus(string)

def replace(original):
    new = original.replace("|", "-")
    return new

def replace_name(original):
    new = original.replace("|", "-")
    new = new.replace("[", "(")
    new = new.replace("]", ")")
    new = new.replace("#", "(hash)")
    new = new.replace("{", "(")
    new = new.replace("}", ")")
    new = new.replace("_", " ") # TODO test
    return new

title = os.environ['QUTE_TITLE']
url = os.environ['QUTE_URL']
selected_text = os.environ['QUTE_SELECTED_TEXT']

newTitle = replace(title)
newArticleName = replace_name(title)
newUrl = replace(url)
newText = replace(selected_text)
print(newTitle)

article_title = urlencode(newTitle)
article_name = urlencode(newArticleName)
page_url = urlencode(newUrl)
selected_text = urlencode(newText)

fiammaUrl = 'https://pchr8.net/f/index.php'
url = fiammaUrl+'?title='+article_name+'&action=edit&preload=Template:NewLink&preloadparams[]='+page_url+'&preloadparams[]='+article_title+'&preloadparams[]='+selected_text

with open(os.environ['QUTE_FIFO'], 'w') as f:
    f.write("open -w {}".format(url))

Random / Interesting

This is a nice wikipedia page that starts with “Q.” and not with “Q:”, because “Q:” is forbidden as start of page name: Q. Are We Not Men? A: We Are Devo! - Wikipedia

Pizza dough

I’ll try to do this tomorrow: The Best Pizza Dough Recipe - Sugar Spun Run

Mattermost and Python

For when I get to this, it’s easy, after I install matterhook:

>>> mwh = Webhook('https://chat.mycompany.de', 'myAPIhook')
>>> mwh.send('test',channel='notif')

Very nice explanation here: GitHub - numberly/matterhook: Interact with Mattermost incoming webhooks easily.

Python run from command line / shell with all the imports and stuff

Say I’m in folder2 and want to run folder2/folder/main.py

python3 -m folder.main adds folder2 to $PATH, while python3 folder/main.py adds folder to $PATH. The first option makes all imports much much easier.

Python -v

So apparently python -v exists, output includes the adresses of all loaded modules

English

balmy - Wiktionary - soothing, fragrant, mild, pleasant. Found in Behemoth by Peter Watts.

Vim modeline

I should check vim modelines (Vim documentation: options) out, systematically.

Cooking

Pasta

Try adding cauliflower in my pasta water 7

And pasting my favourite Reddit comment for posterity:

[deleted] 385 points · 1 year ago · edited 1 year ago

This isn’t wrong, but not the tradition Italian way. The way we do it in Italy (Sicily) is to split the sauce in half. Take the pasta out about a minute or less before al dente. If you’re going for the creamy flavor, sauce permitting, mix some butter with the pasta as you’re draining the water. Then put the pasta in the sauce pan with half of the sauce and a (tiny) bit of pasta water. 1/4 of a cup is too much in our opinion because you don’t want to cook the pasta in the sauce for too long. Use the other half of the sauce to top it off. That’s not to say this is the only way Italians do it, but my Southern Italian family has been using this method for generations. I’m not a fan of OP’s method, if you want this kind of pasta just make a cacio e pepe.

On a separate but related note, tomato sauces (without meat) should only be cooked for 30 minutes, after that they lose the aroma. Of course I’m biased, but a simple tomato sauce is one of the easiest and most delicious things in the world to make. Simmer garlic until sizzling (add red pepper flakes with garlic for arrabbiata) add decent plum tomatoes (buy whole ones and hand crush them) with S&P, basil, oregano. You can add some butter if you like. Stir occasionally, 30 minutes later you’re done.

Edit: I always used to laugh to myself when I saw people getting excited about getting their first gold, and now I’m that person. Thanks kind stranger. 8

Bread

You can freeze bread without problems:

He starts with what not to freeze: “I never recommend freezing things like baguettes or ciabatta. Anything that has a large surface-to-crumb ratio just never refreshes the same.” 9

If baking, let your bread cool completely. This will prevent it from becoming soggy or moldy. Wrap each loaf tightly in plastic wrap. Then wrap it in foil or freezer paper. The double-wrap is your secret weapon for freshness.10

Unfreezing works overnight in the refrigerator. 10

While I’m at it, the yeast ratio is 2 1/4 teaspoons dry active, instant, or rapid-rise yeast granules (usually one 1/4-ounce packet) = 2/3 ounce fresh yeast 11

Markdown

If I do annotations / sources / references, I have to put the definition on a new ‘new’ line, so it’s a new block. This was my error back at the very beginning. Not one but two.

TODO Vim

Vim macro to create an reference based on a selected line. 5ategories: []

How to make perfect italian pizza

This is a really nice video: How to Make Perfect Pizza | Gennaro Contaldo - YouTube

Qutebrowser mediawiki yank userscript

Using an userscript for this is overkill, but ``` #!/usr/bin/python3 import os title = os.environ['QUTE_TITLE'] url = os.environ['QUTE_URL'] with open(os.environ['QUTE_FIFO'], 'w') as f: f.write("yank inline \"[{} {}]\"".format(url, title)) ``` Located at `/home/shamotskyi/.local/share/qutebrowser/userscripts/yank_w.py`. In the config, `config.bind('yw', 'spawn --userscript yank_w.py')`

EDIT: replaced this with config.bind('yw', 'yank inline "[{url} {title}]"').

Taskwarrior tasks completed today

I have not been using it to the fullest.

List tasks completed today: task all status:completed end:today This might be something I can copypaste into my pages or in my reports, such as my weekly sprint review! Adding it as a module to siom should be not too hard. Taskwarrior - Usage Examples contains more nice examples.

Python3 glob

glob is not sorted! glob.glob().sorted() though is.

Kitty

kitty - the fast, featureful, GPU based terminal emulator — kitty 0.17.2 documentation: ctrl+shift+s is paste from selection ctrl+shift+u for unicode characters

Set default browser from the shell

sudo update-alternatives --config x-www-browser

Doesn’t seem to work for kitty, but in the config open_url_with qutebrowser works predictably.

English

gratuitous - Wiktionary - given freely, unearned; without reason, unjustified, unnecessary, uncalled for. Seen first in Behemoth by Peter Watts.

Taskwarrior / zsh / … week number

For the sake of consistency (to each other and especially to Google Calendar) now my sprint number and week number is the ISO week number: export SPRINT=$(date +%-V)

Fixed this in:

  • $SPRINT environment variable
  • weekNumberValue in siom
  • i3 statusline:
    tztime local {
          format = "[%V] %a %Y-%m-%d %H:%M:%S"
    }
    

Only place it’s left now is in my paper calendar, but I don’t use it too much these days.

taskwarrior better ‘done / completed last week’ command filter

task all status:completed end.after:eow-2wk – I forgot you could do almost-math with the datetimes!

Editing the output, to sort it by project, divide different ones by newlines, and show the headers of the table but nothing else: task all status:completed end.after:eow-2wk rc.report.all.columns:project,entry,end,tags,description rc.report.all.labels=Project,Created,Finished,Tags,Description rc.report.all.sort:project-/,end rc.verbose:label

screen naming screens

Screens named with screen -S myname and attached by screen -r myname - tab completion works with screen -r!

Taskwarrior list unfinished tasks created more than 2 weeks ago

entry is the time the task was created. So:

task all sprint:$SPRINT status:pending entry.before:eow-3wk tags.not:s rc.report.all.columns:entry,end,tags,description rc.report.all.labels=Age,Done,Tags,Description rc.report.all.sort:end rc.verbose:label,blank is what I’ll use in SIOM.

Google calendar has shortcuts!

I missed this all my life.

  • j/k work predictably.
  • t Today
  • g Go to date
  • c create

Tensorflow GPU use

If more than 1 GPU are visible, tensorflow will take some memory on all of them, even if its actively using only one. Restricting visibility the usual way helps.

Vim custom syntax highlighting

For SIOM and my morning pages the following two commands highlight in yellow all lines starting with a “+” after zero or more of any kind of space:

:syntax match mys /^\s*+.*$/
:highlight link mys Keyword

To do this everytime I open a markdown file:

fun! SetQuestions()
    syn match mys /^\s*+.*$/
    hi link mys Keyword
endfu
autocmd filetype markdown :call SetQuestions()

Python stalinsort testcases

Never thought about it like this, but for simple algorithms the test cases can be put in a nice array and iterated through: stalin-sort/test_utils.py at master · gustavo-depaula/stalin-sort

# pairs of input - output
test_cases = [([1, 2, 3, 4, 5], [1, 2, 3, 4, 5]), # sorted list
              ([5, 4, 3, 2, 1], [5]), # reversed list
              ]
# test sort_fun on all test cases defined above.
def test_all(sort_fun):
  for xs, expected in test_cases:
    print(f'testing with input {xs}, expecting output {expected}.')
    result = sort_fun(xs)
    print(f'output was {result}')
    assert(result == expected)

Other

  • Watched Southern Comfort, 7/10, expected more based on the one clip with the song, but no regrets
  • Drew a couple of things, TODO later paste here :)

History is happening

Mafia distributes food to Italy’s struggling residents

In recent days, the police in Naples have intensified their presence in the poorest quarters of the city, where men tied to the Camorra, the Neapolitan mafia, have organised home delivery of food parcels. Magistrates have already begun an investigation against a group of people who were questioned while distributing food to local residents.

Greater Good podcast

The Science of Happiness | Greater Good is a podcast about happiness, found it while looking for The Happiness Lab which is also a podcast about happiness.

Qutebrowser

Added config.bind('tw', 'set-cmd-text -s :open -w') to config, now tw is like a, but for windows instead of tabs.

Vim markdown references macro

Added this macro: let @R = 'viw"oyi[^^[^[^[^[A]^[^[^[Go[^^[^[^[^["opA]: ^[^[^[^['

When the last word in the line is selected, it gets transformed immediately to a reference. I’ll use this vim cheatsheet as 12.

As a bonus, this uses a non-default vim register so whatever is in my clipboard stays there. (But it destroys whatever I had in "o).

Tensorflow Tensorboard download CSV

Can I export a tensorflow summary to CSV? - Stack Overflow – yes I can, by clicking “show data download links” on the top left of interface and selecting what I want to download below the plots.

Why does loss increase at the beginning of an epoch?

machine learning - Why training loss is increased at the beginning of each epoch? - Stack Overflow - probably because the dataset is not random enough, and the network overfits on the structure of the dataset. Happens with buffer_size dramatically less then the size of the structured dataset.

Qutebrowser open in new background tab

c.tabs.background = True in config opens new tabs in the background when middle-clicking.

History is happening

Nurse blocking anti lockdown protests in Denver : PublicFreakout and the imgur album: Health care workers stand in the street in counter-protest to hundreds of people who gathered at the State Capitol to demand the stay-at-home order be lifted in Denver, Colo., on Sunday, April 19, 2020. Photos by Alyson McClaran - Album on Imgur. As someone said, I really imagine seeing this in history books.

Screen logging

To visualize logs of screen sessions, less -r filename (-R hates ^H progress bars but I search seems to work a bit better) works very well. Even for the (tf) progress bars almost. ansifilter exists but deals with progress bars much worse.

Empirically - for searching and scrolling the same font size / terminal size is very helpful.

Vim macros posting

Just pasting the Vim macro on Day 469, while it did not break Jekyll this time (why?), seems to have broken the RSS script at the beginning of the page.

This page contains the following errors:

error on line 19 at column 73: PCDATA invalid Char value 27

Copypasted the lines from terminal and back, but I need a much better way to save and ‘publish’ the macros. Found Vim Macro Trickz • Hillel Wayne when looking for solutions.

German grammar

  • You need a dot between things like ‘u. a.’ in German, apparently.
  • on a noisy dataset = auf ein Verrauschtes Dataset
  • Dataset = der Datensatz, learned this far too late :)

Essential oils

.. can be added in a bath, but only in a carrier oil, olive oil works.

“For a single bath, three to 12 drops of essential oil in a tablespoon (15 ml) of carrier oil is sufficient to create a very aromatic, therapeutic bath” 12

German

Zinseszins - Wiktionary - compound interest. Beyond logic

pandas / python split string by multiple delimiters

Split string with multiple delimiters in Python - Stack Overflow has this really nice idea of doing str.replace(':', '_') and then str.split('_').

Pandas split string to different columns

Series.str.split(delim) can do Series.str.split(delim, expand=True), that returns different columns instead of a list.

Also - if graphs don’t make sense, one way things have gone wrong is interpreting x and y as strings.

Vim exclamation mark to switch parameters

A ! either forces the action or toggles the action:

:set cursorline, to turn off: :set nocursorline

Is equivalent to:

:set cursorline! 13

python tabulate module

tabulate14 generates nice tables of various formats! Things like:

print(tabulate.tabulate(db,headers=db.columns))

      epoch    loss    val_loss    val f-score
 0        1    4.31        4.62          0.579
 1        2    3.72        3.61          0.705
 2        3    3.54        3.25          0.722
 3        4    3.31        3.06          0.737
 4        5    3.19        2.93          0.736
 5        1    4.31        4.62          0.581
 6        2    3.72        3.61          0.72
 7        3    3.54        3.25          0.755
 8        4    3.31        3.06          0.755
 9        5    3.19        2.93          0.764
10        6    3.12        2.83          0.798
11        7    2.95        2.76          0.779
12        8    2.91        2.69          0.757
13        9    2.84        2.64          0.816
14       10    2.68        2.63          0.835
15       11    2.71        2.56          0.83
16       12    2.69        2.52          0.825
17       13    2.62        2.49          0.826
18       14    2.6         2.46          0.845
19       15    2.56        2.44          0.84

tabulate · PyPI is the basic documentation with visualizations of each tablefmt. It even supports jira! And pipe is the usual markdown format. Let’s try:

  epoch loss val_loss val f-score
0 1 4.31 4.62 0.579
1 2 3.72 3.61 0.705
2 3 3.54 3.25 0.722
3 4 3.31 3.06 0.737
4 5 3.19 2.93 0.736
5 1 4.31 4.62 0.581
6 2 3.72 3.61 0.72
7 3 3.54 3.25 0.755
8 4 3.31 3.06 0.755
9 5 3.19 2.93 0.764
10 6 3.12 2.83 0.798
11 7 2.95 2.76 0.779
12 8 2.91 2.69 0.757
13 9 2.84 2.64 0.816
14 10 2.68 2.63 0.835
15 11 2.71 2.56 0.83
16 12 2.69 2.52 0.825
17 13 2.62 2.49 0.826
18 14 2.6 2.46 0.845
19 15 2.56 2.44 0.84

Tensorflow how does training happen with nan? TODO

How does Tensorflow train stuff when loss is nan? It keeps doing something, accuracy changes, etc etc etc. - is the gradient calculated per batch as normal,

Note

Einstein / Netzah “do your own thing”

History is happening

We live in interesting times.

English

shambolic - Chaotic, disorganised or mismanaged. Found somewhere on The Guardian applied to Trump’s daily health briefings.

German

lutschen / an etwDat. lutschen - to suck (on) sth; Lutschtablette = lozenge.

English

lozenge: 1) A rhombus (shape); 2) A small (originall diamond-shaped!) tablet/sweet for a sore throat.

Random / interesting

Agnes Obel - Fuel To Fire (Official Video) - YouTube

First comment on the video:

All the people in this video are dead. Life is short, don’t do anything that makes you unhappy

Random / interesting

The Technium: 68 Bits of Unsolicited Advice

My favourite parts:

  • Being enthusiastic is worth 25 IQ points.
  • Being able to listen well is a superpower. While listening to someone you love keep asking them “Is there more?”, until there is no more.
  • A worthy goal for a year is to learn enough about a subject so that you can’t believe how ignorant you were a year earlier.
  • Gratitude will unlock all other virtues and is something you can get better at.
  • Treating a person to a meal never fails, and is so easy to do. It’s powerful with old friends and a great way to make new friends.
  • Reading to your children regularly will bond you together and kickstart their imaginations.
  • Rule of 3 in conversation. To get to the real reason, ask a person to go deeper than what they just said. Then again, and once more. The third time’s answer is close to the truth.
    • Compare Five whys - Wikipedia* and death certificates with multiple “due to (or as a consequence of)”
  • The purpose of a habit is to remove that action from self-negotiation. You no longer expend energy deciding whether to do it. You just do it. Good habits can range from telling the truth, to flossing.
  • Promptness is a sign of respect.
  • If you are looking for something in your house, and you finally find it, when you’re done with it, don’t put it back where you found it. Put it back where you first looked for it.
  • Show up. Keep showing up. Somebody successful said: 99% of success is just showing up.
  • Separate the processes of creation from improving. You can’t write and edit, or sculpt and polish, or make and analyze at the same time. If you do, the editor stops the creator. While you invent, don’t select. While you sketch, don’t inspect. While you write the first draft, don’t reflect. At the start, the creator mind must be unleashed from judgement.
  • Perhaps the most counter-intuitive truth of the universe is that the more you give to others, the more you’ll get. Understanding this is the beginning of wisdom.
  • Friends are better than money. Almost anything money can do, friends can do better. In so many ways a friend with a boat is better than owning a boat.
  • You are what you do. Not what you say, not what you believe, not how you vote, but what you spend your time on.
  • When you die you take absolutely nothing with you except your reputation.
  • Before you are old, attend as many funerals as you can bear, and listen. Nobody talks about the departed’s achievements. The only thing people will remember is what kind of person you were while you were achieving.
  • When crisis and disaster strike, don’t waste them. No problems, no progress.
  • When you get an invitation to do something in the future, ask yourself: would you accept this if it was scheduled for tomorrow? Not too many promises will pass that immediacy filter.
  • Acquiring things will rarely bring you deep satisfaction. But acquiring experiences will.
  • Rule of 7 in research. You can find out anything if you are willing to go seven levels. If the first source you ask doesn’t know, ask them who you should ask next, and so on down the line. If you are willing to go to the 7th source, you’ll almost always get your answer.
  • When someone is nasty, rude, hateful, or mean with you, pretend they have a disease. That makes it easier to have empathy toward them which can soften the conflict.
  • Eliminating clutter makes room for your true treasures.
  • Experience is overrated. When hiring, hire for aptitude, train for skills. Most really amazing or great things are done by people doing them for the first time.
  • Buying tools: Start by buying the absolute cheapest tools you can find. Upgrade the ones you use a lot. If you wind up using some tool for a job, buy the very best you can afford.
  • Following your bliss is a recipe for paralysis if you don’t know what you are passionate about. A better motto for most youth is “master something, anything”. Through mastery of one thing, you can drift towards extensions of that mastery that bring you more joy, and eventually discover where your bliss is.
  • The universe is conspiring behind your back to make you a success. This will be much easier to do if you embrace this pronoia.

Backup entire github account with all the repositories

Very nice tool: amitsaha/gitbackup: Tool to backup your GitHub and GitLab repositories

The Github token needed only the repo scope, needed to add it to the env variable with:

export GITHUB_TOKEN=$MYGITHUBTOKEN

Command to backup was:

./gitbackup-0.5-linux-amd64 -backupdir $BACKUPDIR -service github

Should also work for gitlab.

Also magically it took something like 30 seconds for the all of the 3.5GB of all my repos.

Except by clicking on them, f gives numbers you can follow;F outputs the link text in the statusbar.

Anki::Import

The Anki::Import documentation doesn’t make it clear enough, but using a quote(') works too for carrying on old tags along with the usual backtick, but for signalling an empty field only the backtick works.

Also I don’t think I can control the Cloze deletions - it automatically generates identifiers for them. Not going to get into perl to fix this :)

Vim regex reference

Vim Regular Expressions 101 is a really nice reference for vim’s search/replace/regex things. Maybe I’ll work through it later.

Most interesting is that groups are created with \(-\) and mentioned as \1 (will be handy for search-and-replace!)

I miss having a “now learning” textfile. (TODO)

Also this is a nice summary of the differences between vim and python/perl regexes, in vim characters are more likely to be literally interpreted: 8

Perl    Vim     Explanation
x?      x\=     Match 0 or 1 of x
x+      x\+     Match 1 or more of x
(xyz)   \(xyz\) Use brackets to group matches
x{n,m}  x\{n,m} Match n to m of x
x*?     x\{-}   Match 0 or 1 of x, non-greedy
x+?     x\{-1,} Match 1 or more of x, non-greedy
\b      \< \>   Word boundaries
$n      \n      Backreferences for previously grouped matches

And regex101.com remains the best place to test usual regexes.

Pinta and gthumb

I’ve been looking for something simpler than GIMP for casual blurring / cropping / adding text, pinta mostly fits the bill but I find it hard to use and no easy blur brush, gthumb is much more minimalistic in functions but is more pleasant to use.

Zsh global aliases and aliases that take arguments

Zsh has global aliases! An Introduction to the Z Shell - Aliasing is awesome. alias -g M='| more' -> who M

This has a lot of potential for often-typed parts of commands.

But I went there to look for arguments, and apparently zsh explicitly doesn’t have them and wants functions instead. So:

% rm () { mv $* /tmp/wastebasket }
% rm foo.dvi
% ls /tmp/wastebasket
foo.dvi

So I changed my taskwarrior s alias to:

#alias s='task s sprint.is:$SPRINT or sprint:c' 
s () {task s sprint.is:$SPRINT or sprint:c $*}

Now I can finally filter my tasks for the sprint (s +F)

// TODO replace dependence on $SPRINT by just usind current week number.

Not the first time I neglect to read the documentation of the software I switch to, being happy that it mostly works like the previous one.

Inkscape make handler nodes bigger

microscopic handle nodes - Beyond the Basics - Inkscape Forum

Confusingly, that setting is in Preferences > Input/Output > Input Devices.

Krita lags

Krita’s slowness can be fixed by looking at the settings of Display and looking through Krita FAQ — Krita Manual version 4.3.0.

Blog categories

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?

Jekyll images size

![ddr]({{site.url}}{{site.baseurl}}/wp-content/static/pentachronological/d2.jpg){:width="40%"}

Random/Interesting

If you really want to make something good, eat good food and drink good saki. (Welcome to the NHK, episode 20.) 12

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

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

And on the topic of fully enlightened people:

Ad-hoc tables via tabulate

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

Italian

(wow?) debellare - Wiktionary - sconfiggere/eliminare. 16

Searching in quotes

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”

To read / interesting

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

Editing bash scripts

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

Qutebrowser show all bindings

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

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

DTB Todo

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.

Random / interesting

  • fantascienza Problemi di pelle Sebastiano Diciassette

  • 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

Random / Interesting / Quotes

If their absence brings you peace, you didn’t lose them.

Vim read from stdin

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.

Random / Interesting / Quotes

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”

Tensorflow / ML

Binary crossentropy is a special case of categorical crossentropy, for when you have one output.

Zsh / Bash history

I can use syntax like !10600 inside commands in the CLI! They get replaced when needed.

Compressing PDF

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)


## Port knocking and using ports based on IP
> 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](https://news.ycombinator.com/item?id=23187662))

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). [^wiki]

[^wiki]: [Port knocking - Wikipedia](https://en.wikipedia.org/wiki/Port_knocking)

## Random / Interesting
> 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](https://news.ycombinator.com/item?id=23175469))

## English
[All thumbs](https://idioms.thefreedictionary.com/all+thumbs) - Fig. very awkward and clumsy, especially with one's hands. 

[uncouth](https://en.wiktionary.org/wiki/uncouth) - clumsy, awkward, unrefined, crude.


## Python generator expressions are a thing
[How to Use Generators and yield in Python – Real Python](https://realpython.com/introduction-to-python-generators/#building-generators-with-generator-expressions):

nums_squared_lc = [num2 for num in range(5)] nums_squared_gc = (num2 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() or set()), use a generator expression instead!

Generator expressions are functionally equivalent to generator functions.

Python itertools

The itertools module has a lot of awesome stuff! 17

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 stuff

From 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:

  • Finish Diving into Python, at least the parts I feel are relevant If I decide I need more Python in my life,
  • Learning Python 5th edition, 1594 pages, focuses on the Python language which is the official prerequisite to…
  • Programming Python, 1628 pages. It focuses on libraries and tools.

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.

“Vim plugins I use” + read man pages with vim

Vim plugins that I use, Read man pages with vim

The last one is freaking awesome.

English

spunk - spark (fire); courage, spirit, determination.

Vim new highlight groups

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=18 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.

Vim easymotion

Changed the default <Leader><Leader> mapping to s, that I never use, now everything is much easier!

Intellij Idea vim plugin

The * thing to search for word under cursor also works!

Random / Quotes

“Шредингеров кот” (с) Андрей

English

An Ermine, aka Stoat, is the thing Lady with an Ermine holds.

Lady with an ermine by Da Vinci.

Yes.

Hotlinking is allowed from Wikimedia servers, but not generally recommended: this is because anyone could change, vandalise, rename or delete a hotlinked image. 19

First found in The Trouble with Tribbles which I found through Voltaire - The Trouble with Tribbles (Song Only) - YouTube

Python backslashes and raw strings

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.

New vim highlight rules for markdown files

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

Vim increase/decrease number under cursor

Ctrl+a increases the number under the cursor, \ Ctrl+x decreases the number under the cursor.

Interesting / Random

Hypermodern python

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.

Project idea

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

qutebrowser bindings with specifying mode

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.

Random / youtube-dl

Youtube-dl can download video from Reddit! Such as will she fall? (tutorial link in comment) : animation

English

I rest my case | meaning in the Cambridge English Dictionary: - “what just happened proves my point” - said by lawyers in a law court when they have finished the explanation of their case

Taskwarrior

For weird stuff like symbols hard to escape and deleting annotations or whatever, the edit command exists that opens vim and makes everything very easy.

numpy getting started

The Basics of NumPy Arrays | Python Data Science Handbook is a nice refresher on the numpy basics.

German

grundlegend | Übersetzung Englisch-Deutsch is ‘basic’. I was confusing it with gründlich | Übersetzung Englisch-Deutsch, which is closer to ‘exhaustive’

Python unzip

To do the reverse of zip(), the way is list(zip(*previously_zipped_data))

You can write raw SVGs into HTML!

Just wow, I had no idea you could do that:

<b>Hi!</b>

<svg>
<line x1="0" y1="0" x2="10" y2="10" stroke="black"></line>
<rect x="0" y="0" width="10" height="10"></rect>
<circle cx="5" cy="5" r="5"></circle>
<ellipse cx="10" cy="5" rx="10" ry="5"></ellipse>
<polygon points="0,0 10,5 20,0 20,20 10,15 0,20"></polygon>
<polyline points="0,0 10,5 20,0 20,20 10,15 0,20" stroke="black"></polyline>
<path d="M65,10 a50,25 0 1,0 50,25"></path>
</svg>

(Found here: An introduction to d3.js in 10 basic examples)

Random / interesting

Sai - Essays: Meditation & energy work techniques

“It’s simple but not easy”

Intellij Idea / vim plugin / easymotion

Random / Interesting

I really need to sort out where do I put my links, my short-form descriptions of links, my ideas, longer-form things if any.

I need to focus on “being happy” again; I know what to do, how to do it, and objectively - I have time for this.

All of the white people who joined Indian tribes loved it and refused to go back to white civilization. All the Indians who joined white civilization hated it and did everything they could to go back to their previous tribal lives. 21

The Happiness Lab is relevant.

I need to synthesize this all in one nice post or article or work on progress or whatever.

Random / interesting / ety / History is happening

Trending Words

  1. blacklist
  2. family
  3. race
  4. master
  5. chauvinism
  6. human
  7. sand
  8. blackmail
  9. racism
  10. nice

Haha.

Numpy reading from text and discarding comments

numpy.genfromtxt — NumPy v1.18 Manual - lines starting with “#” get discarded by default.

Random / Interesting / English

Soapbox - Wikipedia - A soapbox is a raised platform which one stands on to make an impromptu speech, often about a political subject. The term originates from the days when speakers would elevate themselves by standing on a wooden crate originally used for shipment of soap or other dry goods from a manufacturer to a retail store.

Random / Interesting

Playlist (Psilocybin for depression, Imperial College London, version 1.3) by Mendel Kaelen | Mixcloud

timewarrior

Finally fixed the zsh function and tw command to be able to filter the output by adding escaped parentheses:

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

That said,

When they are not quoted, $* and $@ are the same. You shouldn’t use either of these, because they can break unexpectedly as soon as you have arguments containing spaces or wildcards. 22

random / todo

Create a better vim macro that automatically generates some random text for the reference.

History is happening

Seen a nice newspaper in Italy from something like March 3: “$cityname: first person healed, one in reanimation”.

Also in the plane they give instructions about what to do if there’s a loss of cabin pressure: you take your mask off before you wear the oxygen one.

Java Tutorial

Java Constructors is a nice series of Java tutorials! I’ll be following it to remember everything I’ve forgotten about java.

Intellij Idea has a lot of shortcuts!

sout -> System.out.println() and a lot of other similar ones, TODO find full list.

Random / Interesting

A Bolo tie is a weird kind of tie popular in the Western US; first found in “Pill Mills of Florida” creepypasta.

History is happening

Catholic priest, laity defend statue of St. Louis as leftist protestors become increasingly violent | News | Lifesitenews

Random / interesting / cats

Существует «теория благополучия животных», которая определяет «пять свобод», необходимых животным, которые живут рядом с человеком:

  • свобода от голода и жажды;
  • свобода от дискомфорта;
  • свобода от травм и болезней;
  • свобода поведения, характерного для вида животного;
  • свобода от горя и страданий. 23
  1. Tensors  |  TensorFlow Core  |  TensorFlow 

  2. nlp - What is the positional encoding in the transformer model? - Data Science Stack Exchange 

  3. The Illustrated Transformer – Jay Alammar – Visualizing machine learning one concept at a time 

  4. Label Smoothing: An ingredient of higher model accuracy 

  5. Inner Product – from Wolfram MathWorld 

  6. | qutebrowser 

  7. What’s the deal with Italians not combining onion and garlic in dishes…? : Cooking 

  8. linux - What’s the difference between vim regex and normal regex? - Stack Overflow  2

  9. The Best Way to Freeze and Thaw Bread | Kitchn 

  10. Can You Freeze Bread? Yes, Here’s How. | Taste of Home  2

  11. Does Fresh Yeast Make a Difference When Baking Bread? | Kitchn 

  12. Welcome To The NHK 20 English Dub - YouTube, even though anime on Youtube is one of the more ephemeral things.  2 3

  13. What’s the use of the exclamation mark (‘!’) in Vim’s command line after certain commands like :w!? - Stack Overflow 

  14. Found here: python - Programmatically convert pandas dataframe to markdown table - Stack Overflow 

  15. Welcome To The NHK 21 English Dub - YouTube 

  16. Welcome to the NHK - Ep. 24 - Welcome to the N.H.K.! - END - YouTube  2

  17. 9.7. itertools — Functions creating iterators for efficient looping — Python 2.7.18 documentation 

  18. Vim documentation: usr_44 

  19. Commons:Reusing content outside Wikimedia/technical - Wikimedia Commons 

  20. kerrickstaley/genanki: A Python 3 Library for Generating Anki Decks 

  21. Jackdaws love my big sphinx of quartz - Book Review: Empire of the Summer Moon, as quoted in *In the book he describes the ways modern life has disconnected us from a lot … | Hacker News

  22. shell - What is the difference between $* and $@? - Unix & Linux Stack Exchange 

  23. Татьяна Куликова Sestratk: «о чём хотела бы рассказать ваша кошка» — ЖЖ