Recent posts (max 20) - Browse or Archive for more

Missing EXIF tags could make your android gallery look bad

I recently helped migration to an new android phone. One part of the process was to store old (WhatsApp) stored images on internal storage towards the external storage SD Card.

Installing the new phone revealed an unexpected fall-out of having all the old pictures being sorted as being taken today.

Close inspection revieved Android Media Store uses the EXIF CreateDate to store the moment the picture was taken, missing the tag, it will use the file modification date as backup. How-ever this modification date of course was reset, because the file was copied from internal storage, without preserving the file modification dates.

The first attempt of fixing the issue was by turning off the phone, removing the SD card and fix the modification time of every file, based on the date identifier found in the file e.g. $ touch -a -m -t 201906230000 IMG-20190623-WA001.jpg.

After an re-insert of SD and turning the phone back on, it was not fixing anything. Basically the re-indexing needed to be forced. This is best done by removing all data from the 'Media Storage' System App. Go to Settings -> Apps -> "3 dots button" -> "Show System Apps" -> "Media Storage" -> Storage -> "Clear Data" -> OK. And next reboot the phone and open the images overview on the SD card using Settings -> "Device Care" -> Storage -> "SD Card" -> "Images". Depending on the amount of pictures this could take a while before your device is responsive again.

So finally all pictures and videos are indexed again and the Gallery shows pictures and videos in good order again. All happy right? ... but wait what about Facebook App ... personally I would nuke it and never look back, how-ever some people do not care about being 'the product' and will happily 'pay' for the service by providing lots of personal data. Having this said, I like a good engineering puzzle, so let's get started.

Facebook App (and maybe others) are still showing pictures garbled, which is annoying when for example wanting to upload older pictures, since you have to scroll down a long while before getting to the good stuff again. Apparently facebook does not rely on the metadata generated by the "MediaStore" and generates it's own, how-ever it blindly ignores the file modified date if EXIF data is missing and simply tags the picture as being taken the moment it is indexed. So how-to fix it?

First and foremost we need help, by some very powerful software EXIFTool, this will help us create the required EXIF tags based on the date string found in the filename. So turn off the phone again and plug the SD Card into a computer ones more.

We are going to use this magic:

$ exiftool \  
    "-datetimeoriginal-=" \
    '-datetimeoriginal<${filename;$_=substr($_,4,8)} 00:00' \
    "-createdate-=" \
    '-createdate<${filename;$_=substr($_,4,8)} 00:00' \
    '-filemodifydate<${filename;$_=substr($_,4,8)} 00:00' IMG-*WA*

To explain a little:

  • Do not update DateTimeOriginal EXIF tag if already exists:

"-datetimeoriginal-="

  • Base the DateTimeOriginal EXIF tag on the filename, by selecting the 5th until 12th character in the filename and expanding this with time midnight (00:00). This special rule is required to ensure file named like IMG-20190405-WA-1290.jpg could be parsed without issues, normal syntax is causing 90 to be specified as minutes which causes errors on importing.

'-datetimeoriginal<${filename;$_=substr($_,4,8)} 00:00'

  • Same applies for EXIF CreateDate:
       "-createdate-=" \
        '-createdate<${filename;$_=substr($_,4,8)} 00:00' \
    
  • our previous $ touch equivalent is a nice-to-have yet not required:

'-filemodifydate<${filename;$_=substr($_,4,8)} 00:00' IMG-*WA*

Now, put your SD card back in the phone and turn it back on. Clear your facebook data "Settings -> Apps -> Facebook -> "Clear Data" -> "Ok' and restart your Facebook Apps and wait a long time again. After your phone (literally) cools down it's time to enjoy the result.

Firefox GTK File Upload Dialog not showing previews

I am confused about Firefox under linux not being about to properly preview all images in the "File Upload" dialog. Since camera's do not generate meaning file-name trying to guess/remember/pick the file-name to be used is annoying time consuming.

More-over the behaviour is not consistent, it only seems to happen on large image files, the small ones are generated properly.

Turns out I looking at a work-around for a CVE issue fixed 5 years ago, as seen in Firefox bugzilla issue:1184009.

The work-around consist of disabling the preview for pictures larger than 4096px in height or width). It has been reported multiple times to have it fixed, how-ever all cases being closed, as it was not safe enough.

5 years down the road an new argument comes to table seen at issue:1571984. "They need to re-implement it ourself, since the external library cannot be trusted.", which seems to make sense at first glance.

