Have you tried turning it off and on again? Sad but true, it really helps sometimes. In my particular case I have this Gigaset Maxwell 10 VoIP phone that sometimes loses its SIP registration on my FreePBX server. Manually rebooting the phone remediates the problem, but let’s automate that…
Continue reading Restart unregistered VoIP phone via PoECategory Archives: Linux
Synology DSM to NUT (Network UPS Tools)
If you have a UPS (Uninterruptible Power Supply), it is likely that you are running NUT (Network UPS Tools) on a Linux host to monitor the UPS and shutdown the host when the UPS signals a low battery condition. It is relatively easy to add a Synology NAS as a UPS monitoring slave. Continue reading Synology DSM to NUT (Network UPS Tools)
Throwaway MySQL Server in Docker
I had a MySQL database backup that I wanted to restore to a temporary MySQL Server instance so I could browse through the tables and perform some small queries. For this I needed a “throwaway MySQL Server”… Continue reading Throwaway MySQL Server in Docker
Enabling HSTS in Apache 2.4
After securing one of my servers with Let’s Encrypt, I was a bit disappointed that my website only got an A result on the Qualys SSL Server Test. Why did I not get the much sought-after A+?
Browsing the Protocol Details of the report, I discovered that my website was lacking Strict Transport Security (HSTS) support. This is how I enabled it on my Apache 2.4 web server running on Debian 8… Continue reading Enabling HSTS in Apache 2.4
Moving files to subdirectories based on date in the filename
My camera produces JPG files that have date and time information in the file name. I want to move the files to new subdirectories per year, month and day.
IMG_20150723_233831.jpg -> 2015/07/23/IMG_20150723_233831.jpg
IMG_20151001_174215.jpg -> 2015/10/01/IMG_20151001_174215.jpg
I wrote this small perl script to perform this task:
#!/usr/bin/perl # Move files to new subdirectories based on file name. # CC BY SA 2015, Lieven Blancke # my camera produces JPG files named IMG_yyyymmdd_nnnnnn.jpg # I want to move these files to subdirectory per year, month and day # IMG_20150723_233831.jpg -> 2015/07/23/IMG_20150723_233831.jpg # IMG_20151001_174215.jpg -> 2015/10/01/IMG_20151001_174215.jpg use strict; use warnings; use File::Copy; use File::Path 'make_path'; my $directory = './'; opendir (DIR, $directory) or die $!; while(my $file = readdir (DIR)) { # ignore files beginning with a period next if ($file =~ m/^\./); # only files, no directories next unless (-f "$file"); # only process files like IMG_yyyymmdd_nnnnnn.jpg if ($file =~ /^IMG_([0-9]{4})([0-9]{2})([0-9]{2})_([0-9]{6})\.jpg$/) { print "$file -> $1/$2/$3/$file\n"; # create the directory $1, $1/$2 and $1/$2/$3 in one go make_path("$1/$2/$3"); # move the file to the directory move($file,"$1/$2/$3/$file") or die "Could not move file $1 to directory /$2/$3: $!"; } } closedir(DIR);
Extracting audio from a YouTube video using avconv
You can download YouTube videos with the NetVideoHunter Firefox add-on. After installing the add-on, you can download a YouTube video by clicking the icon.
By default the add-on downloads the best available quality from YouTube, that is very convenient.
The downloaded file has an mp4 extension. Using the libav command line tool avconv, you can extract the audio without transcoding. This way the process is very fast and the audio quality remains the same:
avconv -i testvideo.mp4 -codec copy -vn testaudio.m4a
The -codec copy option makes sure the audio is extracted without conversion an the -vn option excludes the video being written to the output file.
To install avconv on Debian:
sudo apt-get install libav-tools