koldfront

RSS feeds for YouTube channels #youtube #rss #feedbase

🕒︎ - 2021-02-21

As far as I know the RSS feeds for YouTube channels aren't featured prominently anywhere on the website, but if you find the channel identifier (usually starts with "UC"), you can get an RSS feed for the channel on https://www.youtube.com/feeds/videos.xml?channel_id=UC...

That makes for a nice way to keep up with interesting YouTube channels without having to go to the website all the time; I use Feedbase to read the RSS feeds, of course.

Some channels I find interesting or fun:

The Post Apocalyptic Inventor fb is a german who makes videos about restoring finds in scrap yards, saving things that have been discarded, which can - more or less easily - be brought back to life. Quite inspiring!

Adam Savage, known from the Mythbusters tv show, has a channel, Tested fb, where he mostly putters around the work shop and creates new shelving or storage for tools. Savage also makes shorter videos about favorite tools, answer questions, and sometimes he builds a replica of something from a film. It is very endearing how he wants to embrace mistakes and errors, but finds it very hard to do.

Simone Giertz fb is also a "maker" - started out making useless robots, and now keeps building things in the more quirky, arty genre. Some are fun, some are awful, almost always interesting.

Videos on mathematical subjects without going that much into depth can be found on Numberphile fb - the form is an interested interviewer talking to a mathematician explaining something or the other.

Numberphile has a companion channel called Computerphile fb, which is the same concept, surprise, only with computer-related topics. Sometimes the experts are oh so very wrong, but often it is interesting.

The Lock Picking Lawyer's channel fb is a lot of fun - very short videoes, showing a lock being picked or bypassed in one way or another. The videos really makes you want to have a go at it yourself.

On the more silly fun side, there is Bad Lip Reading fb which ranges from hilarious to mildly entertaining videos with the sound changed to what a bad lip reading might result in. The songs are the most fun, very high production value.

Retro Recipes fb is dedicated to old personal computers, the ZX Spectrum, Amstrad, Commodore-era mostly, and doing various things related to them. The videos often feature the host's partner and their dogs, and the host almost never fails to mention the minor roles in Star Wars he has played. It's a little much sometimes, but often fun as well; soldering irons are unholstered.

This last one I feel a little ambiguous about - Ratarossa fb is a british person who buys Ferraris and restores them on a shoestring budget at home. It is kind of fascinating, but the host has a way of presenting that is a little much at times.

The videos can be downloaded with youtube-dl which is also highly recommended, it even works for other video than YouTube (e.g. Danish National TV, Swedish ditto, etc. etc.)

That's all, remember to like, subscribe and comment ... hey, wait, you don't have to do all that stuff if you use the RSS feeds!

Børsen in fog

🕡︎ - 2021-02-19

Copenhagen Light Festival changes as the weather does - now in fog! The laser is less impressive, but the lights emanating from Børsen are more noticeable.

There are a lot of people out on the streets after dusk looking at the festival. After quite a while of feeling like the city was empty, it is a little... disconcerting.

C-x C-j C-y #emacs

🕡︎ - 2021-02-18

Tonight I was playing around with Flameshot instead of Gimp (which is overkill for the task) to make screenshots of part of the screen.

Flameshot works pretty well, and makes it easy to put the selected image into the clipboard.

Often I want to send the image with jabber.el. Previously I have implemented support for uploading an image, sending and displaying it, so from Gimp I would save the file in /tmp/ and then upload it in jabber.el. What if I could just paste the image directly from the clipboard into jabber.el? That would be nice.

So I set out trying to implement a function to extract an image from the clipboard and upload it. After ~½ an hour of tinkering, I arrived at this:

(defun jabber-http-selection-upload (jc to)
  "Share clipboard image with xmpp http upload extension XEP-0363."
  (interactive (list (or (and (memq jabber-buffer-connection
                                     jabber-connections)
                               jabber-buffer-connection)
                         (jabber-read-account))
                     (or jabber-chatting-with
                         (jabber-read-jid-completing "Share file with: "))))
  (let ((data-png (or (gui-get-selection 'PRIMARY 'image/png) (gui-get-selection 'CLIPBOARD 'image/png))))
    (if data-png
        (let ((temp-file-name (make-temp-file "jabber-paste" nil ".png"nil)))
          (with-temp-file temp-file-name
            (set-buffer-multibyte nil)
            (insert data-png))
          (message "%s (%d)" temp-file-name (length data-png))
          (jabber-http-file-upload jc to temp-file-name)) ; XXX doesn't work if I delete temp-file-name after this...
      (message "No PNG in clipboard"))))

