All posts by mfeilner

Bill Gates: “Die Welt wird immer besser” – und nach Trump “kommt die Wahrheit zurück”!

Bill Gates macht eine erstaunliche Vorhersage zur Ära Trump – Business Insider

„Diese Ereignisse – so schlimm sie auch waren – sind im Kontext eines größeren, positiven Trends geschehen“, schreibt Gates. „Insgesamt wird die Welt besser.“ 

Einige der Punkte, die er als Beispiele aufzählt, sind:

  • Ein drastischer Rückgang der Sterblichkeitsrate von Kindern unter fünf Jahren. Seit 1990 hat sich die Zahl halbiert und hat 122 Millionen Kindern das Leben gerettet.
  • Ein dramatischer Wandel bei der Bevölkerungszahl, die in extremer Armut lebt. Ware es im Jahr 1990 noch ein Drittel der Weltbevölkerung, ist es heute nur noch ein Zehntel. 
  • Ein enormer Anstieg der Anzahl der Kinder, die weltweit eine Schule besuchen: Mittlerweile können das 90 Prozent aller Kinder. 
  • Gesetze, die Homosexuelle schützen, sind nun in mehr als 100 Ländern in Kraft. Weltweit werden Frauen zunehmend in öffentlichen Ämtern besetzt.

Earth’s magnetic field is acting up and geologists don’t know why

Weird. Look at the map… That sure is something.

In the meantime, scientists are working to understand why the magnetic field is changing so dramatically. Geomagnetic pulses, like the one that happened in 2016, might be traced back to ‘hydromagnetic’ waves arising from deep in the core1. And the fast motion of the north magnetic pole could be linked to a high-speed jet of liquid iron beneath Canada2.

https://www.nature.com/articles/d41586-019-00007-1

Youtube-Download Scripting (youtube-dl)

I just realized a wonderful feature in Youtube-dl: ytsearch:$SEARCHTERM. If you lack the context, scroll down.

I am using Nextcloud Notes and youtube-dl for automated downloads of Youtube-Videos that I want to watch later or for Music that I autoconvert to MP3s and put them in playlists (yeah I am old-fashioned, I still have tons of Vinyl). So if you enter youtube-dl ytsearch:Feilner, this gem will download the first video found – which is my presentation about Mythbusting documentation:

mfeilner@fibonacci:~> youtube-dl ytsearch:Feilner
[youtube:search] query “Feilner”: Downloading page 1
[download] Downloading playlist: Feilner
[youtube:search] playlist Feilner: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
[youtube] Cpug8Iqw3f8: Downloading webpage
[youtube] Cpug8Iqw3f8: Downloading video info webpage
[youtube] Cpug8Iqw3f8: Downloading MPD manifest
[dashsegments] Total fragments: 376
[download] Destination: Mythbusting Documentation – Markus Feilner-Cpug8Iqw3f8.f137.mp4
[download]  10.6% of ~323.89MiB at  2.59MiB/s ETA 02:07

After a few minutes, you’ll find the mp4 in your working directory. Guess I have to experiment with that more thoroughly… Update: I just found the beautiful option to tell ytsearch: how many files it should retrieve from the search: youtube-dl ytsearch10:Feilner will download the top ten video files from the search result, ytsearch20 twenty.

But what I also do is: I am using Nextcloud Notes to add music, video, and other stuff that I want downloaded on a local machine. I can add links and stuff to this .txt file from my smartphone or all my machines and laptops. Have a look at Notes, it’s awesome. Only one caveat: First line is always the name of the file. Markup is supported, but I don’t need that. Here’s my download-script that omits the first line and does some path magic – you can see I am not a coder, but it works like a charm.


#!/bin/bash
# download Youtube videos from a list in a txt file and call scripts to convert them
IFS=”¬”
if [ -z $1 ]
then
INPUT=/home/mfeilner/Nextcloud/Notes/Youtube.txt
else
INPUT=$1
fi
echo $INPUT
INFILE=/tmp/infile
awk ‘NR>1’ $INPUT > $INFILE
TEMPDIR=~/Temp/ytd/`date +%Y-%m-%d-%H-%M`
mkdir -p $TEMPDIR
cd $TEMPDIR
while IFS= read -r line
do
youtube-dl “”$line””
done < “$INFILE”
/home/mfeilner/Nextcloud/config/bin/mp42mp3
mkdir MP3; mv *.mp3 MP3/; cd MP3
/home/mfeilner/Nextcloud/config/bin/mkplaylist $TEMPDIR

