Uncategorized

Those that have subscribed to my YouTube channel, might have noticed that the content has changed a bit away from Django, with more focus on Docker, Kubernetes, and Keptn.

With that in mind, I would like to share you my recent video series here:

Create Docker Containers for GoLang, NodeJS and Python: https://www.youtube.com/watch?v=oZfPbKZDS8U

How to create a new Keptn project for continuous delivery: https://www.youtube.com/watch?v=7EYVHjOfQTQ

Would love to get some feedback directly on the videos if they are helpful! Thanks!

In one of my recent videos I've disussed the size of the Django/Python Docker Containers and how to decrease it:

I failed to successfully create an image based on alpine, which is known to be very slim. With the help of Aaron Goodrich, who posted a comment with a Dockerfile for alpine, I was able to finally create such an image 🙂 Thanks for the help!

Without further ado, here are the results (and the respective Dockerfiles).

Please note that I have slightly changed the Dockerfile compared to the video above.

Based on Python 3.5 Jessie: 740 MB

FROM python:3.5-jessie

COPY ./app /app
WORKDIR /app

RUN pip install --no-cache-dir -r requirements/dev.txt

Based on Python 3.5 Slim: 188 MB

FROM python:3.5-slim

COPY ./app /app
WORKDIR /app

RUN pip install --no-cache-dir -r requirements/dev.txt

Based on Python 3.5 with Alpine: 248 MB

FROM python:3.5-alpine

COPY ./app /app
WORKDIR /app

RUN apk add --update --no-cache postgresql-client && \
    apk add --update --no-cache --virtual .temp-build-deps gcc libc-dev linux-headers postgresql-dev

RUN pip install --no-cache-dir -r requirements/dev.txt

RUN apk del .temp-build-deps gcc libc-dev linux-headers postgresql-dev

This blog is using wordpress and certain tools of wordpress, that allow collecting statistical data, such as information about your web browser (Browser Name + Version). We do not share this information with any third party (such as Google Analytics), everything is kept within this wordpress blog and server.

Read more about it in our "brand new" Privacy Policy.

from django.contrib.auth.models import User
from faker import Faker
fake = Faker()

for i in range(0,200):
    name = fake.name()
    first_name = name.split(' ')[0]
    last_name = ' '.join(name.split(' ')[-1:])
    username = first_name[0].lower() + last_name.lower().replace(' ', '')
    user = User.objects.create_user(username, password=username)
    user.first_name = first_name
    user.last_name = last_name
    user.is_superuser = False
    user.is_staff = False
    user.email = username + "@" + last_name.lower() + ".com"
    user.save()

While USB Headsets are already supported by Ubuntu (15.10 in my example), there are some stumbling block. One of them was that the USB Headset is not recognized after (re)booting, only after plugging it out and back in.

To overcome this issue, the USB device needs to be entered in /etc/modprobe.d/snd-usb-audio (you might have to create this file first).

Step 1: Boot without the headset plugged in
Step 2: Run lsusb tool in commandline, copy the output to a text editor
Step 3: Plug in your USB headset
Step 4: Use lsusb tool in commandline to find out what USB devices you have, in my example:

Bus 002 Device 003: ID 0451:8046 Texas Instruments, Inc.
Bus 002 Device 002: ID 0451:8046 Texas Instruments, Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 413c:301a Dell Computer Corp.
Bus 001 Device 005: ID 2034:0102
Bus 001 Device 004: ID 413c:2113 Dell Computer Corp.
Bus 001 Device 003: ID 0451:8044 Texas Instruments, Inc.
Bus 001 Device 002: ID 0451:8044 Texas Instruments, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Step 5: Cross match the lsusb output from step 2 to find out which device your headset is, in my example it was
Bus 001 Device 005: ID 2034:0102

Step 6: Create the following entry in /etc/modprobe.d/snd-usb-audio (you might have to create this file first):
options snd-usb-audio index=2 vid=0x2034 pid=0x0102

Make sure to replace 0x2034 with the first ID of the lsusb output of your usb device, and 0x0102 with the second one.

Step 7: Reboot, enjoy!

Ever wondered which representations YouTube is using for your video? Is it worth uploading your YouTube video with 20 Mbit/s at 1080p and 30 fps?

Find out by analyzing your YouTube videos MPD (Media Presentation Description) file, as explained in my new open source repository here: https://github.com/ChristianKreuzberger/extract-youtube-mpd

This is the result of one of my videos:

python extract.py https://www.youtube.com/watch?v=GTGUa4J8XKw aspen.mpd
Downloading HTML of https://www.youtube.com/watch?v=GTGUa4J8XKw 
Extracted MPDURL from HTML:  
https://manifest.googlevideo.com/api/manifest/dash/sparams/..... 
AdaptationSet,RepresentationID,Bitrate,Codec,ExtraInformation 
audio/mp4,140,127570,mp4a.40.2
video/mp4,133,247800,avc1.4d4015,426/240/24
video/mp4,134,601944,avc1.4d401e,640/360/24
video/mp4,135,1103336,avc1.4d401e,854/480/24
video/mp4,160,109967,avc1.42c00c,256/144/12
video/mp4,136,2206969,avc1.4d401f,1280/720/24
video/mp4,137,4144774,avc1.640028,1920/1080/24

This means my video is available at 4.1 Mbit/s at 1080p and 24 fps, 2.2 Mbit/s and 720p, 1 Mbit/s and 480p, etc... We have a paper submitted to NOSSDAV that shows a full analysis of YouTubes representations, so stay tuned for more information.