Reset the Net : Don’t ask for your privacy, Take it back

June 1, 2014 1 comment

The day of action for privacy and freedom is on June 5th and is less than a week away. Join Reset the Net and pledge to take actions to protect your privacy.

Why Reset the Net?

NSA and Governments around the world has taken the Internet and turned it into a surveillance state. So let’s make it harder for NSA and anyone who want to spy on us. Our, best defense right now is to encrypt everything.

Here is a short video explaining everything.

Why June 5th?

June 5th, 2014 marks one year since the NSA’s classified documents about mass surveillance came to light. Thanks to Edward Snowden, British daily The guardian published this story last year. Here is a link to the original story published. Since then a lot of revelations have been made and more is yet to come as promised by Mr. Snowden.

 

ResetTheNet.org

Fight for your Privacy

Update:

On 6/5, 65 Things We Know About NSA Surveillance That We Didn’t Know a Year Ago -  By EFF

Save netneutrality…Write to FCC stating your opinion on net neutrality

May 17, 2014 Leave a comment

If you are an Internet user living in the United States, FCC has asked for your opinion on their new rules for regulating Internet. Write to them staing why having a free, open and equal to all Internet is important to have.
EFF, the leading nonprofit organization which fights for our Internet freedom is asking for your help to protect Net Neutrality.

Go to dearfcc.org write to FCC and let your voice be heard.

For more information on what’s at stake and why you need to act now, head to this EFF page.

Even if you are not living in Unites States, you can do your part by letting others know by sharing this information in your social circle.

 

Sourcing a shell script in bash

March 9, 2014 Leave a comment

When a script is called using “.” or “source” command, then a script is said to be sourced. There are different ways of sourcing a script which are given below:

source script-name

or

. script-name

The difference between executing a script normally and sourcing a script is that, when a script is normally executed, a new shell is created and commands inside the script are executed in the new shell. The environment variables of the parent process are made available to the child process, but the local variables are not.

But when a script is sourced, the commands of the sourced script are executed in the same shell as the script from which it is called. And therefore all the local variables of the parent script is available to the sourced script. It is typically executed as if the contents of the sourced script are the contents of the parent script.

Generally scripts are sourced, when the variables of a script is required to be used inside another script, so that each of the variables which are required do not have to exported to be made available inside the sourced script.

Lets verify this with simple proof of concept.

Write a script as given below, which will be used to invoke the other script in different ways.

#!/bin/bash
echo “In caller script”
echo “$0″

BLOG=’Blulin’
PLATFORM=’Wordpress’

export BLOG=”$BLOG”

echo “BLOG=$BLOG”
echo “PLATFORM=$PLATFORM”

ps -o pid,ppid,cmd | grep -v “ps”

echo “————————————”
echo “Inside directly called script”
./called.sh

echo “————————————”
echo “Inside sourced script”
. ./called.sh

echo “————————————”
echo “Back in the caller script”
exit 0

Here is the caller script, we have defined two variables, BLOG and PLATFORM. variable BLOG is also exported using the “export” command, then the contents of variables are displayed and then there is ps command executed to display the processes currently running in the terminal from which it is called. Output of ps command is formatted such that it displays process id, parent process id and the name of the process. Then we have a child script “called.sh” which is normally called and then the same script is called again, but this time it is sourced.

Now lets define the contents of the called script.

#!/bin/bash
echo $0
echo “BLOG=$BLOG”
echo “PLATFORM=$PLATFORM”

ps -o pid,ppid,cmd | grep -v “ps”
exit 0

Inside called script we display the value of variables BLOG and PLATFORM, which is not defined in this script. and then we have a ps command, which is the same one as used in the caller script. By default ps command also prints the process details of itself, so to reduce the clutter of output we ignore the information about ps command itself, by piping it to grep. Then we have an exit command at the end of script.

Now as we have contents of both caller script and called script in place, let’s execute the script and look at the output. When the caller script is executed from the terminal, this is the output we get:

In caller script
./caller.sh
BLOG=Blulin
PLATFORM=Wordpress
PID  PPID CMD
4291  2884 bash
16158  4291 /bin/bash ./caller.sh
————————————
Inside directly called script
./called.sh
BLOG=Blulin
PLATFORM=
PID  PPID CMD
4291  2884 bash
16158  4291 /bin/bash ./caller.sh
16161 16158 /bin/bash ./called.sh
————————————
Inside sourced script
./caller.sh
BLOG=Blulin
PLATFORM=Wordpress
PID  PPID CMD
4291  2884 bash
16158  4291 /bin/bash ./caller.sh

Now let’s analyze the output of the scripts.

caller.sh output:

  • First the display statements in the caller scripts are executed and it is as expected.
  • Then the ps command output has two lines, which shows the process currently executing in the terminal from which the script was called, first line is the bash shell with process id “4291″, which is executed when a terminal is opened. Next line shows the process id of the caller script “16158″ and the command name of the process.

output of called.sh when directly executed:

  • Next the display statements of called.sh script output which is called normally shows variable BLOG has a value, because BLOG is exported in the caller.sh script and as this called.sh is the child process of caller.sh script, it is made available here, but PLATFORM variable is not, because this called.sh runs as an independent child process.
  • ps command output of the directly called script shows that the caller.sh is indeed the parent process of called.sh script.

