How to check for broken links in markdown files

dead link

Having blog articles up >10 years needs some kind of tool to check for dead links.

Having googled a bit I didn’t find anything convincing. So I just created a very dirty solution which did the job for me.

You start it with

python3 link_checker.py path/to/md/files/ http://mysite.com

and it iterates over all .md files in path/to/md/files for links and images in your articles, sends a HTTP HEAD request and prints everything which does not look right

How to set up raspberry pi headless with ssh and wifi

raspberry pi 3

Setting up raspberry pi is a bit tedious when doing it over attached monitor, keyboard and mouse (I usually don’t have those around anyway, being laptop only at the moment), so here’s a good and easy way to get an installation directly from your laptop, making the pi automatically join your wifi and enable ssh:

Flash

etcher

I found that etcher.io is a very easy way to flash, in order to do so:

  • Install etcher (available for linux/osx/windows)
  • Download image: I chose the raspbian lite version from official
  • Open etcher etcher (on linux just unzip the etcher.zip and open the executable therein)
  • Insert sd card (don’t mount it yet!), watch that etcher now detects that new card in the middle
  • Select image e.g. ~/Downloads/2017-11-29-raspbian-stretch-lite.zip and flash (for linux i3 users: you’ll get a polkit error. You’ll need to start a polkit agent, e.g. /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 before flashing)

How to streamline cd ripping without tagging track data

CD tower to rip

Since we recently stopped using Spotify, we switched to borrowing CDs from the local library (which, in our case is only 200m away from our house).

Now, because the kids get CDs at least once a week, I needed a way to quickly import those CDs into our Sonos system without too much hassle. Since the kids only borrow children stories (spoken audio) which often are not on MusicBrainz, I needed an easy way to tag them myself. Because I don’t care about tagging every single track (because you usually listen to a story start to end anyway), I wanted to have a streamlined process. The following script does:

  • Rip the CD and convert it to m4a (AAC encoding, slightly better compression than mp3)
  • Eject the CD
  • Ask me for the album and artist name
  • Opens chrome so I can choose an artwork
  • Convert the artwork to JPG in a reasonable size
  • Copies the music to the directory on my NAS
  • Triggers Sonos to update the music library

How to mass convert mp3 files to aac (m3a)

Since aac has a slightly better compression rate than mp3 (and, geez, mp3 was standardized 1992, there must be better standards nowaday), I decided to mass convert my music library from mp3 to aac

Won’t the quality be just awful?

Of course, re-encoding sounds like a terrible idea. You’re converting from one lossfull format to another, similar when mass-converting gifs to jpegs. But on the other hand, for my setting it was just good enough. The library I converted we listen to at home over Sonos or in the car. So in both settings there are only half-decent speakers. Also, many of the tracks I converted from audio cassettes, so they were in a bad quality already. You can certainly play with the bitrate, but if you have invested into an expensive stereo you’d be better off converting from a lossless source.

Declutter

First things first: Almost everything in life is easier if you first reduce it to the absolute necessity. I recently spoke with a colleague who told me she has converted her whole CD stack into mp3 without first trashing the CDs she never listens to. That’s insane.

First, reduce your collection to, say the albums you listened in the past 12 months. Make it 24. But anything beyond is just an overly burden you don’t need to carry.

No words! I just want to copy-paste

Here you go: Once, you haved cded into the directory with the mp3 files you want to convert, do this:

detox *.mp3
ffmpeg -i *.mp3([1]) artwork.jpg
for i in *.mp3; do ffmpeg -i $i -c:a libfdk_aac -b:a 128k -vf scale=1280:-2 ${i/mp3/m4a} done
for i in *.m4a; do AtomicParsley $i --artwork artwork.jpg --overWrite; done
rm artwork.jpg && rm *.mp3

Feature phone with tethering (Nokia Asha 302) - tune out of Internet

