Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - hakerdefo

Pages: [1] 2 3 4
1
I've Got a Life / A rock music question to my American friends
« on: June 09, 2017, 07:14:12 PM »
Recently I introduced a friend to the world of classic rock music. For someone who is born in the mid nineties, Hip-Hop naturally is what he has been listening to and is familiar with. Classic rock and it's artists are a new thing for him. Yesterday he asked me a question and honestly I didn't have any answer to it! He asked me why U.S., the birth place of Rock-n-Roll, failed to produce what can be called the biggest band in the world? The Beatles, The Rolling Stones, Led Zeppelin, Pink Floyd, Queen were/are British, AC/DC are from the land down-under and U2 are from Ireland.
There have been great bands from U.S. like The Allman Brothers band, Aerosmith, The Beach boys, The CCR, The Doors, The Eagles, The Jimi Hendrix experience, R.E.M and many many others. But apart from R.E.M in the early nineties (when they rivaled U2 for the title of biggest band in the world), none of the other American band could have claimed to be the biggest band in the world! Why is that?
Cheers!!!

2
From version 0.128 of initramfs-tools, the boot code waits for a suspend/resume device to appear, rather than checking just once. If the configured or automatically selected resume device is not available at boot time, this results in a roughly 30 second delay. Solution? It's easy  8)
Open "/etc/initramfs-tools/initramfs.conf" file in text-editor as root and add the following line to it,

Code: [Select]
RESUME=none

Save the file. Next run the following command in terminal-emulator,

Code: [Select]
sudo update-initramfs -u -k all

Voila! Boot delay is gone  8)

Cheers!!!

3
Scripts / sl - A better ls
« on: March 27, 2017, 06:22:35 PM »
We being the terminal junkies use cli environment as much as possible and 'ls' is one of the essential tool we use to list files and directories.
Now here comes 'sl'. I call it a better ls. It's a simple script so nothing to install. Just Download sl and save it somewhere in your $PATH. Also Download sl.tcl, a sample configuration file, and save it with the name '.sl.tcl' in your $HOME directory.

To view the hidden files you'll need to add the following line to the config file '.sl.tcl'
Code: [Select]
set SWITCH(ignore) 1

And yes 'sl' has a single dependency that you can easily install like this,

Code: [Select]
sudo apt-get install tcl

That's it! Next time you want to use 'ls' just do 'sl' and I'm confident you'll love it  8)

The original intent of this post is to serve as the place-holder of this wonderful script as the original website is gone!

Cheers!!!

4
How To's / How to easily and quickly change directories in terminal
« on: March 25, 2017, 08:48:55 PM »
Okay, most of us spent quite a bit of time in a terminal window, right?
Now navigating between directories in terminal can be cumbersome sometimes.

For example you want to navigate to the "Terminator" directory,
Code: [Select]
~/Downloads/Videos/Movies/Action/Terminator/
You will have to enter,
Code: [Select]
cd Downloads/Videos/Movies/Action/Terminator/

I know you can use Tab-completion but even with it you'll agree there are plenty of key-presses involved here.

Okay, now assume you are in the "Terminator" directory and you want to go back to the "Videos" directory. You'll have to do,
Code: [Select]
cd "../ ../"

See, it's cumbersome! Here is the easiest and smartest method to change directories in terminal.

First we need to install a tiny application,
Code: [Select]
sudo apt-get install go2

After the installation has completed, in your terminal run,
Code: [Select]
go2; source $HOME/.bashrc

That's it! Now you can navigate to "Terminator" directory easily like this,
Code: [Select]
go2 Terminator

Or if you are in a hurry,
Code: [Select]
Go2 Term

And from "Terminator" directory going back to the "Videos" directory is just as easy,
Code: [Select]
go2 Videos

If in hurry,
Code: [Select]
go2 Vid

Now if you have two directories "Downloads" and "Documents" and you do,
Code: [Select]
go2 Do
go2 will prompt you to select one of them,
Code: [Select]
a: ~/Documents
b: ~/Downloads
If you want to select "Documents" you need to enter "a" and for selecting "Downloads" you enter "b". Simple!!!

For more info,
Code: [Select]
man go2

Cheers!!!

5
Okay here is something for those of you who hates internet ads and at the same time are not big fans of add-ons and  extensions.
This is a complete rewrite of one of my earlier ad-block script.

Save pmiab somewhere in your $PATH with 755 permission and run it with sudo permissions.

Code: [Select]
sudo pmiab

And select following from the menu,
Code: [Select]
Block Internet Adverts

You can easily disable ad-blocking (also read replace the original hosts) by selecting,
Code: [Select]
Unblock Internet Adverts

If a browser is open then clear its cache and restart it. Enjoy the internet on any and every browser without those irritating ads  8)