output of called.sh when sourced:

  • Next the display statements of called script which is sourced shows that, command name of script is same as that caller.sh script(output of “echo $0″). Then the variables both has a value, even as the PLATFORM variable is not exported. As a new bash shell is not created this time and these variables become local to called.sh
  • finally ps command output proves that there is no new process created this time, when called.sh is sourced.
  • Also, it is important to note that the display statements “Back in the caller script” is not printed as “exit 0″ is given in called.sh. When that statement is executed in called.sh the script caller.sh is exited as well, because both caller.sh and called.sh runs under same process and this does not happen when it is called normally.

Hope this example is useful in understanding the concept of sourcing shell scripts.

Fix Touchpad tap to click not working on Linux mint 16 petra

January 18, 2014 Leave a comment

Touchpad tap to click is by default disabled on Linux mint 16 and you can easily enable it by going to System settings -> Mouse and touchpad -> Touchpad  and selecting “Enable mouseclicks with touchpad”. This is fairly straight forward.

enable touchpad tap to click

enable touchpad tap to click

However, for some people who have upgraded from older versions of Linux mint instead of doing a fresh clean install of Mint 16, they might have two versions of system settings installed, like shown below.

Screenshot from 2014-01-18 12:35:53

Both are different system settings application and not displayed twice due to some menu configuration error, it’ll become obvious once you open both side by side.The fact that both applications have the same name and icon is very deceptive for the normal eyes.You might have used both applications but you might be unaware of this fact, unless you look for it. Here, is a screenshot showing both opened side by side.

screenshot showing a comparison of gnome system settings and cinnamon system settings side by side

comparison of gnome system settings and cinnamon system settings

Applicaion window open in the right is Gnome settings application and any changes you make through here is not of any use, unless you are running Gnome desktop. Window shown in the right is the cinnamon system settings application and this is where you have to make your changes if are running default Linux Mint Cinnamon desktop.

Here is a comparison of how touchpad settings looks in both Gnome and Cinnamon settings applications.

comparison of cinnamon and gnome touchpad settings

Cinnamon system settings is easily distinguishable from Gnome settings by the fact they have a “switch to advanced/normal mode” link at the bottom of the application screen. Finally, the link has found some way of being actually useful ;-)

gnome-control-centre is the application responsible for Gnome system settings, it has a lot of dependent applications, that removing the application will mess with your system, unless you know what  you are doing. So, if you are not absolutely sure what you are doing, I’ll ask you to not remove it.

Tip for the day – Fix your terminal displaying junk characters

August 24, 2013 Leave a comment

Sometimes when reading a binary file your terminal font may be set to junk values and whatever you type will appear as junk. This may happen when reading a binary file through cat command, opening the raw device files like /dev/random /dev/urandom, or reading  /proc/kcore memory file. Below screen shot shows how terminal looks when this happens,

Terminal displaying all characters as garbage after reading a binary fileWhen you are working in GUI environment within a terminal emulator this may not be a problem as you can close and reopen a new terminal. But this is a problem when you’re working in text environment.

There is an easy way to fix this problem by resetting the terminal. Yes typing reset command in the terminal will reset your terminal back to normal state.

stumbled across a new bug with notifications in cinnamon desktop

March 30, 2013 Leave a comment

When applications are running in full screen, notifications does not appear in cinnamon desktop. When running applications in full screen like watching a movie in media player, viewing firefox in full screen and if there is any notification bubbles appearing it doesn’t show up. It only appears below the full screen application. Whatever be the criticality of the notification it doesn’t appear. This could lead to many problems like not getting to know when the battery is getting low, when disconnected from a network etc.

Ideally notifications should appear on top of whatever application the user is running, but this is not the case.

This bug could be reproduced by running the command notify-send in terminal as given below,

sleep 10 ; notify-send hi

and run an application in full screen and wait for 10 secs and check whether ‘hi’ appears. If it doesn’t appear, you are affected by this bug.

I have reported this bug in launchpad linux mint page here: https://bugs.launchpad.net/linuxmint/+bug/1162198

If you can reproduce this go and subscribe to this bug by clicking ‘Yes,this bug affect me’  in the bug page.

Power management issue with Linux desktops

March 15, 2013 2 comments

Power management in Linux mint desktop does not kick in when the system is booted upon, it only starts up when the cinnamon desktop is logged into. This should not be the case because when the system is powered up and left untouched, the brightness settings does not work, battery management settings doesn’t work. When this is the case battery gets drained completely.

By default in power manager settings, system is configured to take critical battery action only when 2 minutes of power is remaining. Thus most people wouldn’t have noticed the seriousness of this problem. I configured my system to take critical battery action when battery is at 25 % by modifying the dconf-editor settings and confirming this is the case.

I have reported a bug to Linux mint in launchpad here https://bugs.launchpad.net/linuxmint/+bug/1155691

If you are facing this bug, please add a comment against this bug.

I’m afraid this is how gnome3 desktop behaves too. This must affect all the linux distributions using cinnamon and gnome3 desktop. At this moment i have no idea what are all the distributions affected. If your version of linux is affected, please report it to your distributions authors at the appropriate place.

I guess this is more of a design error than of a bug

Follow

Get every new post delivered to your Inbox.