Entries Tagged as ''

Setting up castor as handler for gemini URLs on a Gnome desktop

Gemini capsule paragliderSo, you’ve heard of that slick new gemini:// internet protocol and you managed to install or build (see below) the castor browser to use it. It works great, but now you would like to be able to click on a link in your http(s) browser to gemini and have it open castor for you. Here is how to do this on a Gnome desktop.

Step 1 – create a launcher for castor, by adding the following configuration into the file  „~/.local/share/applications/castor.desktop“:

[Desktop Entry]
Version=1.0
Type=Application
Name=Castor
Comment=Gemini Browser
TryExec=castor
Exec=castor %u
Icon=/[path to castor repository]/data/org.typed-hole.castor.svg
MimeType=x-scheme-handler/gemini

Step 2 – register the gemini protocol to open with castor, by issuing this command:

xdg-mime default castor.desktop x-scheme-handler/gemini

[Read more →]

Which UNIX tool to use for text processing?

A short decision flow chart to pick the optimal text processing tool on a UNIX-like system (dowload it as plaintext):

                                   .--------.
                                   | I want |
                                   | to ... |
                                   '--------'
                                        |
                                        v
                                  .-----------.
                            yes  / ... search  \  no
                          .-----(  in freeform  )-----------------.
                          |      \    text.    /                  |
                          v       '-----------'                   v
                   ____________                           .---------------.
                   \           \                    yes  /    ... work     \  no
                    ) use grep  )                 .-----(  with structured  )--------.
                   /___________/                  |      \      text.      /         |
                          |                       v       '---------------'          v
                          v                 ___________                       .-------------.
                     .--------.             \          \            replace  /   ... work    \  delete
               yes  /   It's   \  no         ) use awk  )             .-----(  with freeform  )-----.
            .------(  a simple  )-------.   /__________/              |      \     text.     /      |
            |       \ pattern. /        |                             |       '-------------'       |
            v        '--------'         v                             v           extract           v
.-----------------------.  .-------------------------.  .--------------------------. | .-------------------------.
| grep 'simple pattern' |  |  egrep 'regex pattern'  |  | sed 's/search/replace/g' | | | sed '/search pattern/d' |
'-----------------------'  |            or           |  '--------------------------' v '-------------------------'
                           | grep -E 'regex pattern' |           .---------------------------------------.
                           '-------------------------'           | sed 's/^.*\(search pattern\).*$/\1/g' |
                                                                 |                  or                   |
                                                                 |       grep -Po 'search pattern'       |
                                                                 '---------------------------------------'

[Read more →]