Code: [Select]
#!/usr/bin/env bash
########
function byye (){
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "One man's advertising is another man's malware"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  tput sgr0
  printf "\033c"
  exit 0
}
########
function pm_unblock (){
  pmcp=$(which cp)
  pmrm=$(which rm)
  if [ ! -f /etc/hosts-block ]; then
    printf "\033c"
    echo ""
    { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
    echo ""
    echo -e '\e[38;5;82m' "Ad-blocking hosts not in use! Nothing to unblock!"
    echo ""
    { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
    echo ""
    echo ""
    read -r -s -p $'Press Any Key To Return To Main Menu...\n' -n1
    starrt
  fi
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Replacing the original hosts file..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  "$pmcp" /etc/hosts-system /etc/hosts
  chmod 644 /etc/hosts
  "$pmrm" -f /etc/hosts-system
  "$pmrm" -f /etc/hosts-block
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "All done!!! Original system hosts file restored!!!"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo ""
  read -r -s -p $'Press Any Key To Return To Main Menu...\n' -n1
  starrt
}
########
function pm_block (){
  pmcp=$(which cp)
  hosts_cooking=$(mktemp)
  hosts_cooked=$(mktemp)
  datum=$(date +%d-%m-%Y:%H:%M:%S)
  pmrm=$(which rm)
  if [ ! -f /etc/hosts-system ]; then
    "$pmcp" /etc/hosts /etc/hosts-system
    chmod 444 /etc/hosts-system
  fi
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Downloading ad-blocking hosts files..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  wget -nv -O - "http://winhelp2002.mvps.org/hosts.txt" >> "$hosts_cooking" || { "$pmrm" -f "$hosts_cooking"; "$pmrm" -f "$hosts_cooked"; printf "\033c"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; echo -e '\e[38;5;82m' "OOPS!! Failed to download \"mvps\" hosts file!!"; echo -e '\e[38;5;82m' "Make sure your internet connection is active!"; echo -e '\e[38;5;82m' "If the problem persists you can report it at,"; echo -e '\e[38;5;82m' "GitHub repository of the project by creating,"; echo -e '\e[38;5;82m' "an issue there. Here is the link to the repo,"; echo ""; echo -e '\e[38;5;82m' "https://github.com/hakerdefo/pmiab"; echo ""; echo -e '\e[38;5;82m' "If you don't use GitHub you can report it by,"; echo -e '\e[38;5;82m' "emailing the author at the following address,"; echo ""; echo -e '\e[38;5;82m' "hakerdefo (at) gmail (dot) com"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; tput sgr0; exit 1; }
  wget -nv -O - "http://hosts-file.net/ad_servers.asp" >> "$hosts_cooking" || { "$pmrm" -f "$hosts_cooking"; "$pmrm" -f "$hosts_cooked"; printf "\033c"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; echo -e '\e[38;5;82m' "OOPS!! Failed to download \"hpHo\" hosts file!!"; echo -e '\e[38;5;82m' "Make sure your internet connection is active!"; echo -e '\e[38;5;82m' "If the problem persists you can report it at,"; echo -e '\e[38;5;82m' "GitHub repository of the project by creating,"; echo -e '\e[38;5;82m' "an issue there. Here is the link to the repo,"; echo ""; echo -e '\e[38;5;82m' "https://github.com/hakerdefo/pmiab"; echo ""; echo -e '\e[38;5;82m' "If you don't use GitHub you can report it by,"; echo -e '\e[38;5;82m' "emailing the author at the following address,"; echo ""; echo -e '\e[38;5;82m' "hakerdefo (at) gmail (dot) com"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; tput sgr0; exit 1; }
  wget -nv -O - "http://someonewhocares.org/hosts/hosts" >> "$hosts_cooking" || { "$pmrm" -f "$hosts_cooking"; "$pmrm" -f "$hosts_cooked"; printf "\033c"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; echo -e '\e[38;5;82m' "OOPS!! Failed to download \"sowc\" hosts file!!"; echo -e '\e[38;5;82m' "Make sure your internet connection is active!"; echo -e '\e[38;5;82m' "If the problem persists you can report it at,"; echo -e '\e[38;5;82m' "GitHub repository of the project by creating,"; echo -e '\e[38;5;82m' "an issue there. Here is the link to the repo,"; echo ""; echo -e '\e[38;5;82m' "https://github.com/hakerdefo/pmiab"; echo ""; echo -e '\e[38;5;82m' "If you don't use GitHub you can report it by,"; echo -e '\e[38;5;82m' "emailing the author at the following address,"; echo ""; echo -e '\e[38;5;82m' "hakerdefo (at) gmail (dot) com"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; tput sgr0; exit 1; }
  wget -nv -O - "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext" >> "$hosts_cooking" || { "$pmrm" -f "$hosts_cooking"; "$pmrm" -f "$hosts_cooked"; printf "\033c"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; echo -e '\e[38;5;82m' "OOPS!! Failed to download \"yoyo\" hosts file!!"; echo -e '\e[38;5;82m' "Make sure your internet connection is active!"; echo -e '\e[38;5;82m' "If the problem persists you can report it at,"; echo -e '\e[38;5;82m' "GitHub repository of the project by creating,"; echo -e '\e[38;5;82m' "an issue there. Here is the link to the repo,"; echo ""; echo -e '\e[38;5;82m' "https://github.com/hakerdefo/pmiab"; echo ""; echo -e '\e[38;5;82m' "If you don't use GitHub you can report it by,"; echo -e '\e[38;5;82m' "emailing the author at the following address,"; echo ""; echo -e '\e[38;5;82m' "hakerdefo (at) gmail (dot) com"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; tput sgr0; exit 1; }
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Parsing, Cleaning, De-Duplicating, Sorting..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  sed -e 's/\r//' -e '/^127.0.0.1/!d' -e '/localhost/d' -e 's/127.0.0.1/0.0.0.0/' -e 's/ \+/\t/' -e 's/#.*$//' -e 's/[ \t]*$//' < "$hosts_cooking" | sort -u > "$hosts_cooked"
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Merging ad-blocking hosts with original system hosts..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  echo -e "\n# Ad blocking list generated on $datum" | cat /etc/hosts-system - "$hosts_cooked" > /etc/hosts-block
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Doing some clean-up..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  "$pmrm" -f "$hosts_cooking"
  "$pmrm" -f "$hosts_cooked"
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Installing pmiab generated hosts file..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  "$pmcp" /etc/hosts-block /etc/hosts
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "All done!!! Enjoy the internet without those pesky adverts!!!"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo ""
  read -r -s -p $'Press Any Key To Return To Main Menu\n' -n1
  starrt
}
########
function pm_netchk (){
  wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "www.google.com" -O /dev/null
  RETVAL=$?
  case "$RETVAL" in
    0)
      pm_block
      ;;
    *)
      printf "\033c"
      echo ""
      { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
      echo ""
      echo -e '\e[38;5;82m' "No active internet connection available!!"
      echo -e '\e[38;5;82m' "Please check your internet connectivity!!"
      echo -e '\e[38;5;82m' "Active internet connection is required to"
      echo -e '\e[38;5;82m' "download necessary adblocking hosts files"
      echo ""
      echo ""
      read -r -s -p $'Press Any Key To Return To Main Menu\n' -n1
      starrt
      ;;
  esac
}
########
function starrt (){
  if [ "$EUID" -ne 0 ]; then
    printf "\033c"
    echo ""
    { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
    echo ""
    echo -e '\e[38;5;82m' "You must run \"pmiab\" script using \"sudo\" or as the root user."
    echo -e '\e[38;5;82m' "Hint : \"sudo pmiab\" or \"su -c 'pmiab'\""
    echo ""
    { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
    echo ""
    tput sgr0
    exit 1
  fi
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "pmiab - (Poor Man's Internet Ad Blocker) blocks ads system-wide"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo ""
  echo -e '\e[38;5;82m' "01 Block Internet Adverts"
  echo -e '\e[38;5;82m' "02 Unblock Internet Adverts"
  echo -e '\e[38;5;82m' "03 Quit pmiab"
  echo -e ""
  echo -e ""
  echo -e '\e[38;5;82m' "Enter Your Choice: "
  echo -e ""
  read -r Choice
  case $Choice in
    01 | 1)
      pm_netchk
      ;;
    02 | 2)
      pm_unblock
      ;;
    03 | 3)
      byye
      ;;
    *)
      printf "\033c"
      echo -e ""
      echo -e ""
      echo -e '\e[38;5;82m' "\"$Choice\" Is An Invalid Option!"
      echo -e ""
      echo -e '\e[38;5;82m' "Correct Options To Choose From Are 1-2-3"
      echo -e ""
      echo -e '\e[38;5;82m' "To block internet adverts press \"1\" & hit \"Enter\" key"
      echo -e '\e[38;5;82m' "To restore original hosts press \"2\" & hit \"Enter\" key"
      echo -e '\e[38;5;82m' "To exit from pmiab script press \"3\" & hit \"Enter\" key"
      echo -e '\e[38;5;82m' "Got It?!? Ready To Give It Another Go?!?"
      echo -e ""
      read -r -s -p $'Press Any Key To Try Again...\n' -n1
      starrt
      ;;
  esac
}
########
while :
do
  starrt