Leaves me wondering what they mean with "rigging up their own imagelib". Since 10 months has passed since the last comment. I guess it's challenge accepted, I will try to write a patch somehow ....

Removing master references from github repositories

I recently found out the term 'master' as repository name is considered offensive, since it is often used in conjunction with the term 'slave' Which in hindsight is indeed not correct to use.

Since it is not technology limiting how a branch is named, changing is just a matter of making of spending some time on it. If I can make the world a better place by renaming a few of repository trees, it's time well spend.

Since FreeBSD and subversion is using the word trunk together with branches for ages, so I thought it would make a much better alternative.

Switching is a semi-easy, first create and new branch:

$ git checkout -b trunk
Switched to a new branch 'trunk'
$ git push -u origin trunk
Total 0 (delta 0), reused 0 (delta 0)
remote: 
remote: Create a pull request for 'trunk' on GitHub by visiting:
remote:      https://github.com/rickvanderzwet/nagios-plugins/pull/new/trunk
remote: 
To https://github.com/rickvanderzwet/nagios-plugins.git
 * [new branch]        trunk -> trunk
Branch 'trunk' set up to track remote branch 'trunk' from 'origin'.

Deleting old branch:

$ git push origin --delete master
To https://github.com/rickvanderzwet/nagios-plugins.git
 ! [remote rejected]   master (refusing to delete the current branch: refs/heads/master)
error: failed to push some refs to 'https://github.com/rickvanderzwet/nagios-plugins.git'

Whoops make sure to change the GitHub default branch, in mine case found at:

https://github.com/rickvanderzwet/nagios-plugins/branches

And try again:

$ git push origin --delete master
To https://github.com/rickvanderzwet/nagios-plugins.git
 - [deleted]           master

# Delete local branch:
$ git branch -d master
Deleted branch master (was 82e57d4d).

# Update head reference pointer:
$ git remote set-head origin trunk

Dear IBUS don't steal CTRL+ALT+e shortcut in Gnome

I use terminator as my favorite terminal emulator, which uses the shortcut CTRL+ALT+e to open a new window (vertical split).

How-ever recently the key-binding is hijacked by the emojicon hipsters on GNOME to allow inserting emojicons.

To re-claim the key-binding, use ibus-setup and head to the 'Emoji' tab to free the keybinding.

Hacking Samsung SGH-E530 to kids phone

I have a old Samsung SGH-E530 phone which I wanted to convert to play phone. One worry about the phone was the ability to call emergency services (112, 911).

Flight mode was no option, since the phone had to be powered-down, which makes it quite useless as play phone.

Option number two involves drastic measures. Since I will not be needing any GSM capabilities any-more, let's take it out or at least the antenna bit.

Opening the phone was easy peasy, just remove 5 standard philips screws and good to go. Located the antenna, both internal and external and removed a few filter capacitors using tweezers to break them off the board. This will decouple the antenna.

Re-assembly and turning it back in, "Limited service 5 bars". A bit flaky though (holding the phone would make it drop a few bars) how-ever still stable enough to make calls.

Time for a revised plan, time to dive in again. Now locating the Power Amplifier Module (PAM), took the de-soldering station and removed the SKY77328-13 chip from the PCB.

Re-assembly and turning it back in, "Limited service 2 bars"!!! I am located 500 meters from a GSM tower (line of sight), so I am guessing this also helped the process.

Still more to be removed apparently. The "complete RF front end for multi-band GSM and GPRS wireless communications" SI4205-BM is the next canidate for heat-gun removal.

Re-assembly attempt number 3 and finally "No service available", guess I have hit the bulls-eye :-)

Bonus-challenge is setting the date or more precisely the year. The SGH-E530 will not accept the current year (2020), further inspection reveals the date must be set between 1-1-2020 and 31-12-2016. Either no engineer bothered to look this far in the future or a classical case of planned obsolescence.

I would like to set the date correctly to allow learning the day of the week kind of things. Every year the weekday to shift by 1 weekday (365 mod 7), except on a leap year, which is causing the weekday to shift by 2 weekdays.

I order to work around the date restriction I have to improvise. 1-1-2020 was a Wednesday, 6 years earlier, mind the leap-year 2016 in between, 1-1-2014 should be the solution. How-ever 2014 is not a leap-year unlike 2020, thus first of March 2014 is on a Saturday. 1st of March 2020 is located on on a Sunday.

Going back 6 more years to 2008 reveals an other interesting case. The leap-year criteria matches, how-ever located on Tuesday it's incorrect, since there are now 2 leap-years (2012 & 2018) involved.

