Day 626

    Intellij reopening closed windows such as debugging

    Reopening closing windows can be done through View -> Tool windows. It has nice shortcuts that are <Alt-N>, with N=0..9. For example, debug window is <Alt-5>.

    Additionally - I should use F7 / ‘step into’ much more.

    Intellij idea structure

    <Alt-7> opens a nice structure window with info about the long class you’re editing. With nice options like show public/fields/..

    Gson / json serialization of objects

    java - Save state of object in IntelliJ debug? - Stack Overflow - google/gson is the answer. User guide: gson/ at master · google/gson · GitHub

    Gson gson = new Gson();
    gson.toJson(1);            // ==> 1
    gson.toJson("abcd");       // ==> "abcd"
    gson.toJson(new Long(10)); // ==> 10
    int[] values = { 1 };
    gson.toJson(values);       // ==> [1]
    // Deserialization
    int one = gson.fromJson("1", int.class);
    Integer one = gson.fromJson("1", Integer.class);
    Long one = gson.fromJson("1", Long.class);
    Boolean false = gson.fromJson("false", Boolean.class);
    String str = gson.fromJson("\"abc\"", String.class);
    String[] anotherStr = gson.fromJson("[\"abc\"]", String[].class);

    Not drag-and-drop for more complex stuff though.

    Intellj Idea Exceptions Breakpoints

    You can create breakpoints at all exceptions of a certain type, even when they are caught. May lead to discovery that there are a lot of them in the code :)

    On this topic - “Run to cursor” is nice

    Day 625

    English / Interesting

    Tohu wa-bohu - Wikipedia “is a Biblical Hebrew phrase found in the Genesis creation narrative (Genesis 1:2) that describes the condition of the earth (eretz) immediately before the creation of light in Genesis 1:3.”

    Now let’s play with Jekyll and UTF-8.

    וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֙הוּ֙ וָבֹ֔הוּ וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְהֹ֑ום וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם‎

    — Genesis 1:2, Westminster Leningrad Codex Now the earth was formless and empty, darkness was over the surface of the deep, and the spirit of God was hovering over the waters.

    — Genesis 1:2, New International Version

    Better master file

    So, before we had this file:

    echo "Concatting all existing days"
    cd _posts
    echo \
    layout: page
    title: Master file
    permalink: /master/
    > ../
    cat * | grep -v "layout: post" | grep -v "categories: \[" | grep -v "title:  \"Day" | grep -v "date:   20" | grep -v "\-\-\-"  >> ../

    This didn’t really work well for various reasons, now I did this right:

    layout: default
    <div class="home">
      {%- if page.title -%}
        <h1 class="page-heading">{{ page.title }}</h1>
      {%- endif -%}
      {{ content }}
          <ul class="post-list">
          {% for post in site.posts %}
          <h1><a href="{{site.url}}{{site.baseurl}}{{ post.url }}">{{ post.title }}</a></h1>
            <p class="author">
              {% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
              <span class="post-meta">{{ | date: date_format }}</span>
            <div class="content">
              {{ post.content }}
          {% endfor %}

    Master file is at the same URI: Master file | Diensttagebuch

    Jekyll raw

    The nice tags for raw input, of course, work immediately, no spaces between (%raw%)And the start of the actual content(%endraw%).

    Day 624

    English / German dictionary :: Die Kacke ist am Dampfen :: German-English translation == shit hitting the fan

    Intellij idea running configurations

    One can export it to ~/.idea/runConifgurations/*.xml which can be edited with any editor or copied to another project folder.

    Intellij idea enable VCS integration

    Had this issue when creating a project in a folder that was not equal to the folder with the project files downloaded from git. It did not automatically recognize .git, but I could do it from the VCS menu, something like “choose VCS type”->git etc. Disappeared after I did it.

    From Error on openjdk11, cannot find javadoc · Issue #26 · chenjianjx/wsdl2html · GitHub: export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")

    readlink resolves symlinks. Alone it just gives you the file the symlink points to. readlink -f follows each and every symlink to the very end. On my box, the difference is:

    me:~/ $ readlink /usr/bin/javac     
    me:~/ $ readlink -f /usr/bin/javac  

    BUT! The actual JAVA_HOME thing should be solved as a setting in Intellij->Maven, as noted in Day 554 | Diensttagebuch.

    Day 623


    TODO Ankify: spelling of Colleague


    schnipsel | Übersetzung Englisch-Deutsch - scrap/shred/snipped (noun). Mentioned by Caro in context of Schnitzeljagd – Wikipedia that is an interesting thing by itself.

    git coloring

    git --color=never means that no color gets added by git, but any existing is preserved. Usually the program piping the output has to be told that colours are still needed despite the fact that it’s not outputting to a terminal.

    bash pretty CSV viewer

    Pretty CSV viewing on the Command Line - Stefaan Lippens inserts content here this is realy nice! In goes a CSV, out goes a pretty CSV. With all the tabs right etc. Piping output from daff diff to this works wonders.

    Added his function to .zshrc:

    function pretty_csv {
        column -t -s, -n "$@" | less -F -S -X -K

    Day 619

    vim antipatterns w vs e + vim movements

    I should use e much more than w, as that’s what I really usually need. And in general I should take the time to get to know better the tools I’m constantly using. I guess ‘right’ vim is something like ‘right’ typing.

    Also, never used them like this, but c of course takes all movements, so changing next two lines or changing from cursor to beginning of the line also works.

    Jira collapsible / spoiler block + code syntax highlighting

    This 1 is how you do collapsible spoilers in Jira:

    {code:bash|title=Header for code|collapse=true}
    echo this is some code

    Shows also how to define which syntax highlighting to use.

    kitty paste to terminal and copy url hints

    Added this to config: map kitty_mod+p>c kitten hints --type path --program @ - copies hinted URL to clipboard.

    Default map kitty_mod+p>f kitten hints --type path --program - - pastes the hint to the current terminal window.

    This gets rid of so much copypasting oh my God.

    Libreoffice calc freeze rows and columns

    The setting for freezing headers and stuff so that they remain visible wherever you scroll is in View -> Freeze cells

    bash sort by multiple columns

    sort -k 13 -k 15 -k 7 -t ";" -d filename - here the multiple -ks are the different sorting keys. -t is separator, and -d is dictionary order. Interestingly, it automatically sorts by everything else too after the column you give it - if you want it to look only at that one column, you do -k 2,2 2

    Day 618

    Random / Interesting

    vim regex separator

    I have been using \s as “word separator”, this is wrong. \s in vim is just a whitespace character - so tabs, spaces etc. For what I usually want, \A is any non-alphabetic-character. (\a being an alphabetic one).

    vim regex inverse match capturing group + ‘very magic’ mode

    /\vcat (dog)@!
    /cat \(dog\)\@!

    First one is very magic, second is the same without it. @! is a negative match to the preceding capturing group (could have been (\1) too).

    \v activates “very magic” mode where everything except letters and underscore has special meaning. This is actually going to be very handy. 1

    I’ve actually been using regexes quite a lot lately, have no idea how I lived without them when parsing very big log and text files.

    vim paste last searched regex

    :s/<Ctrl-R>/ inserts the last searched for regex between the slashes. This is wonderful and no more copypasting stuff! 1

    Intellij idea checkstyle tests

    In settings, you can configure checkstyle to run everywhere [not] including tests. If you don’t include tests, you won’t get to ‘run checkstyle on the current file’.

    i3 vertical tabbed windows

    If I have windows that are tabs stacked vertically to make it not-a-tab-anymore I just have to move it one level above or below tabs. If it’s stack 3/3, amking it 4/3 would make it the bottom part of a split whose top part is vertical tabs.

    zsh evil registers

    Intellij idea read-only decompiled class sources

    .. predictably, “Download sources” makes them downloaded, readable and debuggable.

    Also nice is the “Alternative source available for” - todo understand how exactly do poms, sources, etc etc etc. play with all this. I assume if maven module wants X, and X can be found in maven and in the list of dependencies in Intellij, I get this choice?

    Day 617

    zsh prompt changes

    To continue the idea to make it easier to record my steps, did some changes to the clean oh-my-zsh theme. For this, I made a copy of the theme file /home/%username%/.oh-my-zsh/themes/clean2.zsh-theme, and using zsh: 13 Prompt Expansion added the following:

    • history event number at the end of the prompt, after the time (RPROMPT='%*/%!')
    • Added the last N elements in the path while leaving tilde contraction. (PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%5c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ', the number 5 represents the number of directories to show.)

    Now the prompt looks like this:

    %username%:~/o/dtb/assets/pics/ (master✗) $                                                             16:14:10/10548

    timewarrior :quarter

    Timewarrior has many interesting hints, I always missed something with now and previous month - of course :quarter exists.

    Day 616

    Disabling wifi to use ethernet

    This should have been done long ago but discovered this now. If I have both a wiki and ethernet and want to stop connecting to the wifi, disconnecting from the endpoint is much less reliable than disabling wifi alltogether.

    fc and history

    fc also accepts the history number of the command to edit and run. So fc 1238, for example.

    Ideavim map for <Esc>

    Quite often, especially in the commit window, I want to use Ideavim’s normal/command mode, but <Esc> gets intercepted by Idea and closes the commit window. My old mapping works though:

    imap jj <Esc>

    in .ideavimrc.


    zsh share registers with OS when copypasting

    Now I can yank stuff from the zsh command line and paste them in other applications etc.

    Day 613

    Finally fixed the date / time / tztime saga

    Looked into the TZ environment variable, it’s the overwritten “Berlin” one. I forgot I had this beauty in .zshrc: export TZ="/usr/share/zoneinfo/Europe/Berlin"

    Probably a relict of an old hacky way to set time when I couldn’t do it properly.

    Interestingly, even i3status listened to it (how? why? At which point does it access zsh environment variables? Are environment variables zsh-specific and accessible to things started by/within zsh? How does this work? TODO). And interestingly, restarting zsh didn’t get date to output the right date, even with the right timezone set, I had to close and reopen the terminal.

    Removed that line, restarted i3, now all times are set right and I can remove timezone info from my timestamps.

    Vim insert time and date - updated mappings

    imap <leader>d <esc>:put =strftime('%c')<cr>kJA
    imap <leader>t <esc>:put =strftime('%H:%M:%S')<cr>kJA

    They look like this:

    Fr 04 Sep 2020 09:54:59 CEST

    Qutebrowser / vim copypaste

    If I’m copypasting something from vim with yW it copies the space after the last word. If I then paste it into the search of qutebrowser it won’t find anything if the string in the page doesn’t have a space after it.

    git diff CSVs at field level

    git diff --color-words="[^[:space:],]+" 1

    daff tool for diff-ing CSVs

    Daff is a “library for comparing tables, producing a summary of differences”. GitHub - paulfitz/daff: align and compare tables

    It actually does a really nice visualization with colours, like that script I wrote a long time ago. Leaves field numbers too. In general it’s awesome.

    More options available with the full form: daff diff --id field --padding sparse file1 file2 Has a lot of output formats!

    Even ordered/unordered works, if you don’t set the wrong id column.

    Vim folds empty line

    To make the markers marking folds easier to edit, one can select an empty line at the end of zf, they will end up on a line by themselves, and you can happily paste stuff inside the fold.

    Day 612

    New shiny zsh alias

    ff is now find | grep

    i3 run and show windows

    # bindsym $ms+d exec --no-startup-id i3-dmenu-desktop
    bindsym $ms+d exec rofi -show run
    # select windown
    bindsym $ms+g exec rofi -show window

    in i3/config. Rofi is nice and I forgot about it. Added a list of windows on $ms+g so that it’s similar to my qutebrowser keybinding.

    Dependencies scopes in Intellij Idea

    The default, “Compile”, is the “strongest”. Module dependencies - Help | IntelliJ IDEA contains a really nice table summarizing compile/test/runtime/provided.

    Running a single test in maven

    mvn -Dtest=UsersServiceImplTest test for all tests in that class, but you can also do wildcards and single test (yourclass#yourtest test) 1

    Intellij idea module dependencies order

    Order is important and whichever is the first will be used.

    You can change the order in the GUI, but you can move them one step above and you can’t move multiple dependencies at the same time. Of course if you add a new one it goes to the veeeery end.

    You can edit the configuration manually, inside the project it’s the .iml file that can be edited via whatever.

    Get column in bash with cut

    This is a thing that keeps coming up, TODO anki

    awk - bash: shortest way to get n-th column of output - Stack Overflow

    cut -f2 accesses the second field. -d is for delimiters, if not equal to tab. seems to be an OK service for sharing stuff, S. used it for wedding pictures and A. used it for uploading an .iso, both worked well.

    Day 611

    Libreoffice Calc opening files with default import settings


    Day 610

    x-www-browser and qutebrowser

    If qutebrowser is not running and I click a link, another instance will be started, and it looks like this: myusername+ 19648 10.8 2.7 6125248 896828 ? Sl 12:10 10:07 /usr/bin/python3 /usr/bin/x-www-browser https://the-link-i-click.ed; I can’t find it easily as the process doesn’t contain the string qutebrowser.


    Day 609


    • nachschlagen - look sth. up, retaliation, consult something quickly. TODO anki
    • massig - bulky, massive, huge. (“Massiges Gehalt”)

    Day 608

    Random / interesting / ideas

    Emoji Simulator! 😘 -> generally, emojis are a nice way to convey information, instead of colour. Not nice but at least novel and ineresting. It would be nice to work them into some project or visualization. Мамо чому я не фронтендщик.

    Day 606

    Git revert vs reset last N commits

    Resetting, Checking Out & Reverting | Atlassian Git Tutorial is a nice guide about ways to undo some of the commits. Reset is a harder way to undo stuff that sometimes leaves no traces, Revert is a way to create a commit that undoes the last N commits, so history is preserved and that’s good.


    Day 604

    VPN DNS issues

    Seemed to have a conflict w/ IPv6 VPN vs the IPv4 one, first had priority. Then I had an issue where the VPN IP was the same as the IP of my router. Fixed by moving router IP. Learned a lot about how DNS works.


    Day 589

    git diff with full context

    How to get git diff with full context? - Stack Overflow - git diff -U1000000 - or wc -l in place of the number - any number of line larger than the file works.


    Day 586

    Jupyter Notebook vim mode

    When operating on cells, not text (= not insert mode), the usual j/k commands select cells when shift is used (J/K). This is neat. I should read the documentation.


    Day 585

    Jaro-winkler similarity for empty strings (#nlp)

    Jaro-Winkler handling empty strings · Issue #28 · tdebatty/java-string-similarity - TL;DR officially ‘undefined’, what has to be returned in implementations depends on why you need it. These are nice edge cases I have to learn to watch for.


    Day 584

    Git diff

    Is much more flexible than expected. git diff --unified=0 doesn’t show the context lines, only the changed ones; in general the documentation is worth reading, could be a good tool to add to my belt for various one-off tasks.