done


Cheers!!!

6
Do you have an account at 'the Linux forum with grill, bacon & barbecue'?
Are you planning to join 'the Linux forum with grill, bacon & barbecue'?

If no then you don't know how lucky you are  ;)

If yes then here is a tip that will prevent you from getting banned at 'the Linux forum with grill, bacon & barbecue',

Don't you ever point out a mistake made by the administrator of 'the Linux forum with grill, bacon & barbecue'!
Even if S/He has made an obvious mistake!


Sounds incredulous?!?
Sounds ridiculous?!?
Sounds unbelievable?!?
Want some credit for the above claim?

Okay, here is what transpired at 'the Linux forum with grill, bacon & barbecue' on 19-03-2017.
The leader and administrator of 'the Linux forum with grill, bacon & barbecue' posted a bash script to play internet radio streams.
The script had this variable,
Code: [Select]
PARAMS="-c -b $BUFFER"

The above parameters were for mpg123.
I pointed out that the "-c" option in mpg123 checks and reports instances of clipping. It does not enable terminal control keys. The correct option to enable terminal control keys in mpg123 is "-C".

The next day when I tried to log-in to my account at 'the Linux forum with grill, bacon & barbecue' I was greeted with the message that I was banned from 'the Linux forum with grill, bacon & barbecue'.

