convert


convertAndPrintSeconds – Convert seconds to minutes, hours and days in bash 1

The following code can be used to convert some time in seconds to minutes, hours and days in bash.
It will print on screen the converted values only if they are not 0. i.e If the resulting days is 0, it will not print the text for days at all.
You can use it in any script without copy pasting everything in it by executing the following command source ./convertAndPrintSeconds.sh.
Doing so, it will load to your script the function that is defined in convertAndPrintSeconds.sh, making it available for you to use (something like including code in C, with some caveats).

convertAndPrintSeconds.sh (compressed) (201 downloads)
#!/bin/bash

convertAndPrintSeconds() {

    local totalSeconds=$1;
    local seconds=$((totalSeconds%60));
    local minutes=$((totalSeconds/60%60));
    local hours=$((totalSeconds/60/60%24));
    local days=$((totalSeconds/60/60/24));
    (( $days > 0 )) && printf '%d days ' $days;
    (( $hours > 0 )) && printf '%d hours ' $hours;
    (( $minutes > 0 )) && printf '%d minutes ' $minutes;
    (( $days > 0 || $hours > 0 || $minutes > 0 )) && printf 'and ';
    printf '%d seconds\n' $seconds;
}

Usage

Function convertAndPrintSeconds accepts one parameter, the positive integer number that represents the seconds count we want to convert.

Example

$ source ./time.sh 
$ convertAndPrintSeconds 10
10 seconds
$ convertAndPrintSeconds 100
1 minutes and 40 seconds
$ convertAndPrintSeconds 1000
16 minutes and 40 seconds
$ convertAndPrintSeconds 10000
2 hours 46 minutes and 40 seconds
$ convertAndPrintSeconds 100000
1 days 3 hours 46 minutes and 40 seconds
$ convertAndPrintSeconds 1000000
11 days 13 hours 46 minutes and 40 seconds
Advertisements

Batch convert NEF photos to JPEG using ufraw

ufraw converts camera RAW images to standard image files (like jpeg).
Using the ufraw-batch we can massively convert the images in a folder in one call without the need of external scripts to invoke each separate call.

ufraw-batch --out-type=jpeg --out-path=./ ./*.NEF

In the above example we set the output type to jpeg, the folder to write the new images the one we are currently in (./) and the input all NEF files in the current folder.


How to convert ppsx and pps to ppt/pptx/pdf with Microsoft Office 1

Methodologies:

Method A) You can right click on the ppsx/pps file and then click New, this will open a new presentation in PowerPoint with the contents of the ppsx/pps show.
Following, you can modify the document and save it to the desired format.

Method B) You can start the PowerPoint application, go to the File menu and then select Open from the menu on the right, navigate to your ppsx/pps file and open it. After you make your modifications save it to the desired format.

Video Examples

This video demonstrates how to convert a PPSx (PowerPoint show) file to a PDF.

The following video demonstrates how to open a ppsx and a pps file using PowerPoint in a way that you will be able to edit them.