mp42mp3 converts lots of video formats (it will be improved, yes), and mkplaylist creates m3u files. I also have a mp3tidy script that cleans up filenames by normalizing them and does some basic id3tagging.

#!/bin/bash
# convert media formats
IFS=”¬”
for file in *mp4
do ffmpeg -i “$file” `basename -s mp4 $file`mp3;
done
for file in *webm
do ffmpeg -i “$file” `basename -s webm $file`mp3;
done
for file in *mkv
do ffmpeg -i “$file” `basename -s mkv $file`mp3;
done
for file in *m4a
do ffmpeg -i “$file” `basename -s m4a $file`mp3;
done

I have some more scripts running that tidy up filenames and tags and stuff, but they are too embarassing to publish (yet).

For those that lack the context: Youtube-dl is a wonderful Video downloader for youtube. It also supports direct encoding to mp3, but I prefer to have hands on myself if I need it, that’s why ffmeg comes in handy.  And because of the nasty first line in Youtube.txt, I decided to not use Youtube-dls read-from-file mechanism.

youtube-dl https://www.youtube.com/watch?v=Cpug8Iqw3f8

downloads the Feilner video from the example above. Ffmpeg could encode it to mp3 so that there’s only the audio, creating a podcast e.g. for the car. Rename would help stripping unwanted stuff from the filename and there’s some tools out there to change the tags properly.

To get rid of the Youtube-ID in the filename and for basic id3tagging I do this:


#!/bin/bash
# normalize Youtube-Downloaded MP3 files after conversion from Mkv or similar,
# ID3-Tag them by adding filename to Artist, Title and Album fields.
IFS=”¬”
INFILE=/tmp/infile
OUTFILE=/tmp/outfile
TEMPDIR=~/Temp/ytd/date +%Y-%m-%d-%H-%M
FILENAME=/tmp/filename
CHARCOUNT=17
ls *mp3 -1 > $INFILE
mkdir -p $TEMPDIR
while IFS=”²” read -r line
do
echo “”$line”” | rev |cut -c $CHARCOUNT- | rev > $FILENAME
mv “”$line”” $TEMPDIR/`cat $FILENAME`.mp3
id3tag -a=`cat $FILENAME` -A=`cat $FILENAME` -s=`cat $FILENAME`
done <$INFILE
mv $TEMPDIR ~/Downloads/New
rm $OUTFILE $INFILE $FILENAME

Bluetooth-Autoconnect to Speakers from Command Line

My Desktop in the home office is always connected to the stereo, via Bluetooth. It sucks to click the BT icon or run bluetoothctl manually. Thus some time ago I fixed that by a little research and testing. Here’s what made me happy: 

I added the command echo -e “connect 0C:A6:94:D1:88:5D\n quit” | bluetoothctl to my files. For easier cut and paste: 

echo -e “connect 0C:A6:94:D1:88:5D\n quit” | bluetoothctl

In my case, I added that to my KDE Autostart script and I created an alias that allows me fast switching back after e.g. a Videoconference with a headset. My alias went to ~/.profilerc:

alias büro=’echo -e “connect 0C:A6:94:D1:88:5D\n quit” | bluetoothctl’

Works for me. 

Remember you have to replace the ID with the one from your device (delivered to you by the command devices in the bluetoothctl subshell): 

mfeilner@fibonacci:~> bluetoothctl
Agent registered
[Büro]# devices
Device D4:A6:B7:88:F4:9A D4-A6-B7-88-F4-9A
Device 34:DF:2A:45:E4:C0 Headphones
Device 0C:A6:94:D1:88:5D Büro
[Büro]# list
Controller FC:F8:66:E8:64:A7 fibonacci [default]
[Büro]#