My whole conversation with The leader and administrator of 'the Linux forum with grill, bacon & barbecue'  in the above mentioned topic was deleted and the script there has since been edited and corrected.

And The leader and administrator of 'the Linux forum with grill, bacon & barbecue' also added the following farewell message in the script for me. It reads like this,
Code: [Select]
## for mr-know-all:
# BUFFER=3000
# PLAYER="mpg123" # you can try with streamripper, mplayer, vlc, ...
# PARAMS="--silent-whore --shut-the-fuck-up-smoothly --asshole-on-fire  -b $BUFFER" # depends on the $PLAYER, make *your* choices and stop fucking discussing what whoreface parameters you suggest

So if you are a member or you are planning to join 'the Linux forum with grill, bacon & barbecue',

YOU HAVE BEEN WARNED

Cheers!!!

7
I've Got a Life / Ain't nothing like $HOME
« on: March 19, 2017, 07:51:19 PM »
Been away for over a month from the forums and how I missed it  :(
VSIDO members are like an extended family to me and in families, at times, there are disagreements. I took one of those disagreement to the heart and decided to stay away from here  :(
I joined another forum and it turned out to be a horrible experience to say the least  :(
And yesterday, that forum thankfully ended the horror-show by banning me  :D
I want to thank them for banning me cause otherwise it would have meant some extra time before coming back to THE HOME.
Ain't nothing like this place! It's true!

Cheers!!!

8
Scripts / vsido-exit (systemd based logout script for VSIDO)
« on: January 29, 2017, 01:37:09 PM »

Edit Begins - 10-02-2017

Development continues on GitHub. For always up-to-date version of this (now known as lepo-logout) visit the GitHub page,

lepo-logout on GitHub

Cheers!!!

Edit Ends - 10-02-2017


First VSIDO's default "~/.fluxbox/init" will need a slight modification,
Open it,
Code: [Select]
medit ~/.fluxbox/init

And change the following line,
Code: [Select]
session.screen0.allowRemoteActions: false

To,
Code: [Select]
session.screen0.allowRemoteActions: true

Save the file. Logout and login or restart fluxbox.

Add an extra package if it's not installed,
Code: [Select]
sudo apt-get install hicolor-icon-theme

Next Download the attached exit-vsido.tar.gz archive. Extract the contents of archive into a directory and open that directory in terminal-emulator and run the following commands,
Code: [Select]
sudo cp vsido-exit /usr/local/bin/
Code: [Select]
sudo chmod 755 /usr/local/bin/vsido-exit
Code: [Select]
sudo cp logout_exit.png logout_logo.png logout_reboot.png logout_shutdown.png logout_suspend.png logout_window.png /usr/share/pixmaps/

Add a menu entry for vsido-exit. Test it  :)

Cheers!!!

9
Scripts / pmpm - Making Password Management Easy & Secure (V2)
« on: January 17, 2017, 06:25:19 PM »
What can pmpm do?
1) Stateless management of accounts-passwords. Nothing is stored anywhere.
2) Manage accounts-passwords traditionally by saving them in an encrypted master-password protected file.
3) Generate true random passwords.
4) Generate pseudo random passwords.
5) Check password quality.

All of the above via a simple bash script!
Sounds interesting? Stay tuned, Coming very soon ;)

10
VSIDO News & Announcements / VSIDO Build Discussions
« on: January 16, 2017, 11:07:27 AM »
I'm sure you would have written about it somewhere but it would be great if you can share with us the build process of VSIDO. Like how do you start, from Debian netinstall or by some other method and other info.
Cheers!!!

