Get to your ebooks quickly

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=https://copr-be.cloud.fedoraproject.org/results/yaroslav/i3desktop/fedora-$releasever-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/yaroslav/i3desktop/pubkey.gpg
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. Save this as ~/bin/books-search.sh :
 
#!/usr/bin/env bash
#
# wget 'https://raw.githubusercontent.com/miroslavvidovic/rofi-scripts/master/books-search/books-search.sh'

# -----------------------------------------------------------------------------
# Info:
#   author:    Miroslav Vidovic
#   file:      books-search.sh
#   created:   13.08.2017.-08:06:54
#   revision:  ---
#   version:   1.0
# -----------------------------------------------------------------------------
# Requirements:
#   rofi
# Description:
#   Use rofi to search my books.
# Usage:
#   books-search.sh
# -----------------------------------------------------------------------------
# Script:
# Modified by Amit Agarwal

# Books directory
BOOKS_DIR=/usr/share/texlive/texmf-dist/doc/

# Save find result to F_ARRAY
readarray -t F_ARRAY <<< "$(find "$BOOKS_DIR" -type f -name '*.pdf')"

# Associative array for storing books
# key => book name
# value => absolute path to the file
# BOOKS['filename']='path'
declare -A BOOKS

# Add elements to BOOKS array
get_books() {
    for i in "${!F_ARRAY[@]}"
    do
        path=${F_ARRAY[$i]}
        file=$(basename "${F_ARRAY[$i]}")
        BOOKS+=(["$file"]="$path")
    done
}

# List for rofi
gen_list(){
    for i in "${!BOOKS[@]}"
    do
      echo "$i"
    done
}

main() {
  get_books
  #
 book=$( (gen_list) | rofi -dmenu -lines 10 -width 100 -i -matching 
fuzzy -only-match -location 0 -fake-transparency -p "Book > " )
  book=$( (gen_list) | rofi -dmenu -i -matching fuzzy -only-match -p "Book > " )
  xdg-open "${BOOKS[$book]}"
}

main
exit 0
In the above script, change the BOOKS_DIR to the one that you would like to see. And finally make some cosmetic changes:
cat <<EOF >~/.Xresources 
rofi.color-enabled: true
rofi.opacity:                        50
rofi.width:                          100
rofi.lines:                          10
rofi.columns:                        4
rofi.font:                           System San Francisco Display 8
rofi.color-normal:                   #fdf6e3,#002b36,#eee8d5,#586e75,#eee8d5
rofi.color-urgent:                   #fdf6e3,#dc322f,#eee8d5,#dc322f,#fdf6e3
rofi.color-active:                   #fdf6e3,#268bd2,#eee8d5,#268bd2,#fdf6e3
rofi.color-window:                   #fdf6e3,#002b36
rofi.yoffset:                        0
rofi.xoffset:                        0
rofi.fixed-num-lines:                false
rofi.terminal:                       rofi-sensible-terminal
rofi.ssh-client:                     ssh
rofi.ssh-command:                    {terminal} -e {ssh-client} {host}
rofi.run-command:                    {cmd}
rofi.run-list-command:               
rofi.run-shell-command:              {terminal} -e {cmd}
rofi.window-command:                 xkill -id {window}
rofi.disable-history:                false
rofi.levenshtein-sort:               false
rofi.case-sensitive:                 false
rofi.cycle:                          true
rofi.sidebar-mode:                   false
rofi.auto-select:                    false
rofi.parse-hosts:                    true
rofi.parse-known-hosts:              true
rofi.combi-modi:                     window,run
rofi.fuzzy:                          true
rofi.glob:                           false
rofi.regex:                          false
rofi.tokenize:                       true
rofi.m:                              -1
rofi.line-margin:                    2
rofi.filter:                         
rofi.separator-style:                dash
rofi.hide-scrollbar:                 false
rofi.fullscreen:                     false
rofi.fake-transparency:              true
rofi.dpi:                            -1
rofi.threads:                        1
rofi.scrollbar-width:                8
rofi.scroll-method:                  0
rofi.fake-background:                screenshot
rofi.display-ssh:                    
rofi.display-run:                    
rofi.display-drun:                   
rofi.display-combi:
EOF


xrdb -merge ~/.Xresources
Finally for easy access, you might want to bind a key to lauch the script that we created and voila.

image viewer tools

These are some of the image viewers that I know, pick your choice 🙂


1
sudo yum install imageinfo.i686 gtkimageview.i686 imagej.noarch gimmage.i686 gpicview.i386 gthumb.i686 immix.i686 mirage.i686 pony.noarch viewnior.i686 fotoxx.i686

rats – source code analysis

I stublemed across this recently so thought of sharing this for you 🙂

sudo yum install rats

And some details about rats

RATS(Rough Auditing Tool for Security) scans through code, finding potentially
dangerous function calls. The goal of this tool is not to definitively find
bugs (yet). The current goal is to provide a reasonable starting point for
performing manual security audits.
The initial vulnerability database is taken directly from things that could be
easily found when starting with the forthcoming book, "Building Secure
Software" by Viega and McGraw.