Articles

SRE introduction EN
last service restart EN
Using glob.glob in python EN
Hello World - StatCoreBlog EN
Repair corrupt DJI video files EN

Even though I've heard SRE or Site Reliability Engineering many times in the past and had a rough understanding of what it means I never really got into the fundamentals of it.

From my point of view this (Introduction to Site Reliability Engineering (SRE)) introduction by Microsoft really lays the foundation for a basic understanding of SRE. Therefore I really recommend working through this introduction.


For reasons it could be possible that you need to get the information when a service was restarted. First of all you need to find the process id.

ps | grep "uwsgi"

Using the so found process id you can now get the information of the last restart.

ps -p <processId> -o lstart

When using glob.glob in Python you might experience some unexpected results. Lets say you have the following directory content.

andre@Users-MBP:~/dev/globdemo% ls -gnGl
total 0
-rw-r--r--  1 20  0 Feb  7 21:51 2019-02-05-demo1.md
-rw-r--r--  1 20  0 Feb  7 21:51 2019-02-06-demo2.md
-rw-r--r--  1 20  0 Feb  7 21:51 2019-02-07-demo3.md

Using the following simple program will create some unexpected output at least at a first glance.

import os, glob

path = '/Users/Andre/dev/globdemo'
for file in glob.glob( os.path.join(path, '*.*')):
    print(file)

This will print the following:

/Users/Andre/dev/globdemo/2019-02-06-demo2.md
/Users/Andre/dev/globdemo/2019-02-07-demo3.md
/Users/Andre/dev/globdemo/2019-02-05-demo1.md

As you can see the order of files is different from the one using ls. This is because glob.glob is basically just a wrapper for os.listdir which returns the directory contents in arbitrary order. On MacOS you will get the same order for your output when using -f.

andre@Users-MBP:~/dev/globdemo% ls -gnGfl
total 0
drwxr-xr-x   5 20  160 Feb  7 21:51 .
drwxr-xr-x  21 20  672 Feb  7 21:58 ..
-rw-r--r--   1 20    0 Feb  7 21:51 2019-02-06-demo2.md
-rw-r--r--   1 20    0 Feb  7 21:51 2019-02-07-demo3.md
-rw-r--r--   1 20    0 Feb  7 21:51 2019-02-05-demo1.md

If you need your files sorted in python you can simply solve this by using sorted in your program.

import os, glob

path = '/Users/Andre/dev/globdemo'
for file in sorted(glob.glob( os.path.join(path, '*.*'))):
    print(file)

Running this slightly modified program will create the following output:

andre@Users-MBP:~/dev% python3 globdemosorted.py
/Users/Andre/dev/globdemo/2019-02-05-demo1.md
/Users/Andre/dev/globdemo/2019-02-06-demo2.md
/Users/Andre/dev/globdemo/2019-02-07-demo3.md

For reasons I just wanted to have my own static site generator because there are not enough available right now. /s

Therefore I started to created my static site generator in NET Core using Razor as my template language of choice. This homepage is generated by StatCoreBlog which is the name name of my engine. I know, quite resourceful for choosing a name. The source code of the engine is right now hosted on my private git server but I will definitely publish the sources on Github.

What is missing right now?

  1. No rss feed available
  2. Other things

Will I implement these later on? Rss feed will be definitely available.

I have any questions just my leave a comment. I'm just kidding....


Having my new drone for some days now I was facing a corrupt video file today. I guess it got corrupted when I turned off the drone before ending the recording. According to some information from the DJI forum this seems to be a known issue for some (maybe all) DJI drones.

Even though the .mp4 file seems to be created properly on the SD card, beside the video file itself you can find a .trinf and a .avc1 file.

Inside the DJI forum I found out that I'm not the first person who had this problem. But luckily I also found a solution for this issue inside the forum. You can use the tool djifix which can be found here. Inside the forum it is mentioned that the homepage seems to be offline sometimes.

Using the tool is pretty easy. Simply put the tool and the corrupt file inside a directory and run the following command:

djifix name-of-video-file-to-repair-including-any-.MP4-or-.MOV-filename-suffix

Afterwards you will have a .h264 file. If needed this file can then be converted to .mp4 afterwards using ffmpeg.