11
Scripts / bash-me-up (Bash Startup Files Setup Made Easy)
« on: January 07, 2017, 07:15:15 PM »
The Bash shell uses a collection of startup files to create an environment. The already difficult task of setting up these files correctly is made painful by lack of clear documentation and different behavior of display managers and/or desktop environments. I'm planning on creating a script that should make this task easy. Something to kill time on Sunday  ;)
Stay Tuned  ;)

Cheers!!!

12
Scripts / pmss (Poor Man's Screenshooter)
« on: December 11, 2016, 09:15:24 PM »

20-03-2017 UPDATE BEGINS

V4 at your service. Grab it from here,

pmss V4

Cheers!!!

20-03-2017 UPDATE ENDS



CHRISTMAS UPDATE BEGINS

Version 3 of pmss is here,

http://vsido.org/index.php?topic=1237.msg14041#msg14041

Cheers & Merry Christmas To You All  :)

CHRISTMAS UPDATE ENDS



UPDATE BEGINS

A new and improved version of pmss can be found here,

http://vsido.org/index.php?topic=1237.msg13959#msg13959

Cheers!!!

UPDATE ENDS


It is what the title says  :D
I'm in a bit of a hurry so description & detail will follow a bit later  ;)
Try it! It has a very good upload function that can make sharing scrrenshots easy-peasy  8)

Code: [Select]
#!/usr/bin/env bash

function bye_bye (){
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"A screenshot is an image of the display on a computer screen."
echo -e '\E[1;32;49m'"But you already knew that so,"
echo -e '\E[1;32;49m'"Bye, Ciao, Adios."
echo -e ""
sleep 4
printf "\033c"
tput sgr0
exit 0
}