(define-key jabber-global-keymap "\C-y" 'jabber-http-selection-upload)
(define-key-after (lookup-key global-map [menu-bar jabber-menu]) [jabber-menu-paste-image] '("Paste image..." . jabber-http-selection-upload) 'jabber-menu-roster)

And it works! \o/

Figuring out the (set-buffer-multibyte nil) had me stymied for the longest time.

So now I can put an image in my clipboard, go to jabber.el and simply go C-x C-j C-y, and the image is uploaded and sent - how nice is that?

Naïve quicksort speeds #haskell #python

🕢︎ - 2021-02-17

I was watching Graham Hutton's lectures on Haskell and he used the naïve straight-forward implmentation of quicksort as the first code example, working out what it does.

For fun, I wrote the same in Python, to compare elegance. Running the code for even small lists gave an exception about recursion depth. Fair enough, recursion is common in functional programming and less so in imperative languages like Python (the Haskell version doesn't throw such exceptions).

As it is the naïve version, I had to scramble the list to fix this, as running on the sorted list gives us the worst case (the pivot element is näively taken as the first in the list, so the algorithm splits the list in one element and the rest, oops). Here is the Python code:

from random import sample

def qsort(list):
    if list == []:
        return list
    else:
        x=list[0]
        xs=list[1:]
        return qsort([y for y in xs if y < x]) + [x] + qsort([z for z in xs if z >= x])

n=10000000
g=qsort(sample(range(1, n+1), n))
print(g[-1])

The code is short, but perhaps not what you would call elegant? The list comprehension part does look quite close to the Haskell version, but the pattern matching elegance is missing (although recent PEPs are going to add pattern matching to Python, I am not sure if it is going to look more elegant). Also, I skipped the conventional if __name__ == "__main__": boiler-plate, which would have made it look worse.

Running it on a list of the integers from 1 to 10 million (scrambled) and printing the last (to not make printing be the limiting factor) takes ~48 seconds on my laptop, and makes the fan spin up.

I was expecting the Haskell version to be more elegant to look at and run faster, as it is - after all - compiled. When I printed the entire list, it was very slow, so again I chose to just print the last entry of the result:

import System.Random
import System.Random.Shuffle

f [] = []
f (x:xs) = f ys ++ [x] ++ f zs
  where
    ys = [ y | y <- xs, y < x ]
    zs = [ z | z <- xs, z >= x ]

main = do
  gen <- getStdGen
  let g = f (shuffle' [1..10000000] 10000000 gen)
  putStrLn (show (last g))

Much to my surprise, running this takes ~55 seconds - around 14% slower than Python?! Usually people talk about Python being slow. I know this is the naïve(st) implementation, but so is the Python one I'm comparing with.

It would be interesting to know what part of the Haskell version the most time is spent in.

Whoa, just changing the last line from:

  putStrLn (show (last g))

to:

  putStrLn (show (head g))

changes the running time to ~39 seconds. I guess lists really are implemented very inefficiently. Or am I fooling myself with laziness?

This was with Python 3.9.1 and GHC 8.8.4 on an Intel i7-9750H equipped laptop running Debian unstable.

Transient mark mode #emacs #ui

🕡︎ - 2021-02-16

On Irreal, jcs discusses transient mark mode in Emacs and the controversy: "Transient Mark Mode".

The first thing I did when the default changed was to turn transient mark mode off, as quickly as I could.

I had no idea that pressing C-SPC twice would deactivate the display of the active region, and since I have a habit of setting mark quite often (to mark a region for copying but maybe later deciding not to, or to mark a place to return to), I had an almost laughably hysterical reaction to having a highlight that "chased" the cursor around the screen.

It was an almost visceral reaction of disgust: "NO, I didn't tell you to DO THAT, make it STOP".

jcs writes, about turning transient mark mode off:

That strikes me like living without air conditioning. Sure, you can do it but why?

I have never lived with air conditioning and I likely never will. In my part of the world it would be a huge waste of energy for very little gain. I'm sure it is different in different climates.

Anyway, bad analogies aside, as for transient mark mode, I guess it is habit I have developed from using Emacs for many years - I have no problem keeping track of where the region is without having it highlighted, and I enjoy not having to do anything to deactivate the region if I don't need it after all.

The only place it annoys me is in Magit, if I want to add a specific subset of a chunk of a diff, I have to make an active region. It took me quite a while to find out that to do that, I just have to press C-SPC twice, which is okay, as I use the Magit functionality way less often than I do everything else with regions and marks.

I 🖤 Free Software #free software #ilovefs

🕛︎ - 2021-02-14

GNU Emacs, Debian GNU/Linux, Linux, Gnus, X.Org, Postfix, GHC, Perl, Python, PostgreSQL, OpenSSH, Firefox, Apache, ejabberd, Dovecot, git, GnuPG, XMonad, jabber.el, Magit, rdiff-backup, LaTeX, Gimp, VLC, Syncthing, Sakura, chrony, Jitsi, Fail2ban, WeeWX, DejaVu fonts, ripgrep, lots of GNU, the list goes on and on - thanks everybody!

Senior System Engineer, Lyngby

🕑︎ - 2021-02-12

If you are looking for a job working with developing and maintaining computer systems running Linux in a research and development organisation along with a set of computer folks and a bunch of scientists and technicians, here's a link for you: Novozymes is looking for a Senior System Engineer in Lyngby, Denmark (well, currently from home).

You'll be working on some actual big data, with as much free/open source software as we can get our hands on - GitLab, Python, Hbase, PostgreSQL, RabbitMQ and so on, within a larger organisation.

On the other hand you'll be working in the same department as me, so caveat emptor.

Lille langebro

Tomorrow

seistrup.dk (22).