Pygmentize Styles

2020-07-26 1 min read Learning
I have recently started using pygmentize for looking at my code in terminal. A very good and native way to do this is to use pygmentize. If you do not know about pygmentize then Highlight the input file and write the result to . If no input file is given, use stdin, if -o is not given, use stdout. So, you can simply pass the script or source code through pygmentize and get a lovely color output with code highlighting in the terminal and this can be very useful. Continue reading

Get to your ebooks quickly

2018-11-12 2 min read Linux Uncategorized
So this is going to be a little longer post than usual. To begin with, here is screenshot of how it would look like finally: We are using “rofi” here to show the menu. So, lets first install that cat <<EOF >/etc/yum.repos.d/_copr_yaroslav-i3desktop.repo [yaroslav-i3desktop] name=Copr repo for i3desktop owned by yaroslav baseurl=$releasever-$basearch/ type=rpm-md skip_if_unavailable=True gpgcheck=1 gpgkey= repo_gpgcheck=0 enabled=1 EOF yum install rofi Once that is done, we will create a small script to look for all our pdf files and display that in the menu, like above. 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

image ordering by Original Date Time using bash script

2016-01-05 1 min read bash
Here is the script: #!/bin/bash - #=============================================================================== # # FILE: # # USAGE: ./ # # 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

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

Get count of lines in scripts (shell)

2015-10-15 1 min read bash
If you have tried to get the count of lines in file, the you would know about “nl” or “wc -l”. But as you are aware these give you number of lines with other details as well and you need to post process the number to make sure that you have only number and nothing else. In such cases, it is useful to use the count feature of grep and here is a shorthand to get the count of lines in any shell script: Continue reading
Older posts