function imgur_upload (){
type curl >/dev/null 2>&1
RETVAL=$?
if [[ ! "$RETVAL" == 0 ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"pmss requires \"cURL\" to upload to imgur."
echo -e '\E[1;32;49m'"Install \"curl\" via your package-manager."
echo -e ""
fi
printf "\033c"
response=$(curl -s --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" -H "Authorization: Client-ID $client_id" -H "Expect: " -F "image=@$NAME" https://api.imgur.com/3/image.xml 2>/dev/null)
RETVAL=$?
if [[ ! "$RETVAL" == 0 ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"pmss cannot connect to \"imgur\"."
echo -e '\E[1;32;49m'"Check your internet connection."
echo -e ""
tput sgr0
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
else
URL3="${response##*<link>}"
URL2="${URL3%%</link>*}"
URL=$(echo "$URL2" 2>/dev/null | sed 's/^http:/https:/')
BASE_URL="${URL%.*}"
BASE_EXT="${URL##*.}"
DEL_HASH2="${response##*<deletehash>}"
DEL_HASH="${DEL_HASH2%%</deletehash>*}"
DEL_URL="https://imgur.com/delete/$DEL_HASH"
printf "\033c"
echo -e '\E[1;32;49m'"DIRECT LINK"
echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"$URL"
echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'""$BASE_URL"m."$BASE_EXT""
echo -e ""
echo -e '\E[1;32;49m'"BBCODE (FORUMS, MESSAGE BOARDS, ETC.)"
echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"[img]$URL[/img]"
echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"[url=$BASE_URL][img]"$BASE_URL"m."$BASE_EXT"[/img][/url]"
echo -e ""
echo -e '\E[1;32;49m'"MARKDOWN (REDDIT, GITHUB, ETC.)"
echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"[$SHORT_NAME]($URL)"
echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"[$SHORT_NAME]("$BASE_URL"m."$BASE_EXT")"
echo -e ""
echo -e '\E[1;32;49m'"HTML (WEBSITES, BLOGS, ETC.)"
echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"<a href="$BASE_URL"><img src="$URL" title="source: imgur.com" /></a>"
echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"<a href="$BASE_URL"><img src=""$BASE_URL"m."$BASE_EXT"" title="source: imgur.com" /></a>"
echo -e ""
echo -e '\E[1;32;49m'"IMAGE DELETE LINK"
echo -e '\E[1;32;49m'"Delete url: "'\E[0;32;49m'"$DEL_URL"
echo -e ""
tput sgr0
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
fi
}

function area_mouse (){
printf "\033c"
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
echo -e ""
echo -e '\E[1;32;49m'"Draw A Rectangle On The Screen And Area Inside It Will Be Captured.."
echo -e ""
scrot -s "${NAME}"
printf "\033c"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved in "'\E[0;32;49m'"$DIR"
echo -e ""
type xdg-open >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xdg-open "${NAME}"
else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"pmss unable to open saved shot."
echo -e '\E[1;32;49m'"Install \"xdg-utils\" to do this."
echo -e ""
fi
echo -e ""
echo -e '\E[1;32;49m'"Would you like to upload the shot to imgur?"
echo -e ""
echo -e '\E[1;32;49m'"Press \"Y\" to upload the shot to imgur"
echo -e '\E[1;32;49m'"Press \"N\" to go back to the main menu"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"Y" | "y")
imgur_upload
;;
"N" | "n")
printf "\033c"
MenU
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
echo -e ""
echo -e '\E[1;32;49m'"To upload image to imgur, press \"Y\""
echo -e '\E[1;32;49m'"To go back the main menu, press \"N\""
echo -e '\E[1;32;49m'"Got it? It is not that hard you see"
echo -e ""
tput sgr0
read -r -s -p $'Press Any Key To Continue...\n' -n1
MenU
;;
esac
}

function window_focus (){
printf "\033c"
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
echo -e ""
echo -e '\E[1;32;49m'"Minimize Terminal And Bring The Window To Be Captured In Focus.."
echo -e ""
scrot -u -d10 -b -c "${NAME}"
printf "\033c"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved in "'\E[0;32;49m'"$DIR"
echo -e ""
type xdg-open >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xdg-open "${NAME}"
else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"pmss unable to open saved shot."
echo -e '\E[1;32;49m'"Install \"xdg-utils\" to do this."
echo -e ""
fi
echo -e ""
echo -e '\E[1;32;49m'"Would you like to upload the shot to imgur?"
echo -e ""
echo -e '\E[1;32;49m'"Press \"Y\" to upload the shot to imgur"
echo -e '\E[1;32;49m'"Press \"N\" to go back to the main menu"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"Y" | "y")
imgur_upload
;;
"N" | "n")
printf "\033c"
MenU
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
echo -e ""
echo -e '\E[1;32;49m'"To upload image to imgur, press \"Y\""
echo -e '\E[1;32;49m'"To go back the main menu, press \"N\""
echo -e '\E[1;32;49m'"Got it? It is not that hard you see"
echo -e ""
tput sgr0
read -r -s -p $'Press Any Key To Continue...\n' -n1
MenU
;;
esac
}

function entire_area (){
printf "\033c"
DATE="$(date +%d%m%y-%H%M%S)"
SHORT_NAME="Shot-${DATE}.png"
NAME="${DIR}/${SHORT_NAME}"
echo -e ""
echo -e '\E[1;32;49m'"Minimize Terminal To Avoid It From Being Captured.."
echo -e ""
scrot -d10 -c "${NAME}"
printf "\033c"
echo -e ""
echo -e '\E[0;32;49m'"$SHORT_NAME"'\E[1;32;49m'" Saved in "'\E[0;32;49m'"$DIR"
echo -e ""
type xdg-open >/dev/null 2>&1
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
xdg-open "${NAME}"
else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"pmss unable to open saved shot."
echo -e '\E[1;32;49m'"Install \"xdg-utils\" to do this."
echo -e ""
fi
echo -e ""
echo -e '\E[1;32;49m'"Would you like to upload the shot to imgur?"
echo -e ""
echo -e '\E[1;32;49m'"Press \"Y\" to upload the shot to imgur"
echo -e '\E[1;32;49m'"Press \"N\" to go back to the main menu"
echo -e ""
echo -e '\E[1;32;49m'"Enter Your Choice: "
echo -e ""
tput sgr0
read -er Choice
case "$Choice" in
"Y" | "y")
imgur_upload
;;
"N" | "n")
printf "\033c"
MenU
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
echo -e ""
echo -e '\E[1;32;49m'"To upload image to imgur, press \"Y\""
echo -e '\E[1;32;49m'"To go back the main menu, press \"N\""
echo -e '\E[1;32;49m'"Got it? It is not that hard you see"
echo -e ""
tput sgr0
read -r -s -p $'Press Any Key To Continue...\n' -n1
MenU
;;
esac
}

