Trello – backup to your linux machine

2017-01-02 1 min read bash
Just in case, you are looking for backing up your trello account boards, you can use the following bash script to do so: #!/bin/bash - #=============================================================================== # # FILE: backup-trello.sh # # USAGE: ./backup-trello.sh # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka) # ORGANIZATION: Mobileum # Last modified: Thu Dec 22, 2016 01:14PM # CREATED: 08/12/2016 09:41:08 AM IST # REVISION: $Revision: 1. Continue reading

change the output format for time command

2016-08-16 1 min read bash
If you are doing some scripting and using ‘time’ command, then you know sometimes it becomes difficult to capture the output as the output would be something like this: : amit ; time ls real 0m0.002s user 0m0.000s sys 0m0.001s So, it is better to change that format. Here is simple example: 1 <td> <div class="text codecolorer"> &nbsp; </div> </td> </tr> TIMEFORMAT=’real %3R user %3U sys %3S pcpu %P’ time ls amit ; TIMEFORMAT=’real %3R user %3U sys %3S pcpu %P’ time ls 0. Continue reading

Generate random string for various use case

2016-08-08 1 min read bash
Some times I need random string, for example to use as email seperator or to use in some API. One way is to use tools like /dev/[u]random or od and other such. But they seem cubersome after I figured this out. openssl rand <length> openssl rand 10 This alone without some parameters is not interesting thoug. You can use ‘-base64’ or ‘-hex’ to select the encoding. So if you execute the above you will get something like this Continue reading

Get your local IP address like pro

2016-07-10 1 min read bash
In shell scripts if you need to get you local IP address corresponding to your hostname then you can use this command hostname -i Related articles across the web DNS as the Security Cornerstone Making Your iOS Apps IPv6 Ready Why Name.co.zw’s Instant Nameserver Updates Feature is a Huge Deal…

image ordering by Original Date Time using bash script

2016-01-05 1 min read bash
Here is the script: #!/bin/bash - #=============================================================================== # # FILE: imgOrg.sh # # USAGE: ./imgOrg.sh # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka) # REVISION: --- #=============================================================================== for i in * do if [[ $(file $i) == *image* ]] then echo "Image file is :: $i" dir=$( exiftool -s -DateTimeOriginal $i | awk -F':' '{print $2"/"$3}') mkdir -p $dir cp $i $dir/ else echo " Continue reading

Disk usage by file type

2015-11-30 1 min read Fedora Learning
Trying to find the total usage for each of the file types by extension, then here is a quick bash function for you : disk_usage_type () { find . -name '*'$1 -ls | awk ' BEGIN{ a[0]="Bytes"; a[1]="KB"; a[2]="MB"; a[3]="GB"; } {sum+=$7; files++;} END{ print "Total sum is ::\t" sum; print "Total files ::\t" files; while (sum > 1024) { sum=sum/1024; count++; }; print sum" "a[count]; }' } Just define the function in one of your bash startup files. Continue reading

How to verify sha256sum for multiple file or one file.

2015-10-30 1 min read bash Linux
So, lets say you have downloaded the SHA256SUMS files. This file contains the sha256sum for multiple files and you want to compare the values for only one or some of them, then the simplest thing you can do is: sha256sum -c SHA256SUMS Now, with this if you do not have some files present then you might get some errors and if you do not want that, then you can try this: Continue reading
Older posts Newer posts