Going back to 2003 gives me the correct weekday, how-ever no leap year. Going back to 1997, disqualifies as being no leap year. Next in line 1992. Jackpot, first of all a leap-year and secondly 1-1-1992 weekday is Wednesday.

My surprise grows since this behaviour (28 years) is consistent since 1-1-1964 is the next candidate in line. Which is even before UNIX Epoch Time, making it an unlikely candidate to even to be considered :-). I have tried to wrap my head around the math involved to explain it, how-ever I have to leave it "exercise left to the reader".

Back to my pressing matter of setting the right year allowing the weekdays to match has proven to be a rather difficult issue. I can only deal with it by using a work-around. Set the year to 2014 and at 1st of March change the year to 2015. Sounds like next level daylight saving time/summertime :-).

Fix broken UEFI BCD on WinRE Command Prompt

Reduce firefox spell checker languages on Fedora

I switch a lot between en_GB and nl_NL for spell checking in firefox in the context menu (right mouse click).

The context menu how-ever is really bulky showing all kind of languages I never use. Firefox running on Fedora is using /usr/share/myspell directory to populate this list.

One quick and dirty solution is to remove the ones I do not use. Since the are (luckily) all symlinks, this could be done in a breeze:

$ sudo find /usr/share/myspell -type l -delete

Grub on HiDPI screen

Inspired by the blog post Increase Font in GRUB for High DPI Screens from Ward Muylaert. I decided to try to make it work under Fedora 32 on a system which uses EFI boot.

First make the font compatible for grub:
$ grub2-mkfont /usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono.ttf --size=48 --output=/boot/efi/EFI/fedora/fonts/DejaVuSansMono48.pf2

Next update the grub configuration:
$ sudo grub2-mkconfig -o /etc/grub2-efi.cfg

Strictly speaking not required, how-ever I like to keep the files in sync:
$ sudo grub2-mkconfig -o /etc/grub2.cfg

Alter content of /etc/default/grub to include font reference. The GRUB_TERMINAL_OUTPUT is optional, it should be included by default when specifying a new font.

#GRUB_TERMINAL_OUTPUT="console"
GRUB_TERMINAL_OUTPUT="gfxterm"

GRUB_FONT=/boot/efi/EFI/fedora/fonts/DejaVuSansMono48.pf2

Running zoom.us on a HiDPI screen

Working from remote requires tooling to communicate with co-workers. some are using zoom.us which has good linux support.

How-ever when started the whole interface is tiny-tiny since the Qt application does not honour the settings used to combat unreadable windows on my HiDPI screen.

Altering /usr/share/applications/Zoom.desktop and adding the required Qt tweaks (QT_SCALE_FACTOR=1 QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCREEN_SCALE_FACTORS=2) did the trick:

[Desktop Entry]
Name=Zoom
Comment=Zoom Video Conference
Exec=env QT_SCALE_FACTOR=1 QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCREEN_SCALE_FACTORS=2 /usr/bin/zoom %U
Icon=Zoom.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Network;Application;
StartupWMClass=Zoom
MimeType=x-scheme-handler/zoommtg;x-scheme-handler/zoomus;x-scheme-handler/tel;x-scheme-handler/callto;x-scheme-handler/zoomphonecall;application/x-zoom;
X-KDE-Protocols=zoommtg;zoomus;tel;callto;zoomphonecall;
Name[en_US]=Zoom

Jumping around in bash shell

I jump around a lot in the terminal between different projects and activities. To avoid endless typing I have created aliases which allows me to quickly perform this task.

By adding the following entries to your .bashrc you will give access to the powerfull tools of jcd scd lcd. First and foremost goto a directory you would like to earmark. Type scd <alias-of-choice> and your entry will be stored. To go back to this directory type jcd <stored-alias> and you arrived at your destination. Tab completion also works to save typing some more.

function jcd {
        cd "$(grep "${1:-blank} /" ~/.jcd | cut -d' ' -f  2-)"
}

function scd {
        ( grep -v "^${1:-blank} /" ~/.jcd; echo ${1:-blank} `pwd` ) > ~/.jcd.new
        mv ~/.jcd.new ~/.jcd
}

function lcd {
        cat ~/.jcd | sed 's/ /\t = /'
}

function _listcd {
        COMPREPLY=()
        cur="${COMP_WORDS[COMP_CWORD]}"
        opts=$(awk '{print $1}' ~/.jcd | grep "^$2")
        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
        return 0
}

complete -F _listcd jcd
complete -F _listcd scd

How-to limit spelling languages options in Firefox right-click context menu