function MenU (){
printf "\033c"
type scrot >/dev/null 2>&1 || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"A required pmss dependency \"Scrot\" is not present."; echo -e '\e[1;32;49m'"\"Scrot\" is available for almost all linux distros."; echo -e '\e[1;32;49m'"Please install \"scrot\" using your package manager."; echo -e ""; tput sgr0; exit 1; }
DIR="${HOME}/Pictures/Screenshots"
if [ ! -d "${DIR}" ]; then mkdir --parents "${DIR}"; fi
client_id="af2f809b77dea2c"
echo -e '\E[1;32;49m'"** PMSS<>MENU *************************************************"
echo -e ""
echo -e ""
echo -e '\E[1;32;49m'"** Select One Of The Following Options"
echo -e ""
echo -e '\E[1;32;49m'"** Enter \"E\" To Take The Screenshot Of The Entire Screen"
echo -e '\E[1;32;49m'"** Enter \"W\" To Take The Screenshot Of Window In Focus"
echo -e '\E[1;32;49m'"** Enter \"A\" To Take The Screenshot Of Area Selected By Mouse"
echo -e '\E[1;32;49m'"** Enter \"Q\" To Exit"
echo -e ""
echo -e '\E[1;32;49m'"***************************************************************"
echo -e ""
tput sgr0
read -er Options
case "$Options" in
"E" | "e")
entire_area
;;
"W" | "w")
window_focus
;;
"A" | "a")
area_mouse
;;
"Q" | "q")
bye_bye
;;
*)
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"\"$Options\" Is An Invalid Option!!!"
echo -e ""
echo -e '\E[1;32;49m'"Correct Options To Choose Are From E-W-A-Q"
echo -e ""
echo -e '\E[1;32;49m'"To Take The Screenshot Of The Entire Screen, Press \"E\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"To Take The Screenshot Of Window In Focus, Press \"W\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"To Take The Screenshot Of Area Selected By Mouse, Press \"A\" & Hit \"Enter\" Key"
echo -e '\E[1;32;49m'"To Exit From PMSS, Press \"Q\" & Hit \"Enter\" Key"
echo -e ""
tput sgr0
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
;;
esac
}
while :
do
MenU
done


Cheers!!!

13
Conky / conky - Gmail new email information (bash version)
« on: November 25, 2016, 04:04:18 PM »
As promised, ladies & gentlemen, here is a bash script to get new email info from your Gmail account for dislay in conky  8)

First we need to make sure that the script dependencies are installed,

Code: [Select]
sudo apt-get install xmlstarlet
sudo apt-get install curl
sudo apt-get install wget
sudo apt-get install coreutils

On VSIDO three of the above four should most likely be already installed  8)

Next open your favourite text-editor and copy the script,

Code: [Select]
#!/usr/bin/env bash
###the-script-begins###
###
type curl >/dev/null 2>&1 || { printf "\033c"; echo -e ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo -e ""; echo -e '\e[38;5;82m'"A required dependency \"cURL\" is unavailable"; echo -e '\e[38;5;82m'"\"cURL\" is available for almost all linux distros."; echo -e '\e[38;5;82m'"Please install \"curl\" using your package manager."; echo -e '\e[38;5;82m'"Please visit the homepage of \"cURL\" for more info"; echo -e '\e[38;5;82m'"https://curl.haxx.se/"; echo -e ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo -e ""; tput sgr0; exit 1; }
type wget >/dev/null 2>&1 || { printf "\033c"; echo -e ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo -e ""; echo -e '\e[38;5;82m'"A required dependency \"Wget\" is unavailable"; echo -e '\e[38;5;82m'"\"Wget\" is available for almost all linux distros."; echo -e '\e[38;5;82m'"Please install \"wget\" using your package manager."; echo -e '\e[38;5;82m'"Please visit the homepage of \"Wget\" for more info"; echo -e '\e[38;5;82m'"https://www.gnu.org/software/wget/"; echo -e ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo -e ""; tput sgr0; exit 1; }
type xmlstarlet >/dev/null 2>&1 || { printf "\033c"; echo -e ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo -e ""; echo -e '\e[38;5;82m'"A required dependency \"XMLStarlet\" is unavailable"; echo -e '\e[38;5;82m'"\"XMLStarlet\" is available for almost all linux distros."; echo -e '\e[38;5;82m'"Please install \"xmlstarlet\" using your package manager."; echo -e '\e[38;5;82m'"Please visit the homepage of \"XMLStarlet\" for more info"; echo -e '\e[38;5;82m'"http://xmlstar.sourceforge.net/"; echo -e ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo -e ""; tput sgr0; exit 1; }
wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "www.google.com" -O /dev/null
RETVAL=$?
if [[ ! "$RETVAL" == 0 ]]; then
echo -e ""
echo -e "Internet Connection Seems Down."
echo -e ""
exit
fi
local_user="gmail_username"
local_pass="gmail_password"
local_count="5"
local_rm=$(which rm)
curl --silent --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" "https://"$local_user":"$local_pass"@mail.google.com/mail/feed/atom" -o /tmp/cgmail.xml
grep "401" "/tmp/cgmail.xml"
RETVAL=$?
if [[ "$RETVAL" == 0 ]]; then
echo -e ""
echo -e "Incorrect username or password."
echo -e ""
"$local_rm" "/tmp/cgmail.xml"
exit
fi
mail_count=$(xmlstarlet sel -N x="http://purl.org/atom/ns#" -t -m '//x:feed' -v  x:fullcount -n /tmp/cgmail.xml)
if [[ "$local_count" == 0 ]]; then
echo -e ""
echo -e "$local_user :: No New Email."
echo -e ""
"$local_rm" "/tmp/cgmail.xml"
exit
fi
if (( "$local_count" < "$mail_count" )); then
final_count="$local_count"
else
final_count="$mail_count"
fi
local_subject=$(cat "/tmp/cgmail.xml" | xmlstarlet sel -N x="http://purl.org/atom/ns#" -t -m "//x:entry[position()<=$final_count]" -v x:title -n)
mail_date=$(cat "/tmp/cgmail.xml" | xmlstarlet sel -N x="http://purl.org/atom/ns#" -t -m "//x:entry[position()<=$final_count]" -v x:issued -n)
local_date=$(while IFS= read -r line ; do date -d"$line" +%y-%m-%d ; done <<< "$mail_date")
echo -e ""
echo -e "$local_user :: \"$mail_count\" New Emails."
echo -e ""
pr -m -t <(echo "$local_date") <(echo "$local_subject")
echo -e ""
"$local_rm" "/tmp/cgmail.xml"
exit 0
###
###the-script-ends###