Since the days of the iPhone finding the right way to handle the mobile phone is challenging to me. Working in web programming and being a father and husband at the same time is means that I need to be able to connect to my colleagues at work when not at my desk while being able to “tune out” while being with my family.

My latest try at the problem was to buy a “feature phone” which was good enough to support the bare minimum (apart phone calls and SMS this is WhatsApp and internet tethering for my tablet/laptop) but was dumb enough that it would not tempt me away to check any news/mails while being with my family. I came across the “Nokia Asha 302” which is no longer produced but IMO was selling bad enough that there are some in stock in the most countries (at least that was in case here in Switzerland).

I’m on this “feature phone” now since a few days and must say that I’m quite happy with it. When I am at work I just take my android tablet (nvidia shield k1) with me, if I want to tune out I can leave the house with my mobile only. As it is an outdated phone there are some tweaks you need to do which I documented below:

How to attach a file to google spreadsheet

Update 2022: There is a new solution which actually works! FileDrop is a google sheet extension which let’s you…

  1. choose a file from your computer to upload
  2. inserts the link to the file into the current cell

In order to use it:

  1. go to https://getfiledrop.com and click “install addon”
  2. on the spreadsheet you want to use it click extensions -> FileDrop -> Start FileDrop
  3. put the focus on the cell you want to add the link
  4. drag and drop the file into the sidebar

The file will be uploaded into your google drive into a folder “FileDrop” which you can move to any position of your drive tree. If you want to define the upload location then you need to switch to the paid version.

Alternatively you can use dropspread - but I found dropspread harder to use (it has a few UI quirks)


 


 


The old solution, for history reasons. I couldn’t get it to work again, if anyone is interested, I think this stackoverflow answer is pointing into the right direction.

attach file

The following setup lets you

How to migrate your wordpress to tumblr. Including images and comments.

So I’ve decided to move my wordpress blogs to tumblr. Although apparently TechCrunch thinks that’s a bad idea. And although Moritz Adler would kill me for that. (Although: He doesn’t have a personal blog and hence has no licence to kill me). Anyway. With tumblr I don’t need to host a blog software myself. And I don’t end up having my blog hacked and then seeing my blog being displayed as a malware site in Chrome/Firefox (happened to me twice). And then with tumblr I create new blogs with subdomains within minutes. Cool stuff. Hail to the cloud, baby!

So here you go: A complete guide how to fully migrate your wordpress blog to tumblr. Including comments and pictures. And still supporting your old url scheme.

Update: I ran into a tool that claims to do a lot for you: import2.com/tumblr. It doesn’t migrate images and 302 redirects. Not sure about comments migration. And it costs 24$. Still, if you can leave out some of the steps below that’d be worth the money. Comments of the author on quora

How to fix Jambox’ “static noise and no bluetooth sound” problem(includes soldering)

fixed

Jambox is a pretty cool device: The sound quality is very good, it is small, it has a battery. I liked it. Until it broke. It just didn’t play music over bluetooth any more but instead uttered static noise. This seems to be a quite severe production problem as after some internet research I found that many people have devices with the exact same problem. So going down the “Jambox please replace my device” way didn’t sound promising to me. The possibility that the replacement device is broken as well is just too high.

The problem lies in the aux in port. The device thinks there’s an aux cable plugged in and outputs the signal from the aux input when in fact it should play the bluetooth sound.

How to reset Jambox when bluetooth completely stopped working

I bought a Jambox about half a year ago. Sound wise it is great, but apparently it is not very stable, especially after recharging it falls into some state where it only utters static noise. In this state it still plays music over the aux cable, but not any more over bluetooth.

Python: Print list of dicts as ascii table

Sometimes I want to print list of dicts as an ascii table, like this:

| Programming Language | Language Type | Years of Experience |
+----------------------+---------------+---------------------+
| python               | script        |                   4 |
| php                  | script        |                   5 |
| java                 | compiled      |                  11 |
| assember             | compiled      |                  15 |

I searched on Google - but without luck.