18 November 2016

Screensaver on, CPU goes quiet.


While that would be nice for a Desktop PC that is not running services or things alike, it is far from true.


If you don't believe me open the CPU monitor and then this page
https://people-mozilla.org/~jmuizelaar/fishbowl/fishbowl-gl.html

You will see the CPU utilization going up (unless you have a very good machine).
When the screensaver is activated that CPU usage does not go down. Only the sound gets stopped.


Recently I am being a big 'performance paranoid' and have done a few things like:

- change ext4 and mount (fstab) options to improve performance / reduce unnecessary i/o
- remove unnecessary services

Now I am with the CPU.
So I created an script that reacts to screensaver changes and basically stops/starts all the browsers (the hungry CPU eaters on my PC). As simple as that.

Most of the script comes from within the manual xscreensaver-command
# man xscreensaver-command


Here is the full script (I used "# tail -f" on a text file during testing to verify it was working, plus looking at the CPU graph).


---------------

#!/usr/bin/perl

               my $blanked = 0;
               open (IN, "xscreensaver-command -watch |");
               while (<IN>) {
                   if (m/^(BLANK|LOCK)/) {
                       if (!$blanked) {
                               # que hacer
                           #system "sound-off";
                            system "killall -s STOP iceweasel chromium firefox";
                            #system "echo 'stopped all' >> /home/xx/tmp/sss";
                            #system "date >> /home/xx/tmp/sss";


                           $blanked = 1;
                       }
                   } elsif (m/^UNBLANK/) {
                               # que hacer
                               #system "sound-on";
                            system "killall -s CONT iceweasel chromium firefox";
                            #system "echo 'started all' >> /home/xx/tmp/sss";
                            #system "date >> /home/xx/tmp/sss";


                       $blanked = 0;
                   }
               }


---------------


16 November 2016

Fixing Google Contacts


Note: Fixing here means fixing my particular problem.

Problem:
When I create a contact via web or with the phone (android) I normally enter it like this
"one two three .... "
And Google, instead of putting all that info on the "Name", it spreads the different parts among some of these fields


Given Name
Additional Name
Family Name
Yomi Name
Given Name Yomi
Additional Name Yomi
Family Name Yomi
Name Prefix
Name Suffix


If you export the contacts, the csv file will contain a Field called "Name" that contains what you introduced as the name, but in reality it is saved internally as many different fields.



And why all that fuss? You may ask...

Well, all those details are important for me to see when I am making a call or searching for a contact, and depending on the application they all are not searched or displayed, so I want Google Contacts to save the whole name in -one- field only (the main one).


So I did this

1. From web, export to csv
2. Delete all contacts on web
3. Open the csv, edit the file deleting the content of all the fields previously explained except "Name"
4. Swap the column header of "Name" and "Given Name" (so Given Name contains the full name of contact as "one two three ...")
5. Save
6. Import


Disclaimer: No warranty of any type. Don't use this info unless you know what you are doing.


Script to launch private window with query to Google all at once.

Many times I find myself doing the same thing when I have a dumb question ...


1. Open firefox on private window
2. Type the query
3. Hit enter


Well, not anymore.

I created a bash script and now I just type

"q whatever is your query"

On terminal or on Run (launched by Alt+F2) and hit enter.


Code:

#!/bin/bash

# Open a browser in private window
# with the arguments in a query to Google

# arguments
search="${@:1}";

# create url with query
url="http://www.google.com/search?q=$search";

# open browser
firefox --private-window "$url" &

Too Cool for Internet Explorer