Posts

    Day 840

    Patterns / phrases / Random

    • “It’s not a solution, but it’s an approach” - heard at work, VF

    Day 839

    vim delete all lines not matching pattern

    I’ll memorize the g/... syntax someday.

    :g!/pattern/d
    

    I can just look for the pattern as usual with /pattern and tweak it live, then do

    :g!//d
    

    and it will atke the last used pattern.


    Day 836

    Deutsch

    die Kaffeesatzleserei - reading in coffee beans (heard at work)

    screen attaching screens without full name

    I shouldn’t forget that screen -R screenname can be replaced by screen -R s if it’s the only screen with such a name. Not sure if better or worse than tab completion, likely worse because it’s surprising, but quite nice to use.


    Day 835

    Data Scientist roadmap/curriculum

    Article with a very interesting graph: Becoming a Data Scientist - Curriculum via Metromap – Pragmatic Perspectives

    Road to data science

    German / Deutsch

    • “Die Prioritäten sind ein bißchen volatil geworden”
    • “Sammle von XY Team ein bißchen Stimmung”

    Day 832

    German

    der Tonus - heard at work in context of

    JQ producing nice comma-separated json

    Option to return objects as a list of objects (separated by a comma) · Issue #124 · stedolan/jq: TL;DR use jq "[foo]" instead of jq "foo".


    Day 831

    Yunohost full app information / data / install paths

    yunohost app info -f appname returns the A LOT of info about the appname, including installation paths.

    Qutebrowser userscripts folder location / Writing informative error messages

    … can be located in ~/.config/qutebrowser/userscripts, not just in ~/.local ..! When tried to run one it didn’t find it helpfully outputted all the paths it looks for them - which is great and I’ll steal this. If a file is not found you know the person will probably need this, especially if they are many.

    GNU Stow for dotfiles management

    One of the cooler solutions I’ve seen: Managing dotfiles with GNU stow - Alex Pearce (There seems to be a canonical page1 I found first, but I like the other one more)

    TL;DR create a directory for the dotfiles, with each folder containing dotfiles mirroring the usual dotfiles’ locations in the system; Then from inside the main dotfiles directory do stow vim bash whatever and it’ll magically put it in the right place in the home directory.

    This works because

    Stow assumes that the contents of the

    you specify should live one directory above where the stow command is run, so having our .dotfiles directory at ~/.dotfiles means using stow to manage our dotfiles just works. [^stowbett]

    This is awesome because:

    • No manual symlinking
    • Dotfiles directory can be easily backed up with git or whatever

    The same article2’s sample github repo: dotfiles/neovim at master · alexpearce/dotfiles

    Cool dotfile ideas

    The stow linked github repo’s dotfiles are actually fascinating: alexpearce/dotfiles: My dotfiles.

    dotfiles/.gitconfig at master · alexpearce/dotfiles:

    # Clone git repos with URLs like "gh:alexpearce/dotfiles"
    [url "https://github.com/"]
      insteadOf = "gh:"
    [url "git@github.com:"]
      pushInsteadOf = "gh:"
    # Clone CERN GitLab repos with URLs like "gl:lhcb/Hlt"
    [url "ssh://git@gitlab.cern.ch:7999/"]
      insteadOf = "gl:"
    

    Git config aliases

    Applying the above to my own configs in ~/.gitconfig.

    Assuming the ssh port is 1234 ~/.gitconfig is like

    [url "ssh://git@myserver:1234/"]
      insteadOf = "gh:"
    

    and then in the per-repo settings something similar to

    [remote "bitbucket"]
    	url = gh:myusername/myproject.git
    

    Cloning it is now easy:

    git clone gh:myusername/myproject
    

    Neat!

    Jekyll syntax highlighting supported languages

    List of supported languages and lexers · rouge-ruby/rouge Wiki Quite a lot! Will try the generic conf for the .gitconfig above.


    Day 830

    Yunohost

    I’m very impressed by it! Makes everything really easy, I remember the last time I had to install stuff manually. After 48h 9/10, some things surprised me (removing root ssh access…) but they were always mentioned in the relevant docu I hadn’t read.

    Official docu is quite okay, but rarely appeared when I was googling my problems. My instinct is to Google the problem instantly - sometimes they should actually be to find and check any existing official documentation/README first, then google. (An even better instinct would be to skim any official documentation before starting, as religiously as I do it for unknown real-life 3D things.)

    Adding subdomains for Yunohost

    This took me too long to find, has info about correct DNS records: DNS and subdomains for the applications | Yunohost Documentation

    By trial and error the complete process is:

    1. Add DNS record for subdomain like last examples here: ``` @ A XYZ.XYZ.XYZ.XYZ @ AAAA 1234:1234:1234:FFAA:FFAA:FFAA:FFAA:AAFF
      • CNAME mydomain.com. agenda CNAME mydomain.com. blog CNAME mydomain.com. rss CNAME mydomain.com. ```
    2. Add new domain to yunohost, input the domain with subdomain (subdomain.my.domain) as it if were new
    3. Do a diagnostic, which does DNS checks too, which are needed for Letsencrypt
    4. Install letsencrypt certificate from the usual Yunohost panel

    I kept messing up NAME and DATA of the CNAME records because I was following more the other ones Yunohost created, a row of

    Name: xmpp-upload.my.domain
    Data: @
    

    For subdomainname.my.domain I needed this (kinda-sorta-reversed from the above; as usual, dots are significant):

    Name: my.domain.
    Data: subdomainname
    

    Random / colored fonts generator / CLI

    cfonts is like figlet, but with many more settings (colors and alignment blew my mind!)! Link has a lot of colorful examples. I might get a nice colorful motd and/or banner soon. :)

    Setting a new hostname linux

    There’s a command for that: hostnamectl set-hostname new-hostname

    I like the idea of having ~/.local/bin in my $PATH, and putting there symbolic links (ln -s TARGET LINK) to my usual folder where I have programs/executables. I’d even have a separate thing in $PATH for shell scripts and binaries, which will get rid of so many stupid CLI aliases I have whose function is to point to a single executable with a long path. TODO - look at my aliases and commands I run often and see how many of them can I symlink


    Day 829

    VPS plans

    • Taskwarrior sync
    • git for ~/.timewarrior/ and similar folders
    • git for dotfiles
    • Some basic automated backups of small important things
    • Possibly some Telegram bots will live there
    • CalDAV & Contacts sync - both for sync and for backups
    • Possibly self-hosted password management?

    Timewarrior on-modify hook for taskwarrior

    Had always problems with umlauts etc, looked at the source, changed #!/usr/bin/env python to #!/usr/bin/env python3 - now it works! Wanted to do a pull request, but it’s fixed on github master1, the apt repo has an older version as it often does.

    git clone to different directory

    .. As expected. git clone git@what:ever outputdirectory. git clone git@what:ever . works.

    Setting up serhii.net

    New domain, yay! I’ll slowly move stuff there, starting with this diensttagebuch.

    Setting up multiple remotes in github + .git/config

    I wanted to set up two remotes, so that the dtb deploy.sh script after building the html & rsync-ing would push it to both the github dtb repo and my own. Followed this basically (except that I had deleted origin by error in the process, so recreated it back again and added both remotes to it so I’ll still be able to do git push origin master): How to push to multiple git remotes at once. Useful if you keep mirrors of your repo..

    Mostly copying from there, changing/sanitizing some of my configs:

    # Assume the git repost are set up like this
    git remote add github git@github.com:muccg/my-project.git #this is the one "origin" pointed to to
    git remote add bb git@bitbucket.org:ccgmurdoch/my-project.git
    
    # Add to origin two remote urls for push
    git remote set-url --add --push origin git@github.com:muccg/my-project.git
    git remote set-url --add --push origin git@bitbucket.org:ccgmurdoch/my-project.git
    
    # Look at the result
    git remote show origin
    

    which outputs this:

    > git remote show origin
    * remote origin
      Fetch URL: git@github.com:pchr8/my-project.git
      Push  URL: git@bitbucket.org:pchr8/my-project.git
      Push  URL: git@github.com:pchr8/my-project.git
      HEAD branch: master
    

    Mentioned in the comments, it works, but has to be done twice of as it seems to rewrite the original remote: git remote set-url --add --push origin <...>

    But maybe the most interesting thing there is .git/config! I didn’t know it existed, it shows most of the same things but much easier to read/edit! It currently shows something like this:

    > cat  .git/config
    [core]
    	repositoryformatversion = 0
    	filemode = true
    	bare = false
    	logallrefupdates = true
    [branch "master"]
    [user]
    	email = me@me.me
    	name = SH
    [remote "bb"]
    	url = git@bitbucket.org:pchr8/my-project.git
    	fetch = +refs/heads/*:refs/remotes/bb/*
    	pushurl = git@bitbucket.org:pchr8/my-project.git
    [remote "github"]
    	url = git@github.com:pchr8/my-project.git
    	fetch = +refs/heads/*:refs/remotes/github/*
    	pushurl = git@github.com:pchr8/my-project.git
    [remote "origin"]
    	url = git@github.com:pchr8/my-project.git
    	fetch = +refs/heads/*:refs/remotes/origin/*
    	pushurl = git@bitbucket.org:pchr8/my-project.git
    	pushurl = git@github.com:pchr8/my-project.git
    

    Creating redirects to new website

    Adding the RedirectPermanent lines to .htaccess in the root of pchr8.net, that now contains the following:

    ErrorDocument 404 /404.html
    ErrorDocument 403 /404.html
    ErrorDocument 500 /500.html
    
    RewriteRule ^wiki/(.*)$ /f/$1 [R=301,NC,L]
    RewriteRule ^fiamma/(.*)$ /f/$1 [R=301,NC,L]
    
    RedirectPermanent /d/dtb https://serhii.net/dtb
    RedirectPermanent /blog https://serhii.net/blog
    

    Experimenting with rewriting everything except /f/, seems to work except for the main page https://www.pchr8.net/f/index.php/Pchr8.net_wiki_thing

    RewriteEngine on
    
    #RewriteRule (f) - [L]
    RewriteCond %{REQUEST_URI} !^/f
    RewriteRule (.*) https://serhii.net/$1 [R=301,L]
    

    It gets redirected to serhii.net - maybe it chokes on the many weird characters or the repeat of pchr8.net?..

    Setting up HTTPS/TLS for serhii.net

    As per nfs docs 2, it’s very easily done just by running YourPrompt> tls-setup.sh, and nfs takes care of all autorenewals, automatically sets up redirects etc. Awesome!

    utimer

    utimer can do a countdown, count-..up?, and can work as a stopwatch. It outputs time remaining too.

    English

    A pizza dough recipe3 reminded me that

    DTB/markdown/footnotes/macro improvement idea

    I have my vim macro for footnotes where it creates the [^..] things and then I paste the URI manually, but what I’d actually like is something that automatically creates a footnote at current cursor position, and as content uses the URI currently in the clipboard register! TODO (And also try to make it readable/interpretable this time)

    Yunohost

    To create a subdomain, you have to add it as “new” new domain and it takes care of everything, no magic with DNS records needed


    Day 825

    taskwarrior non-work user account

    Changed the zsh alias for it:

    s () {task s project.not:w sprint.not:s "$*"}
    

    Now on my non-work account, it shows non-work tasks from any sprint except “s” (which is a proxy of due:someday).

    German foreign words

    Foreign Words (Fremdwörter) - really nice! Has specific suffixes and what genders they create in German. In general - I remember that excellent website.

    Also: “das Thema, die Themen”) - which plural rule is that? TODO

    DTB - TODO

    Given that I need to push/pull it a lot now, I should exclude the generated .html files in .gitignore

    qutebrowser

    W opens the last closed window! … on the topic of ‘learn well the tools you use daily’

    ding

    Installed ding! Still remains the best dictionary program ever. ding buch works!

    TODO - add keybinding to search for currently selected word. Or a basic prompt to quickly look for words, a la dtb - and that ideally adds the needed words to a list, and maybe even generates anki flashcards from them!

    ding -m to start it minimally, likely make it floating for i3 by class, is a really nice start. Added this to config:

    ## Ding float
    bindsym $ms+Shift+d exec ding -m
    for_window [class="Ding"] floating enable
    

    (got class from xprop)

    Redshift settings for late-night work

    If default automatic settings are too strong, these work well: redshift -xO 2500 -b 0.7


    Day 823

    Noisetorch / polkit / policykit / pkexec saga

    Couldn’t load noisetorch, error 127 when attempting to get the needed privileges. The help of Noisetorch said this means pksudo doesn’t work, and to fix this. After some googling, found a solution:

    apt install policykit-1-gnome

    Then add /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 & to your autostart configuration. 1


    Day 821

    Interactive mode matplotlib

    According to the docu it should be this, not working for me:

    plt.ion()
    
    Read more...

    Day 818

    i3 startup - final

    Read more...

    Day 817

    loginctl as a way to manage sessions of logged in users

    Instead of killing all processes belonging to someone, loginctl will return all sessions, and loginctl kill-session $number will log the user off!

    Read more...

    Day 813

    Pycharm / matplotlib / pyplot debugging

    Read more...

    Day 812

    sshfs / ‘Transport endpoint not connected’

    In line with Day 784 about unmounting broken endpoints, yesterday I got a lot of errors (thunar didn’t start, I blamed memory, but df -h also didn’t start…), at the end the issue was with a sshfs directory:

    Read more...

    Day 811

    OpenCV documentation

    I like giving code examples in C++, Java and Python for the same help topic! OpenCV: Creating Bounding boxes and circles for contours

    Read more...

    Day 807

    Google Hangouts highlighting people

    If there are too many people with video on, Google Hangouts moves the ones who talk closer to the beginning, making them visible?

    Read more...

    Day 805

    pycharm/intellij running config environment variables spaces

    Got bitten yet again when copypasting them - the name of one of them had four leading tabs. THAT DIDN”T GET SHOWN UNTIL I TRIED TO EDIT THE ENVIRONMENT VARIABLE IN THE PYCHARM WINDOW - it removes them when visualizing. Why? (The parameter of the last one had a trailing space too)

    Read more...

    Day 803

    Day 801



Subscribe