Posts tagged with “bash”

Otto now supports backups by date and EXIF stats

Ideally when you travel, you'd want to use a fresh card with your camera each day. This way, if you lose the card, or the data on it becomes corrupted, the damage would be limited to a single day. This strategy might not be feasible for longer travels (if you travel for a month and you use two cameras, you'd need 60 storage cards), but it can be practical for shorter trips.

Otto can now handle this particular scenario. Specify the -i parameter, and the script creates a directory with the current date as its name (for example, 2023-05-01) and backs up the content there. The script is clever enough to distinguish between cards coming from different cameras, thus keeping things tidy while avoiding inadvertently overwriting data coming from multiple sources. Here is how it works. Say, you use a Nikon D800, and you use the following command to back up data:

otto -i -d "/media/$USER/NIKON D800/DCIM/101ND800"

This command creates the 101ND800 directory first, followed by a subdirectory with the current name as its name. The data from the specified source is then backed up to the 101ND800/2023-05-01 subdirectory.

In addition to transferring and organizing JPEG and RAW files, Otto can now generate statistics by analyzing the EXIF metadata of files in a given directory. Say, you want to know what lenses you use most. Run the command below, and Otto generates a CSV-formatted text file containing all lenses used to take photos in the given directory along with the count for each lens.

otto -d "/path/to/dir/with/photos/" -s LensID

Want to know what focal length you use (most)? Here's the command to use:

otto -d "/path/to/dir/with/photos/" -s FocalLength

How about camera models? There's a command for that, too:

otto -d "/path/to/dir/with/photos/" -s Model

Each of these commands generates a .csv file that uses the EXIF tag as its name (LensID.csv, FocalLength.csv, Model.csv, etc) in your home directory. You can then import the file into a spreadsheet application like LibreOffice Calc and generate a graph. Or you can use web tools like cvs-graph to create a pie chart using the generated CSV file.

You'll find Otto in its own GitHub repository.

For all things photography and Linux, read the Linux Photography book.

Turning an iPad or an iPhone into a Linux-based photography companion

If only an iPad or an iPhone could run Linux tools like Rsync, ExifTool, ImageMagick, etc., you wouldn't have to schlep around a Linux notebook when traveling, especially if your photographic needs are limited to keeping your photos and RAW files safe.

iPad, USB-C hub, Nikon D800

Enter iSH, an app that bestows Linux powers on Apple devices. Once installed, iSH offers a Linux environment that gives you access to a plethora of Linux tools. More importantly, iSH can access the iPadOS and iOS file systems and external storage devices connected to the iPad or the iPhone. This means that you can run commands and scripts in iSH to back up data from a storage card connected to the Apple device. Better still, if you use a USB-C hub that features both a card reader and USB connectors, you can back up data directly from a card to an external USB storage device, bypassing the iPad's or iPhone's internal storage.

Continue reading

Language learning hack: Generate a "Word of the day" wallpaper

The best way to learn new words and phrases is to use them actively. The next-best way to learn new words is to be exposed to them as much as possible. And since the wallpaper that adorns my graphical desktop environment is what I stare at most of my waking hours, I thought that it'd only make sense to add words and phrases I want to memorize there.

Half an hour after the eureka moment, I had a working hack consisting of a plain text file with words and phrases along with their translations, a wallpaper template PNG file, and a simple Bash shell script. The latter pulls a random line from the text file, and uses the template to generate a new wallpaper with the picked line. Below are all the gory details worth knowing if you want to roll out something similar.

Continue reading

How to use Hald CLUT files on Android (almost the Linux way)

Hald CLUT files offer a quick and easy way to apply effects to photos, and there are plenty of desktop applications that can handle the task. But if you want to use your favorite Hald CLUT files on an Android device, you'll quickly discover that there are not that many apps (if any at all) that allow you to do that. No problem: instead of relying on a third-party proprietary app, you can roll out your own solution using Termux.

Continue reading

Instant offline translation with Argos Translate and a dash of Bash

Google Translate is great, until it's not. The quality of translation is undeniably impressive, and the apps have some genuinely useful features. But even if you choose to ignore the fact that Google lives off our data, there is a matter of Google Translate not working offline—not on a Linux system, anyway. And even if it could do that, there is still a case to be made for using and supporting an open-source alternative free from the shackles of surveillance capitalism.

Enter Argos Translate, an open-source neural machine translation engine that works offline and is available as a Python library, a command-line tool, a web application, and a desktop utility. Install Argos Translate on your machine, add a simple Bash shell script, and you can instantly translate a text selection from any application. Here is how to do this on Ubuntu and Linux Mint.

Continue reading