Posts

    Day 750

    English / Slack

    Unfurl | Definition of Unfurl by Merriam-Webster - “expand, extend, fan (out), flare (out), open, outspread, outstretch, spread (out), stretch (out), unfold”

    Fastmail calendar

    Things I love so far:

    • Can move/change single recurring events without issues, asks whether to do it for one or all of them only when I use the “Edit” button! Things I miss:
    • Ability to “copy” an event in another calendar. Though I consider the need to do this an antipattern, and maybe I’ll find a workflow where I don’t need to do this often.

    German / Deutsch

    das Teufelszeug - appalling/hellish/infernal stuff (heard at work)


    Day 749

    .vimrc conversion saga

    In Day732, I changed my ./vimrc to utf8 from latin-1, to be able to use the “” symbol to mark trailing spaces.

    Well, it broke the vim macros for the link wiki (from Day 450) :( I had the latin version of the .vimrc backed up, falling back to it for now.

    I need to think of a way to save these macros better, because even copypasting them to this dtb didn’t work and I had to do text encoding magic. I think this is exactly the time one should use a proper scripting language like Python, and write another small qutebrowser script that changes the contents of the filled textarea.

    link links to pages, post_url links directly to posts inside _posts.

    Link to pages:

    
    {% link _collection/document-name.md %}
    {{ site.baseurl }}{% link _collection/document-name.md %}
    {{ site.baseurl }}{% link _posts/2019-03-06-post-title.md %}
    {{ site.baseurl }}{% link services/index.html %}
    {{ site.baseurl }}{% link /assets/documents/pal-codes.pdf %}
    
    

    Links to posts:

    
    {% post_url 2019-03-06-post-title.md %}
    {{ site.baseurl }}{% post_url 2019-03-06-post-title.md %}
    {{ site.baseurl }}{% post_url /folder/2019-03-06-post-title.md %}
    
    

    Copied directly from this excellent page, I never found this explained in such a readable way: How to create internal links in Jekyll | Web Island Blog

    TODO Jekyll / dtb / meta

    Write a small script that allows me to easily link to days just by their day number.

    Jekyll changed post permalinks

    Before URI contained the date and was hard to link to. Now I changed this in _config.yml:

    permalink: :title:output_ext
    

    Links are now like this: https://www.pchr8.net/d/dtb/day749.html

    Python representing infinity

    float('inf') works for floats, but there’s no way to do it with ints. math.inf is also a float. 1

    vim interrupt operation via <Ctrl-C>

    Made a typo, vim attempted to indent 20k lines (and started counting “xx lines to indent…”, intuitively pressed <Ctrl-C>, it successfully interrupted the operation!

    https://scrolller.com/


    Day 748

    matplotlib reverse colormaps

    Every colomap has a reversed version named *_r (such as gray_r)! 1

    Papers - NLP - Chargrid

    [1809.08799] Chargrid: Towards Understanding 2D Documents


    Day 747

    Fastmail shortcuts

    Keyboard shortcuts | Fastmail

    Qutebrowser passthrough

    Simplified bindings for passthrogh, added last line to ~/.config/qutebrowser/config.py

    config.unbind('<Shift-Escape>', mode='passthrough')
    config.bind('<Ctrl-Shift-+>', 'leave-mode', mode='passthrough')
    config.bind('<Shift-I>', 'enter-mode passthrough')
    

    Would allow me to use websites’ own shortcuts more often.


    Day 745

    Day 744

    python serialization using dill

    dill is like pickle, but serializes more stuff!

    python pycharm unittest

    Yet another way one can get the “no tests to run” error - if a test is not called test_..., it won’t be ran.


    Day 742

    i3 sticky window / pin window

    It’s easy to do a sticky window in i3!

    Added to ~/.config/i3/config:

    # Sticky window
    bindsym $ms+p sticky toggle
    

    Seaborn catplot titles (plotting, pandas, visualization)

    Seaborn anonying facet title · Douglas C. Wu:

    sns.catplot(x="target",y="score",hue='score-type',data=d,kind='bar',col='bundle',col_wrap=2,sharex=False,sharey=False).set_titles(col_template='{col_name}')
    

    The set_titles(col_template='{col_name}') removes the usual “x=y” title in each of the sub-plots!


    Day 741

    qutebrowser crashing

    Yet another time qtbrowser started crashing, yet another time fixed it by removing state and sessions from ~/.local/share/qutebrowser/. I blame me messing with qt versions last week.

    ag

    Somehow magically I don’t have to escape anything in the regexes when using it!

    ag "(VISION_|short)" *

    passing empty parameters to python argparse / cli?

    python - Passing empty string to argparse - Stack Overflow:

    python test.py --mode=
    

    I’ve been using args a la -w is, but -w=is also works, and therefore python3 myprogram.py -w -another=opt is perfectly valid! Python parses it as empty string (that casts to False).

    fc linux meaning

    TIL fc stands for “fix command”!

    vim s/ replacing stuff

    Discovered that if you just want to remove something, %s/from works (without the second // part at all)


    Day 738

    pycharm optimize imports

    Auto import—PyCharm

    python argparse

    Seems the best current default way to do cli options! Docs tutorial is as accessible as usual: Argparse Tutorial — Python 3.9.1 documentation

    parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) # show default args in help
    parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) # allow newlines in help text
    parser.add_argument("-lp", "--localpath", help="Local path. \n %(default)s", default=local_path) # add default text in help text manually
    

    Python shadowing modules

    When creating argparse.py, don’t be surprised if you can’t use argparse from import argparse. 1

    Python to read, TODO

    Nice article: PyFormat: Using % and .format() for great good!

    ag as grep alternative for code

    I should make an effort to learn it and use it. ag -G "component.*yaml" regex - searches for regex inside all files whose path matches the regex after -G

    ag --python "myregex" automatically looks for it in all python files, and really nicely outputs matches!

    vim delete lines not containing a pattern

    g!/pattern/d, as opposed to the usual g without exclamation mark.

    Using less to copy cli stuff with weird linebreaks

    If command returns output with newline breaks that are ignored when copypasting directly, using command | less seems to make it work - I can copypaste from there without problems.


    Day 737

    Change volume of bluetooth headphones via cli / pactl

    I wasn’t able to do it the usual amixer way, because:

    You are running Pulseaudio, which uses ALSA to drive soundcards, but which connects to Bluetooth speakers without involving ALSA. When you set ALSA volumes with amixer, Pulseaudio notices and corrects the source/sink volumes[…] 1

    Command to do it directly through pulseaudio is: pactl set-sink-volume name_of_bluetooth_speaker +3%

    Added this to ~/.config/i3/config:

    bindsym Mod1+r exec  pactl set-sink-volume bluez_sink.60_AB_D2_43_E9_C5.a2dp_sink +5%
    bindsym Mod1+c exec  pactl set-sink-volume bluez_sink.60_AB_D2_43_E9_C5.a2dp_sink -5%
    

    Nomacs picture viewer remove animations + frameless

    • Changed transition time to 0 in Settings -> Display -> Slideshow
    • <F10> leaves only the current picture (‘frameless’), a la scrot; Though in this mode drag-n-drop doesn’t work!

    zsh text colors list

    Found this when autocompleting something else:

    (12:36:26/10136)~/ $ which spectrum_ls
    spectrum_ls () {
    	for code in {000..255}
    	do
    		print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"
    	done
    }
    

    Returns 255 lines with 255 colors, they look neat:

    Colors

    To read - matplotlib

    TODO: The Many Ways To Call Axes In Matplotlib | by Jun | Towards Data Science And in general


    Day 736

    Deutsch

    das wasserzeichen - Watermark! (Heard at work) die dringlichkeit - urgency. “Besondere Dringlichkeit”. Verschiedene Dringlichkeiten. (heard at work)

    Read more...

    Day 735

    matplotlib pyplot make certain color transparent

    For this, a subset has to become bad values, and a cmap has to set what to do with them.

    Read more...

    Day 734

    Updated i3 config for toggling between modes

    Made everything simpler, based on what I usually really need:

    bindsym $ms+s layout toggle tabbed stacking
    bindsym $ms+Shift+s layout toggle split
    
    Read more...

    Day 733

    record terminal on linux with script

    The script utility exists, and is installed by default on at least two systems I have access to. Works really well for interactive sessions!

    Read more...

    Day 732

    Markdown newline inside quote

    Couldn’t understand why there are newlinen in my yearly review blog post from last year. So - in markdown, two spaces and then a line break create a line break.

    Read more...

    Day 730

    Day 728

    Taskwarrior / zsh

    Updated zsh alias to include non-work tasks tagged +A or +O from current sprint:

    s () {task s \(project:w or \(sprint:$(date +%-V) \(+A or +O\)\) \) "$*"}
    
    Read more...

    Day 723


    Day 722

    Taskwarrior

    Changed colour of +F tasks to a better shade of gray in .taskrc

    # color.tag.F=color239
    color.tag.F=color244
    
    Read more...

    Day 721

    Deutsch

    • vorkauen -> pre-chew (or “explain with crayons” metaphorically)
    • die Achillesferse - Achilles’ heel



Subscribe