Go to the line 15-16 in the script and change "gmail_username" &  "gmail_password" to reflect your Google account credentials,

Code: [Select]
local_user="gmail_username"
local_pass="gmail_password"

The script by default prints info of the "5" newest emails. You can change this number on line 17 to display as many new emails as you wish,

Code: [Select]
local_count="5"

Save the script somewhere in your $PATH with the name "check-gmail" and give it execute permissions,

Code: [Select]
chmod 755 /path/to/check-gmail

And finally add following line in your ".conkyrc" to call the script from conky,

Code: [Select]
execi 600 bash /path/to/check-gmail

Of-course "/path/to/check-gmail" above will have to be replaced with the actual path of the script.

It is very easy to colorize the output of the script. Look for the "echo" commands in the script and adjust them to print the output in your favourite colors. If you need any help regarding this script don't hesitate to post your query here  :)

Cheers!!!

14
Conky / conky - Gmail new email information (perl version 1)
« on: November 19, 2016, 07:34:55 PM »
After fiddling with snakes (read Python) & gem hunting (read Ruby), finally I have found the pearl of wisdom to wash away the conky blues  :D

First install these script dependencies,

Code: [Select]
sudo apt-get install perl
sudo apt-get install libxml-simple-perl
sudo apt-get install libwww-perl

Next copy-paste following code in your text-editor,

Code: [Select]
#!/usr/bin/perl
use strict;
use XML::Simple;
use LWP::Simple;
my $u = $ARGV[0];
my $p = $ARGV[1];
my $xmldata = get("https://$u:$p\@mail.google.com/mail/feed/atom");
my $xml = new XML::Simple;
my $data = $xml->XMLin($xmldata);
my @arr = reverse sort keys %{$data->{'entry'}};
if (@arr != 0 ) {
print "[$u] :: New mails ". @arr ."\n";
my $n = 3;
$n = @arr if @arr < 3;
for(my $i = 0; $i < $n; $i++) {
    my $title = substr $data->{'entry'}->{$arr[$i]}->{'title'}, 0, 45;
    my $frm = substr $data->{'entry'}->{$arr[$i]}->{'author'}->{'name'}, 0, 30;
    my $dt = substr  $data->{'entry'}->{$arr[$i]}->{'modified'}, 0, 10;
    print "\n";
    print "From: $frm, Date: $dt\n";
    print "$title\n";
}
    print "\n";
} else {
    print "No new mail..\n";
}
exit 0;


Now by default this script will show the last three (3) unread mails. If you want to change this number, edit the following line in the script (line number 13),

Code: [Select]
my $n = 3;

Save the script with the name 'check-gmail.pl' somewhere in your $PATH and give it execute permissions,

Code: [Select]
chmod 755 /path/to/check-gmail.pl

Next open your .conkyrc in text-editor and add following line to call 'check-gmail.pl' via conky,

Code: [Select]
execi 600 perl /path/to/check-gmail.pl "your_gmail_username" "your_gmail_password"

Of-course you will need to replace "your_gmail_username" and "your_gmail_password" above with your Google username and password.

Tested-Okay & Satisfaction-Guaranteed 8)

In a bit of a hurry at the moment so no scrot as a proof-of-the-pudding  :D

Cheers!!!

15
VSIDO News & Announcements / Possible directory structure change in Debian
« on: November 17, 2016, 07:21:50 AM »
Most likely from Debian Stretch release onwards /bin, /sbin and /lib* will be symlinked to their counterpart in /usr.

More info here,

https://lists.debian.org/debian-devel/2016/09/msg00269.html

Cheers!!!

Pages: [1] 2 3 4