Ad Blocker for Android Browser

If you’re anoyed with ads in your android browser, you should try Ad Block:
https://market.android.com/details?id=de.ub0r.android.adBlock&hl=en
With ad block your browser will make a request through a proxy server, which is the Ad Block itself. The Ad Block usually setup to use host 127.0.0.1 also known as the localhost, and port 8080.

In order to access the android default proxy settings you need a shortcut to the settings, which by default its hidden. So you’ll need Any Cut
https://market.android.com/details?id=com.appdroid.anycut&hl=en

The cool thing is no rooting required. This way you can browse faster, safer, and use less bandwidth.

Benchmark How Long a Program Runs In Linux Using Bash

The following bash code might come handy for those of you who want to benchmark how long does a program runs.
In the following example the assumption is that you want to pass along two parameters for your program to run properly.
A time will be recorded at the beginning and at the end of the execution. And a time diff, the processing time, will be reported in seconds.


#!/bin/bash
##################################################
# Benchmark the processing time when a program
# executes with two required parameters: parameter1 parameter2
##################################################

if [[ $1 = "" || $2 = "" ]]; then
echo "Usage: `basename $0` parameter1 parameter2"
else
_start_time=`date +%s`
_parameter1=$1
_parameter2=$2
### YOUR COMMAND HERE WITH parameter1 AND parameter2 ###
_end_time=`date +%s`
_processing_time=$((_end_time-_start_time))
echo "Source File: $_parameter1"
echo "Destination File: $_parameter2"
echo "Start time: $_start_time"
echo "End time: $_end_time"
echo "Processing time is: $_processing_time"
fi

Auto Login Using SSH Public and Private Keys

Assume that your main server (the one you use the most) is ServerA.
And from ServerA, you want to automatically login to ServerB.
For illustration purpose, ServerB can be a repo server and you don’t want to keep being asked for password everytime you want to commit files.

1. At ServerA issue: # ssh-keygen -t rsa
This will create a public + ptivate key for ServerA
2. Enter (empty) for paraphrase
Your identification has been saved in /home/ronald/.ssh/id_rsa.
Your public key has been saved in /home/ronald/.ssh/id_rsa.pub.
3. Copy over the newly created public key from ServerA to ServerB
scp .ssh/id_rsa.pub ronald@ServerB:~/id_rsa.pub.ServerA
Note that once the file arrives at ServerB, it named as id_rsa.pub.ServerA (not id_rsa.pub), and it will be stored at ronald’s home directory at ServerB.

4. Ssh to ServerB, and issue this command:
cat id_rsa.pub.ServerA >> .ssh/authorized_keys
ServerA public key will be merged/appended to ServerB authorized_keys file.

This way everytime you want to access ServerB from ServerA, you won’t be asked for a password.

Linux Soft Symlink Folder or Directory


$ ln -s /home/rpringad/somefolder /home/rpringad/newfolder

#or if your current directory is already /home/rpringad:
$ ln -s /home/rpringad/somefolder /home/rpringad/newfolder

$ ln -s existingSourceFolder newLinkedFolder