Archiv der Kategorie: Dies und das

Links

What: A list of not-now useful links
Why: Limited memory 😉
How: –

Tools

Vagrant

Resize vagrant disks

Virtual Box

Resizing virtual box disk space, the easy way
GParted live image

Install guest additions in Ubuntu

sudo apt-get install virtualbox-guest-dkms

Java

https://developers.redhat.com/blog/2017/03/14/java-inside-docker/

Ember

https://medium.com/@ruslanzavacky/ember-cli-fingerprinting-and-dynamic-assets-797a298d8dc6

Docker

https://developers.redhat.com/blog/2017/03/14/java-inside-docker/

Docker an iptables

Sound recording

http://www.upubuntu.com/2013/05/how-to-record-your-voice-from.html

Machine learning

deeplearnjs

Programming

Ternary numbers

Python 3 program to convert a decimal number to ternary (base 3)

Data

General

Pandas data profiling

Conversion

Convert audio to base64

Linux

Go back to older kernel after update

Add a second hard drive (also working for vms)

Ubuntu not starting to graphical mode, flickering

Hang at boot on old machines

See https://www.youtube.com/watch?v=ZZBTSUbzT0g.

Add acpi=force in /etc/default/grub in line GRUB_CMDLINE_LINUX_DEFAULT and apply settings:

sudo update-grub

Ubuntu

If you would like to use a usb serial connection (for example to connect an ESP32), make sure the linux-modules-extra is installed (which is not the case in default cloud versions of Ubuntu). You can install it via:

sudo apt install linux-modules-extra-$(uname -r)

See also: https://askubuntu.com/a/1129260.

Windows

Links to user folders

1. Copy folder to new location
2.

mklink /J "absolute path to old location" "absolute path to new location"

Show symbolic links

dir /AL /S "folder"

See also: https://superuser.com/a/496155

VCS

Git

Beautiful log

git config alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"

Use it like:

git lg --all

Development

Joels Test

Hallway test

Python https server

Creating self-signed SSL certificates with OpenSSL

Serial console

https://www.cyberciti.biz/hardware/5-linux-unix-commands-for-connecting-to-the-serial-console/

Client – Server

Get server certificate

See: https://superuser.com/a/641396.

openssl s_client -showcerts -connect server.edu:443 /dev/null|openssl x509 -outform PEM >mycertfile.pem

Systemd

https://wiki.ubuntuusers.de/Howto/systemd_Service_Unit_Beispiel/

https://www.freedesktop.org/software/systemd/man/systemd.service.html

Activate caching for client side on apache2

Enable apache module:

1
2
a2enmod headers
sudo systemctl apache2 restart

Create .htaccess file in the specific directory (adjust max-age to the number of seconds you want the resource to be cached):

<IfModule mod_headers.c>
<FilesMatch "\.(gif|ico|jpeg|jpe|png|css|js)$">
Header set Cache-Control "max-age=86400, public"
</FilesMatch>
</IfModule>

Set different port in apache2

See: https://stackoverflow.com/a/26064554.

Images

Identify image format

1
identify -format "%wx%h %C"

For format options see: ImageMagick.

Resize image

1
convert  -resize x\&gt;

IoT

Raspberry and Ubuntu

Install Ubuntu on Raspberry

https://ubuntu.com/download/raspberry-pi

Getting audio to work over hdmi

Add the following line to /boot/firmware/usercfg.txt and reboot:

1
dtparam=audio=on

Increase gpu memory

Add the following line to /boot/firmware/usercfg.txt and reboot:

gpu_mem=128

Make a small animation based on existing images

What: Concatenate images to a video
Why: Small animation as logo, simple stop and go movie
How: Using ffmpeg to concat existing images into mp4 file

Requirements

The following is using ffmpeg in debian linux. There are also builds for other platforms available. Depending on the platform you maybe have to install the codec. The following is tested with a default debian system.

Install ffmpeg with:

1
apt-get install ffmpeg

Create some images

Create a sequence of images. Lets assume we want to have a spinning wheel of the following kind for this tutorial:










The important point is the numerical ordering of the image names like img1.png, img2.png, ….

Create the video

Create the video according to the documentation (assuming an image numbering like mentioned above):

1
ffmpeg -i %d.png -pix_fmt yuv420p output.mp4

The above command works because there are less than 10 images. If you have another image numbering (for example 001-999) you have to change the pattern:
– img%02d.png for 01-99
– img%03d.png for 001-999
– …

The final result will look like: