Saturday, May 14, 2016

Adding Google Drive to my Linux Box

GRIVE Installation and scripting

I have been digging around to see if there is a Google Drive service available for my Linux box.  I preferred to have something like what I have on the high end laptop (windows 10) in that it looks like a drive and I can manipulate the files in any way I want and updates GDRIVE immediately.  So far there is nothing like that in LINUX, but, there is a package called GRIVE.  I read up the documentation on the package and saw that it was something that I could use for now.  I installed the package, followed the instructions to link the app to my GMAIL account and then did a synchronize.  The first run took several minutes while it downloaded all of the files and folders, but, when I run again the synchronize took only a few seconds.  While this isn't perfect it does allow me to access my GDRIVE files, make updates and then sync the changes.

I always like to automate my tasks if I have to run it more than once.  For jobs scheduled on a regular basis I prefer CRONTAB, for things not on a regular schedule I prefer a folder with scripts or links to do the job.  For GRIVE I wrote two very simple BASH scripts to automate my synchronizing my GDRIVE files.  The first one displays to the user what will be done and give them the option to continue or quit.  The second calls the first from an XTERM window where I set up the font to a readable size.  I dropped a link to the second script to my desktop and ran it.  The script is very simple, possibly over-kill, but, I like to automate things so one click does the work for me.  I ran the script this morning as I had two new images (for this blog entry) and it synchronized my files in several seconds.  There is a lot more to the script that what you see, but, it is just setting up the color variables and getting the system time.  I don't need to use the time yet, but, it is part of my normal BASH skeleton script.

Screen shots

BASH script to sync to Google Drive using GRIVE

What the BASH script presents to me when run

Full BASH script to run GRIVE

#! /bin/sh
# ANSI Colors
#  Version:
#    - Version 1.0.0 2016/05/15
#    - Copyright 2016 Thomas Traynor.
#    - Program is distributed under the terms of the GNU General Public License
#    -       
#    - Release Notes:
#  Notes:
# ------------------------------------------------------------

zSetANSI() {

# Foreground colors:
    uFGBK="\033[30m";   #Black
    uFGLRD="\033[31m";  #Low  Red
    uFGHRD="\033[91m";  #High Red
    uFGLGR="\033[32m";  #Low  Green
    uFGHGR="\033[92m";  #High Green
    uFGLYW="\033[33m";  #Low  Yellow
    uFGHYW="\033[93m";  #High Yellow
    uFGLBU="\033[34m";  #Low  Blue
    uFGHBU="\033[94m";  #High Blue
    uFGLMG="\033[35m";  #Low  Magenta
    uFGHMG="\033[95m";  #High Magenta
    uFGLCY="\033[36m";  #Low  Cyan
    uFGHCY="\033[96m";  #High Cyan
    uFGHGY="\033[37m";  #High Gray
    uFGLGY="\033[90m";  #Low  Gray
    uFGWT="\033[97m";   #White

# Background colors:  
    uBGBK="\033[40m";   #Black
    uBGLRD="\033[41m";  #Low  Red
    uBGHRD="\033[101m"; #High Red
    uBGLGR="\033[42m";  #Low  Green
    uBGHGR="\033[102m"; #High Green
    uBGLYW="\033[43m";  #Low  Yellow
    uBGHYW="\033[103m"; #High Yellow
    uBGLBU="\033[44m";  #Low  Blue
    uBGHBU="\033[104m"; #High Blue
    uBGLMG="\033[45m";  #Low  Magenta
    uBGHMG="\033[105m"; #High Magenta
    uBGLCY="\033[46m";  #Low  Cyan
    uBGHCY="\033[106m"; #High Cyan
    uBGLGY="\033[47m";  #Low  Gray
    uBGHGY="\033[107m"; #High Gray

# Underline:
# Blink:
# Reset all:  

#  Get the system clock and set to a variable.

zGetDATE() {

# System date.  For all date options type date --h on command line.

    uSYSYY=$(date +%Y);
    uSYSMM=$(date +%m);
    uSYSDY=$(date +%d);
    uSYSHH=$(date +%H);
    uSYSMIN=$(date +%M);
    uSYSSEC=$(date +%S);
    uSYSJDT=$(date +%j);
    uSYSWK=$(date +%W);
    uSYSDOW=$(date +%w);
    uSYSDAY=$(date +%A)  
    uSYSMTH=$(date +%B)

# ============================================================
# ============================================================


# Define the working variable for return codes:

# Get current directory name
uDir=$( cd "$( dirname "$0" )" && pwd);


# Get process ID

#  Now echo out the stuff to the console:

echo ;
echo -e "${uFGHRD}Syncronize with Google Drive${uFGRESET}";
echo ;

cd ~/GoogleDrive

echo -e "${uFGLGR}This could take a while syncronizing the files."
echo -e "If you want to continue press ${uBGLGR}${uFGBLINK}${uFGBK}[ENTER]${uFGRESET}"
echo -e "${uFGLGR}otherwise ${uBGLGR}${uFGBLINK}${uFGBK}[CTRL-C]${uFGRESET}${uFGLGR}."
echo -e "${UFGRESET}"
read uLINE

echo ;
echo -e "${uFGHRD}Syncronize Finished${uFGRESET}";
echo -e "${uFGLGR}press ${uBGLGR}${uFGBLINK}${uFGBK}[ENTER]${uFGRESET}${uFGLGR} to finish update"
read uLINE

Wednesday, May 04, 2016

Touchpad on/off

Having the laptop touch-pad on when I have a mouse is a pain.  I dug through the system to see if there was a setting to turn it off when a mouse was connected, but, I couldn't find it.  I did the next best thing, I create two simple scripts.  One to turn it on and one to turn it off.  The command was synclient TouchPadOff=n where n is 1 for off and 0 for on.  I then created links to the main screen where I can quickly turn it on or off.  Yes, you can do it in one script, but, this was a quick and dirty solution and it works well enough for me.

Scripts for touchpad control

Link on desktop when I turn it on/off

A new midrange laptop for me and what I use for specific jobs

Some people may think that three laptops that I have are too many, but, I don't.  I have machines for specific tasks.  The netbook is an old machine that I bought years ago on sale and the HP is a refurbished model.  The Dell machine is the only new laptop and I bought it specifically for gaming and to store a lot of digital images.


I have the netbook set up with LUBUNTU.  That is great distro for a five year old netbook with 2 gigs of memory.  It allows me access to web mail, Facebook, Twitter and a few other things when I travel and it is very light and the battery lasts about 4-6 hours depending on what I am doing which is great when traveling.  If I am doing light digital editing it isn't to bad, a bit slow, but usable. 

HP Laptop

I picked up a nice mid-range laptop for my every day work at home.  It is a HP EliteBook 8440P.  Eight gigs of memory and one hundred and twenty-eight gig SSD.  I originally had LUBUNTU, but, something in how I did and configured caused the screen to go 'nuts' at times.  I put on PCLINUXOS and it has been rock solid.  This machine is my daily machine rather than my high end gaming system.  It allows ready access to social media (Facebook and Twitter), email and light gaming.  It also is used for digital editing and other daily work.

PCLINUXOS installed a lot of software I don't need and it was easy to remove them. I like the distro and I used it years ago and I see it has gotten better over time.  The desktop is KDE and it is close enough to Windows that anyone accustomed to Windows (up to 7) will be at home using it.  It is light enough on system resources that it is snappier than windows.  As an example this laptop launches in about thirty seconds (including the time for my to type in my password) and shuts down in about five seconds.  My gaming system takes about a minute to launch and about two minutes to shut down.

I am now playing Old School Runescape on the machine and it is as fast in a browser as when I am using my gaming system with the Runescape client software.


  • I transferred my various Bash scripts from the netbook here, but, I had to make minor tweaks due to the difference in terminals and the options used to compile Bash.  My next mini-project will be to look at the scripts and figure out how to rewrite them so that run on both systems without changes.
  • Set up and configure the Brother network printer.
  • Set up and configure the old scanner to work on this machine.
  • Install and configure additional software to play DVD movies.

Dell Gaming system

My high end machine is a Dell.  Right now it is running Windows 10.  I use this for heavy duty gaming and software that runs only on windows (income tax).  This machine has eight gigs of memory and a one terabyte drive.  This is my main machine for all of my digital photos and scanned documents.  Anything I do on the HP for digital images gets transferred here and once a month the files are backed up to an external one terabyte drive.

Sunday, May 01, 2016

Another campaign with virus/trojan laden emails

For the last couple of days I have been receiving a number of emails with file attachments.  They are from people I don't know and claiming I have unpaid invoices or they are coming from me with file attachments.  It doesn't matter, when I get email from unknown people with attachments I never open them.  When they are from me I know exactly every note I send myself and I don't open something I don't remember sending.  I checked a number of sites with the note information and found that they are full of nasty programs that will take over your computer.


  • If you get email with an attachment from someone you don't know never indulge your curiosity by reading the file, delete the email, empty the trash.
  • If you get email from someone you know, but, are not expecting contact them first and verify that they actually sent the email.  Don't use any links inside, use your own contact list.  If they didn't send it, delete immediately and empty the trash.
  • If you get email that claims to be you and you don't remember sending it, delete immediately and empty the trash.
My ISP flagged them as SPAM.

Example text of their claiming you owe them money.  Actually trojan laden attachment.

Double check your email address when registering anything

Looks like someone down in Florida bought a new cellphone.  How do I know?  As part of the registration they supplied an email address so they can get notifications, like their PIN number.  The problem is they used my account name and I got the notification of the cell phone number, plan information, PIN number, name, address.  I called Virgin Mobile USA and explained things and they started the process of trying to contact the customer, change the email address and lock the account from using my email account.  The person at the other end was very nice, professional and friendly and customer service is why I like Virgin Mobile.

This isn't the first time that something like this happened.  A couple of years ago I got a rather nasty, profane email from a woman in Ireland who thought she was venting at her ex.

For the Virgin Mobile phone I logged into the account as I wanted to make sure that I wasn't a victim of identity theft and they were using my credit card for their phone.  Fortunately it appears that I wasn't.

The thing is that when you register anything and they ask you for an email account make sure that you provide the correct one or someone else could be getting email that you don't want anyone else to get.

Main login

Checking to see if my Credit Card was used