I keep on forgetting the answer to my own question. Hence a repost:

$ sudo find /usr/share/myspell -type l -delete

source: Firefox Support Forum

Something went wrong with Google Mail

Well you could always store my message and try again later :-)

Netflix Phishing report failures

Dear Netflix,

If you offer a service for users to report phishing mails. You might want to consider removing your spam and phishing filter from the particular account.

Else the user ends up with a catch-22 :-)

Vlag uit de knoop

Vlaggenstok hack

Ik woon in een winderige hoek, waardoor de vlag tijdens uithangen elke keer in de war gaat. Gelukkig bied een stukje PVC ter grootte van de vlag een paar ty-wraps en slangenklemmen een nette oplossing.

Leuk staalje DIY huisvlijt :-)

PS: Slangenklemmen aan beiden zorgen ervoor dat ik de vlag ook halfstok kan hangen mocht het nodig zijn.

Fedora 29 not booting on Acer Aspire ES1-731

Got myself an interessting issue after installing Fedora 29 on an Acer Aspire ES1-731. After start it goes into an reboot loop, stating a cryptic message with phases BootOrder not found and grubx64.efi .

It turned out the Secure Boot has to be modified to allow the GRUB (Fedora Bootloader) to be 'trusted'.

Following the excelent intructions of Krallan on the Acer Community Forum got myself an working system again.

Cool, thanks Krallan!

PS: Press F2 during boot to get into the BIOS

Slow Firefox startup at Fedora

Firefox was starting really slow, taking almost 2 minutes before the startup screen was disabled. As suggested by Redhat bug 1290894 disabling the network connection will Firefox start at normal speed again. How-ever this is rather useless :-).

Running wireshark and strace revealed an interesting observation. Firefox (like many other programs) is first trying to resolve the machine hostname. Since this was not properly configured on my machine, it was not able to find the right answer.

Fixing it by adding the entry /etc/hosts

echo "127.0.0.1 $(hostname)" >> /etc/hosts

Updating Axis 70U

My friend gave me an AXIS 70U Documents Server. Quite old, yet perfectly usable. Updating them using their manual resulted in an obscure message:

500 Command unrecognized or not implemented.
Passive mode refused.

Forcing ftp in active mode (the default back in the days), fixed the issue:

$ ftp -A 192.168.178.102
Connected to 192.168.178.102 (192.168.178.102).
220 AXIS 70U Network Document Server V3.00 Feb 09 2007  ready.
Name (192.168.178.102:rick): root
331 User name ok, need password
Password:
230 User logged in
ftp> bin
200 TYPE set to I.
ftp> put 7000.bin flash
local: 7000.bin remote: flash
200 PORT command successful.
150 Opening data connection for flash (192,168,178,99,168,75), (mode binary).
221-Transfer complete, flash programming finished OK.
    Starting new software...
221 Reset, closing connection.
2262494 bytes sent in 68 secs (33.25 Kbytes/sec)
ftp> quit
226 Transfer complete.

XS4ALL IPTV multicast sources changed

Some of my XS4ALL (KPN) IPTV channels stopped workking properly. The started to stutter, normally an indication of trouble at multicast subscriptions. Looking at the logfile (while the little one was trying to watch BabyTV) I found the culprit:

The source address 217.166.226.39 for group 224.0.252.39, is not in any valid net for upstream VIF[0]. This address is part of a multicast block 217.166.0.0/16 assigned to KPN.

Adding this new network to /usr/local/etc/igmpproxy.conf using the altnet 217.166.0.0/16 made it all work again.

Ubuntu Server shorten motd message

Ubuntu MOTD gets more lengthly every time a new release comes around with all kind of 'usefull' information and even 'newsflashes'. To disable bits remove executable permissions from parts you do not care about in /etc/update-motd.d/

For example to disable the introduction links, motd 'news' and livepatch 'spam':

$ sudo chmod 0666 /etc/update-motd.d/10-help-text
$ sudo chmod 0666 /etc/update-motd.d/50-motd-news
$ sudo chmod 0666 /etc/update-motd.d/80-livepatch

You can check the result using:

$ sudo run-parts /etc/update-motd.d/

ownCloud client disable update notification

For some reason the Fedora 27 ownCloud client is nagging me for more than 3 weeks about the fact that my version is not yet up2date. This is utterly useless on a package managed Linux system. Since they also do not provide Fedora 27 packages on their website there is no simple way of getting the latest version.

Lucky there is a way to turn it of the notifications

ownCloud documentation nicely describes how-to disable the update notification.