Saturday, 7 December 2013

MyISAM to InnoDB Engine Conversion

We are doing lots of MyISAM to InnoDB migrations in our production environment and since the engine conversion needs to be done for each table, its good to generate a script to do so when you have huge number of databases each having several tables. Here is the quick script to generate script for MyISAM to InnoDB engine conversion.
mysql -u <user> -p -e "SELECT concat('ALTER TABLE \`',TABLE_SCHEMA,'\`.\`',TABLE_NAME,'\` ENGINE=InnoDB;') FROM Information_schema.TABLES WHERE TABLE_SCHEMA in ('database1', 'database2', 'databaseN') AND ENGINE = 'MyISAM' AND TABLE_TYPE='BASE TABLE'" | tail -n+2 > alter.sql


Once the SQL script is generated, all you need to do is run the sql file to your database server.
$ mysql -u <user> -p < alter.sql


Note that while InnoDB is generally the better engine than MyISAM and MySQL has InnoDB as default engine since 5.5, MyISAM has its own benefits and you should make performance analysis in preferably a test environment while converting the engine type.


Read more...

Monday, 18 November 2013

Install HTTrack On CentOS

Since I could not find the rpm in the repo, here is the quick How To to install HTTrack website copier on CentOS.

$ yum install zlib-devel
$ wget http://download.httrack.com/cserv.php3?File=httrack.tar.gz -O httrack.tar.gz
$ tar xvfz httrack.tar.gz
$ cd httrack-3.47.27
$ ./configure
$ make && sudo make install


This should do all. If you wish not to install zlib compression support, you can skip the first step and run the configure as ./configure --without-zlib. I hope this helps :)


Read more...

Sunday, 10 November 2013

JPEG To PDF With Imagemagick

ImageMagick is an awesome toolkit with several powerful features for image creation and manipulation. You can use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bezier curves. Here, I will show how you can use ImageMagick suite to convert JPEG to PDF quickly.

First make sure imagemagick suite is installed in your system.

Ubuntu/Debian
$ sudo apt-get install imagemagick


CentOS/Fedora
$ sudo yum install imagemagick


Below are some of the examples of using convert which is a part of ImageMagick to convert Jpeg to PDF.

Single Image
$ convert image.jpg image.pdf


Multiple Images
$ convert 1.jpg 2.jpg 3.jpg output.pdf


Resize and Convert
$ convert -resize 80% image.jpg image.pdf


Negate and Convert
$ convert -negate image.jpg image.pdf


You can actually use different available switches to get your output as expected. I usually use PdfTk in conjunction with this technique to work in different scenarios and it really works great. I hope this helps :)


Read more...

Saturday, 9 November 2013

Fix Your Ubuntu

Recently Ubuntu has been known for turning into an advertising company and has been accused of not protecting user's privacy so just came across this site that fixes your ubuntu by applying some patches to turn off some of the invasive features of Ubuntu.

FixUbuntu.com


Read more...

Wednesday, 6 November 2013

Recursion and Memoization - A Fibonacci Example

In this post, I will try to describe why memoization can be a great optmization technique in the recursive function implementations with an example of fibonacci sequence.

Straight from Wikipedia, memoization is an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously processed inputs.

Basically, we maintain a lookup table and store the computer values for particular cases which lets us query and use the corresponding value for particular case present in the lookup tables. This reduces function call overheads. Now in order to understand why this is a great optimization technique in recursion, lets first draw a recursion tree for finding nth term in fibonacci sequence.

                           fib(5)                          
                             /\                              
                            /  \
                           /    \
                          /      \                      
                     fib(4)       fib(3)                                 
                      /\               /\                          
                     /  \             /  \
                    /    \           /    \
                   /      \         /      \                         
               fib(3)    fib(2)     fib(2) fib(1) -> 1                                    
                  /\         /\          /\                          
                 /  \       /  \        /  \                         
                /    \     /    \      /    \
               /      \   /      \    /      \                        
          fib(2) fib(1) fib(1) fib(0) fib(1) fib(0) -> 0                                        
          /\        |     |      |        |    |               
         /  \       1     1      0        1    0               
    fib(1) fib(0)                                                       
       |      |                                               
       1      0 


We can clearly see the calls to fib() with same arguments several times. For example, fib(1) is called 5 times and fib(2) 3 times. Thus, we are repeating same calculations multiple times and imagine how this would look like for large value of n. If we would have maintained the value of fib(n) in the lookup table when computed the value for the first time.

The python code without memoization looks like below and notice the runtime:
#!/usr/bin/python

def fib(n):
        if n == 0:
                return 0
        if n == 1:
                return 1
        val = fib(n-1) + fib(n-2)
        return val

print fib(50)


And, now with the memoization, you will notice significant improvement in runtime.

#!/usr/bin/python

known = {0:0, 1:1}

def fib(n):
        if n in known:
                return known[n]
        known[n] = fib(n-1) + fib(n-2)
        return known[n]

print fib(50)


If you run and compare above two codes, you will find that the addition of memoization significantly improves the performance of recursive functions. Recursion are generally known to be terribly slow however memoization can make the difference insignificant. Some languages now provide memoization as the language feature natively or via third party APIs such as groovy memoize.


Read more...

Friday, 18 October 2013

Pattern Based Database GRANT In MySQL

At our workplace, we need to manage database access for different teams and rather than adding another grant on the addition of new database, I've been following a pattern based database access grants in MySQL.

We let different teams work on replicas of same database and hence append the terms such as _dev and _qa as the database prefix. And, we define GRANTS based on these patterns. An example would be something like below:
GRANT ALL ON `%\_dev`.* TO 'user'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;


I hope this proves useful for some of you guys :)


Read more...

Thursday, 17 October 2013

How I am Trying To Keep My Eyes Safe On Computer

Lately I've been on computer a lot and with this, the usual problem with most computer users has started to bother me. Going through some of the blogs online for keeping eyes safe while using computer, I came through few suggestions and in this post, I'm writing how I'm trying to keep my eyes safe. Though not tremendously helpful for everybody, I thought I would share this and you could also use my technique.

The problem with computer addicts is not getting their eyes off the computer for much longer period and though I've been trying to remember to keep my eyes off the computer in regular interval, I usually never implement this.

My two principles based on my readings on different websites are:

  • 20-20-20: In the 20 minutes interval, keep your eyes away for 20 seconds (& view other objects which are around 20 feet away)
  • 2 hrs rule: In the 2 hours interval, stay away from computers for at least 2 minutes.

But, you can not really follow the rules so easily and I had to find some other alternative to do so. This is how I am doing it now.

Create two cron jobs for each of the above mentioned methods such that notify-send is triggered in each 20 minutes and each 2 hours informing you to keep yourself safe from computers. So my /etc/crontab looked like this:

*/20 * * * * techgaun export DISPLAY=:0.0 && /usr/bin/notify-send -i /home/techgaun/Samar/scripts/eye_inv.ico "20 - 20 - 20" "Time to take rest. Keep your eye safe :)"
01 */2 * * * techgaun export DISPLAY=:0.0 && /usr/bin/notify-send -i /home/techgaun/Samar/scripts/eye_inv.ico "2 hrs eye rest" "Time to take rest for 2 minutes. Keep your eye safe :)"


You need to replace techgaun with your username and need to give correct path to the ico file if you like to use icon like me. Otherwise, you could just omit the icon in notify-send command. I hope this proves useful for some of you :)


Read more...

Monday, 16 September 2013

Two Ways To Print Lines From File Reversely

Ever tried to print lines in files in the reverse order? You will know two simple methods to print lines from file in the reverse order.

Imagine a file somefile.txt with content something like this:
a
b
c
d
e


Method 1:


$ tac somefile.txt
e
d
c
b
a


Method 2:


$ sort -r somefile.txt
e
d
c
b
a


You can achieve the same effect through other techniques as well but I'll stick to these simple ones :)


Read more...

Wednesday, 7 August 2013

Compile 32 Bit Binaries On 64 Bit Machine

Well I had this special need if you recall my previous blog post since my friend had 64 bit machine. Sometimes, there might be this necessity to compile 32 bit binaries on your 64 bit machine. This post describes how to do so.

First make sure the necessary x86 libraries are installed. We require 32-bit shared libraries for AMD64 to compile binaries in 32 bit format. The command below installs the i386 version of libc6-dev:

$ sudo apt-get install libc6-dev-i386


Now you can compile your code in 32 bit binary format using the -m32 flag where 32 represents the x86 processor (-m64 would mean x64 processor).

$ gcc -m32 -o test test.c


I hope this helps :)


Read more...

Pointers Without Pointer Variables

Since a pointer variable is nothing but a variable holding 4 bytes memory address (at least on 32-bit addressing), I had a thought that non-pointer variables which can hold 4-bytes of data can be used in place of pointer variables. This post shows how this can be achieved.
The code example below uses an unsigned integer variable in order to store memory addresses to point the integer array.

#include 

int main(int argc, char **argv)
{
        int num[] = {1, 2, 3, 4, 5};
        unsigned int ptr;
        int i;
        ptr = (unsigned int) num;
        for (i = 0; i < 5; i++)
        {
                printf("%p - %d\n\n", (void *) ptr, *(int *)(ptr));
                ptr = ptr + 4;
        }
        return 0;
}



The same concept can be used to use non-pointer variable for pointing other datatypes. After all, its about correct type-casting and since 4 bytes datatype can hold memory addresses, pointer is not always necessary. It must be noted that the increment would be different for different datatypes. Since integer requires 4 bytes, ptr is incremented in this example. If we had character array, then ptr would have to be increased by 1 since char type requires 1 byte.

However, pointers are there to make our life easy. It was just for fun :)


Read more...

Friday, 28 June 2013

Rename MySQL root User [How To]

MySQL ships with the default user 'root' who has all kind of access to the MySQL database. We often wish to rename this user to something else because of maybe security issues or any other reason. While renaming 'root' to something else is not going to alleviate all sorts of security problems that may arise, it is good idea to rename 'root' to some other name.

Login to the MySQL console and then type the following SQL statements:

mysql> use mysql;
mysql> update user set user="some_other_user" where user="root";
mysql> flush privileges;


It is often good idea to drop anonymous users and the test database because of security reasons. I bet you are never going to use that test database so why keep it? Run the SQL statements as below to do so:

mysql> drop user "";
mysql> drop database test;


Also, make sure you use strong passwords. You can use mysqladmin to change passwords.

$ mysqladmin -u my_new_user -p password 's0m3_r4nd0m_$|r0ng_p455' $ history -c $ rm ~/.mysql_history


The later two commands are to ensure that no log of any of your MySQL queries or admin level commands have been stored in the history.

I hope this helps :)


Read more...

Thursday, 27 June 2013

Manual Sun Java Installation In Linux

Be it be multiple installations of java or be it be custom server, you might run into the necessity of manually installing java. This tutorial will provide step by step commands for installing java manually in linux.

Though the process was done on CentOS, it should work for most linux systems with or without slightest modifications. The process below installs Sun Java and configures Sun Java to be the default java to be used. Below are the steps I took to install and configure java in my system:

$ cd /opt/java
$ wget http://download.oracle.com/otn-pub/java/jdk/6u45-b15/jdk-6u45-linux-i586.tar.gz
$ tar xvfz jdk-6u45-linux-i586.tar.gz
$ echo 'export JAVA_HOME=/opt/java/jdk1.6.0_45' > /etc/profile.d/sun-jdk.sh
$ echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile.d/sun-jdk.sh
$ alternatives --install /usr/bin/java java /opt/java/jdk1.6.0_45/bin/java 2
$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)


If you wish to reconfigure the default java, you can run alternatives as below & choose the appropriate option:

$ alternatives --config java
I hope this helps :)


Read more...

Friday, 21 June 2013

Share Local Directory With Remote Server During RDP Session

Well I have to constantly rdesktop to the remote servers at my workstation and sometimes I have to copy files and folders from my local machine. This post will provide you the steps on how to share files and folders with remote server during rdp session. Normally, your RDP session would start with the following command:

$ rdesktop -g90% your_server


But we wish to do something extra i.e. we need to share our directory with the remote server. The good news is that the rdesktop command supports device redirection using a -r flag which can be repeated.

Your command would look something like below:

$ rdesktop -g90% -r disk:share=/home/samar/scripts myserver


You can then access your share as a drive or media. I hope this helps :)


Read more...

Wednesday, 19 June 2013

Customizing Jenkins Layout

We use jenkins as our continuous integration server at our workplace and without any doubt, its the best CI tool I've used. We had been thinking of customizing jenkins layout to fit our company and thanks to the plugins developed by people who make jenkins not just another random tool on the internet, but the software WITH awesome community. There are particularly two plugins that seemed to fit our scenario. The first one is Simple Theme Plugin and the second one is Page Markup Plugin.

The later one does allow to add markups to the page but didn't best fit for our scenario. So we decided to use the Simple Theme Plugin. Installing the plugin is straightforward in jenkins. Once the Simple Theme Plugin is installed, a new content box will appear in your Manage Jenkins -> Configure System which will look something like below:



This plugin requires you to specify your own custom .css and .js file. The good thing about jenkins is you can place your own content at the JENKINS_INSTALL_DIR/userContent/ directory and then access it via http://yourbuildserver.tld/jenkins_path/userConent/yourfile.ext. I was working on the windows system where my jenkins install was at C:\.jenkins\ and hence I placed my CSS and image files inside the userContent directory of jenkins install folder. This should not be very difficult on any other systems if you are familiar with jenkins and your OS.

You can grab the jenkins css files from the webapp root directory (I was using tomcat so I grabbed it from inside there) and then edit the css as per your necessity. In my case, I had to change the header style only so my CSS looked something like below:

#top-panel {
  background-size:100% 100%;
  height: 43px;
  }
  
#top-panel td#login-field span a {
    background: none; }
 
#top-panel a {
    background: url("title.png") 0 0 no-repeat;
    display: block;
    width: 107px;
    height: 27px;
    margin: 10px 0 -5px 0px; }
#top-panel td > a img {
      display: none; }




This is all you have to do. Btw, don't fall for the readme.txt inside userContent directory which says: "Files in this directory will be served under your http://server/jenkins/userContent/". Make sure you specify the URL according to your server configuration not according to this specification thus appending "/jenkins" in your URL.


Read more...

Tuesday, 18 June 2013

Setting Installation Of Android Application To SD Card

Well this is old stuff and several applications with much more functionalities are probably out in the play store but just decided to post it here because it proved useful while playing with older android OS.

Follow the steps below to enable installation of new softwares to the SD card on the android phones by default (Tested on android 2.2).
  • Enable USB debugging on phone (from somewhere in Settings->About Phone)
  • Connect device with PC using USB cable
  • Open command prompt/terminal
  • Open android debugger bridge (change directory to the location where android sdk is installed)
  • Type: adb.exe devices
  • Type: adb.exe shell
  • On the new console, type: set pmInstallLocation 2
    Here, 2 means External memory

Note: "get pmInstallLocation" can be used to query for the available locations you can install softwares to.

That's all. Hope it helps :)


Read more...

Wednesday, 12 June 2013

Simple Pie Chart Implementation In Turbo C

This is a very simple implementation of pie chart in Turbo C. The source code is quite easy to read through so must not be the big problem understanding the code.

This implementation makes use of pieslice() function which draws and fills the pie slice with centre x, y and radius r. The function also requires the start angle and end angle.

#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <math.h>

#define MAX 20
#define X_CENTRE getmaxx()/2
#define Y_CENTRE getmaxy()/2
#define RADIUS 100

struct pie_data
{
 char desc[100];
 int freq;
 int color;
 int style;
 float angle;
};

int main()
{
 struct pie_data data[MAX];
 int gd = DETECT, gm;
 int i, j, k, n, total_freq = 0, start_angle = 0, end_angle = 0, xmax, ystart = 80, yend;
 printf("Enter the number of items: ");
 scanf("%d", &n);
 
 for (i = 0, j = 1, k = 1; i < n; i++)
 {
  printf("Enter the item title: ");
  scanf("%s", data[i].desc);
  printf("Enter the item frequency: ");
  scanf("%d", &data[i].freq);
  total_freq += data[i].freq;
  data[i].color = j;
  data[i].style = k;
  if (j++ >= 13) j = 1;
  if (k++ >= 11) k = 1;
 }
 
 for (i = 0; i < n; i++)
 {
  float angle;
  data[i].angle = 360 * (data[i].freq /(float) total_freq);
 }
 
 initgraph(&gd, &gm, "C:\\TurboC3\\BGI");
 xmax = getmaxx() - 150;
 setaspectratio(10000, 10000);
 for (i = 0; i < n; i++)
 {
  end_angle = start_angle + data[i].angle;
  setcolor(data[i].color);
  setfillstyle(data[i].style, data[i].color);
  pieslice(X_CENTRE, Y_CENTRE, (int)start_angle, (int)end_angle, RADIUS);
  start_angle = end_angle;
  yend = ystart + 40;
  bar(xmax, ystart, xmax + 70, yend);
  ystart = yend + 15;
  outtextxy(xmax + 80, ystart - 20, data[i].desc);
 }
 getch();
 closegraph();
 return 0;
}


Below is the screenshot for sample run:




Read more...

Tuesday, 11 June 2013

Congratulation To SLC Graduates From Iris Academy

Today, result of SLC exam 2069 was published and the first batch of Iris Academy secured 100% result with 50% distinction. Although being a relatively new school in Makar-2, Chisapani, Nawalparasi, Iris Academy secured the best result in the area.
We would like to congratulate all the SLC appeared students and the Iris Academy and wish for the bright future ahead.

Read more...

Tuesday, 2 April 2013

Step By Step Turbo C++ IDE In Ubuntu 12.04

Well we are doing our labs based on the traditional Turbo C++ IDE and I decided to write this blog post with the information on how I installed it on my Ubuntu box.

First thing first, download Turbo C from internet. For your ease, I've uploaded it HERE.

We will have to install dosbox to run the windows dos mode applications so lets install it:

samar@samar-Techgaun:~$ sudo apt-get install dosbox


Once you install dosbox, unzip the content to somewhere in your $HOME directory. In my example, I unzipped the content of the Turbo C zip file into ~/Tools/TurboC3/. Now launch the dosbox by typing dosbox in the terminal. A dosbox emulation window will appear which will look like your old DOS system.

In the window, type the following (make sure you type appropriate path for your installation):

mount C: ~/Tools/
C:
cd TurboC3
INSTALL.EXE


And, then follow the on-screen information. Refer to the screenshots below:















Once the installation finishes, you can then run the Turbo C by mounting the drive again and then navigation to C:\TC (cd C:\TC\BIN). If you need to use the Turbo C++ IDE frequently, my suggestion would be to add an autoexec entry in your dosbox configuration. The default configuration file resides in ~/.dosbox/dosbox-0.74.conf (My version of dosbox is 0.74 hence the file name, by default). Open up this file and in the section of [autoexec], add the lines below:

[autoexec]
mount C: ~/Tools/
C:
cd TC\BIN
TC.EXE


Adding this entry will run the above commands during the startup of dosbox thus giving you the Turbo C IDE interface directly on running dosbox.

I hope this helps :)


Read more...

Sunday, 31 March 2013

Simple Line Drawing In Turbo C Graphics

Well this post consists of the source code for very very simple line drawing using the in-built functions.
#include <stdio.h>
#include <conio.h>
#include <graphics.h>

int main()
{
 int gd = DETECT, gm;
 initgraph(&gd, &gm, "C:\\TurboC3\\BGI");
 line(100, 100, 350, 100);
 line(100, 100, 70, 140);
 line(70, 140, 130, 140);
 line(350, 100, 380, 140);
 rectangle(70, 140, 130, 200);
 rectangle(130, 140, 380, 200);
 getch();
 closegraph();
 return 0;
}


I hope it proves useful for learning purpose.


Read more...

Implementation Of BLA Line Drawing Algorithm

Here is the source code that makes use of the traditional DOS mode graphics to implement the Bresenham line drawing algorithm for the lines with slope |m| < 1.

Bresenham Line Drawing Algorithm for |m| < 1


Algorithm


1) Input two points (x1, y1) & (x2, y2).
2) Determine the differences dx = x2 - x1 and dy = y2 - y1.
3) Calculate the initial decision parameter P0 = 2dy - dx.
4) For each xk along the line starting at k = 0,
   if Pk < 0,
      a) put a pixel at (xk + 1, yk)
      b) Pk+1 = Pk + 2dy
   else
      a) put a pixel at (xk + 1, yk + 1)
      b) Pk+1 = Pk + 2dy - 2dx.
5) Repeat step 4 for dx time.
6) End

Source Code


#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <math.h>

int main()
{
 int gd = DETECT, gm;
 int x1, y1, x2, y2, dx, dy;
 int x, y, i, p0, pk;
 printf("Enter x1, y1: ");
 scanf("%d %d", &x1, &y1);
 printf("Enter x2, y2: ");
 scanf("%d %d", &x2, &y2);

 dx = x2 - x1;
 dy = y2 - y1;

 x = x1;
 y = y1;
 p0 = ( 2 * dy - dx);
 initgraph(&gd, &gm, "C:\\TurboC3\\BGI");
 pk = p0;
 for (i = 0; i < abs(dx); i++)
 {
  if (pk < 0)
  {
   putpixel(x, y, WHITE);   
   pk += (2 * dy);
  }
  else
  {
   putpixel(x, y, WHITE);
   pk += (2 * dy - 2 * dx);
  }

  (x1 < x2)?x++:x--;
  (y1 < y2)?y++:y--;
  
  delay(50);
 }
  
 getch();
 closegraph();
 return 0;
}


Make sure to provide an appropriate path for graphics library.


Read more...

Tuesday, 26 March 2013

Implementation of DDA Line Drawing Algorithm

Here is a source code in traditional Turbo C that makes use of old DOS mode graphics to implement the digital differential analyzer.

Digital Differential Analyzer


Algorithm

1) Input two points (x1, y1) & (x2, y2).
2) Determine the differences dx = x2 - x1 and dy = y2 - y1.
3) Choose step size as the bigger value between the absolute values of dx and dy.
4) Determine x-increment = dx/step_size and y-increment = dy/step_size.
5) Start from (x0, y0) = (x1, y1).
6) For i -> 0 to stepsize:
    a) draw pixel at (xi, yi)
    b) set xk = xk + x-increment
    b) set yk = yk + y-increment

Source Code


#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <math.h>

int main()
{
 int gd = DETECT, gm;
 int x1, y1, x2, y2, dx, dy, stepsize;
 float xinc, yinc, x, y;
 int i;
 printf("Enter x1, y1: ");
 scanf("%d %d", &x1, &y1);
 printf("Enter x2, y2: ");
 scanf("%d %d", &x2, &y2);
 dx = x2 - x1;
 dy = y2 - y1;
 stepsize = (abs(dx) > abs(dy))?abs(dx):abs(dy);
 xinc = dx/(float)stepsize;
 yinc = dy/(float)stepsize;
 x = x1;
 y = y1;
 initgraph(&gd, &gm, "C:\\TC\\BGI");
 putpixel(x, y, WHITE);
 delay(10);
 for (i = 0; i < stepsize; i++)
 {
  x += xinc;
  y += yinc;
  putpixel(x, y, WHITE);
  delay(50);
 } 
 getch();
 closegraph();
 return 0;
}


Make sure to provide an appropriate path for graphics library.


Read more...

Tuesday, 19 March 2013

How To View Your Gmail Access History Details

I do this thing on a regular basis to know if my account got compromised or not. Well I understand the risks imposed by logging in to my gmail account but still due to several circumstances, I have to login from public PCs. Though I employ some other techniques to trick possible keyloggers/RATs, etc. I do keep running from the dangers of account hijack and hence keep on regularly checking the account history details in gmail.

In order to access the gmail history log details, you need to scroll down to the right bottom of your gmail inbox where you will notice the option to view the detail of your account which looks like below:



Moreover, it seems like that the details now include the user agents and/or access type information along with the IP address and time of access to the gmail account.

If you're concerned about unauthorized access to your mail, you'll be able to use the data in the 'Access type' column to find out if and when someone accessed your mail. For instance, if the column shows any POP access, but you don't use POP to collect your mail, it may be a sign that your account has been compromised.

For more information, refer to this page.



Moreover, this feature lets you log out all of your sessions other than the current session. This can come quite handy whenever you have forgotten to sign out or someone else is having an unauthorized access to your account.


Read more...

Friday, 15 March 2013

Uploaded.net 48 Hours Premium Membership Coupon To Redeem

Hi all, I just bought a Ul.to account and got an extra coupon that lets free users to have 48 hours premium membership. I decided to provided the coupon to one of my readers. I will provide the coupon to one of the people who share URL of my website in the twitter with mention to me (@techgaun). I'll decide the winner on 16th March. So start tweeting :P (You understand I need something in return for this coupon :) )

Coupon code: UBTIZYMM


Read more...

Saturday, 9 March 2013

Check Battery Status From Terminal [How To]

Since I had no graphical interface for some reason, I needed some alternative way to check the battery status. If your system includes acpi command, you can just use this command but I had no luxury of such command and here's how you can do the same thing I did. The /proc/ virtual file system has information of different states among which the ACPI information is one. The ACPI information provides us the details of device configurations and power status of the system. Below is one flavor of the command to check the battery status:

samar@Techgaun:~$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: charged
present rate: unknown
remaining capacity: unknown
present voltage: 12276 mV

samar@Techgaun:~$ cat /proc/acpi/battery/BAT0/info
present: yes
design capacity: 4400 mAh
last full capacity: unknown
battery technology: rechargeable
design voltage: 10800 mV
design capacity warning: 250 mAh
design capacity low: 150 mAh
cycle count: 0
capacity granularity 1: 10 mAh
capacity granularity 2: 25 mAh
model number: Primary
serial number:
battery type: LION
OEM info: Hewlett-Packard


The first command provides the general status of the battery and the second command provides the detailed information about battery. The other way is to use the upower command that talks with the upowerd daemon. Upowerd daemon is a default daemon in ubuntu and few others for power statistics. Below is the command to see battery details:

samar@Techgaun:~$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
native-path: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
vendor: Hewlett-Packard
model: Primary
power supply: yes
updated: Sat Mar 9 10:12:17 2013 (5 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: empty
energy: 0 Wh
energy-empty: 0 Wh
energy-full: 47.52 Wh
energy-full-design: 47.52 Wh
energy-rate: 0 W
voltage: 12.28 V
percentage: 0%
capacity: 100%
technology: lithium-ion


If you wish to install acpi for future uses, you can do so by typing the command below:

samar@Techgaun:~$ sudo apt-get install acpi


Play around with different switches by looking over the help and man pages. You will find this tool quite useful :)


Read more...

Friday, 8 March 2013

Encrypt/Decrypt Confidential Data Using OpenSSL

If you wish to perform encrypted file transfers, openssl provides a robust implementation of SSL v2/3 and TLS v1 as well as full strength generic cryptographic functionalities. Available for almost every commonly used operating system, openssl can be used as a general purpose tool instead of looking for other specialized tools.

If you wish to have full strength cryptographic functions, openssl is a perfect choice. Forget about all other tools that promise to provide high end encryption for your confidential data. Openssl is more than enough for most of your cryptographic needs. Personally, I can't just rely on some random software that promises to provide full strength cryptography but lacks documentations and detailed reviews. Openssl, however, has a well structured documentation and is an open source implementation.

Openssl supports several ciphers such as AES, Blowfish, RC5, etc., several cryptographic hash functions such as MD5, SHA512, etc., and public key cryptographies such as RSA, DSA, etc. Openssl has been widely used in several softwares most notably the OpenSSH.

Now that we know some basics about what OpenSSL is, lets move on encrypting/decrypting files/data using openssl. OpenSSL can take any file and then apply one of the cryptographic functions to encrypt the file. As an example, we encrypt a confidential file 'priv8' with a password "hello" below:

samar@Techgaun:~$ openssl aes-256-cbc -e -in priv8 -out priv8.enc -pass pass:hello


In order to decrypt the encrypted file, we can run the following command:

samar@Techgaun:~$ openssl aes-256-cbc -e -in priv8.enc -out priv8 -pass pass:hello


Now that you know the basic syntax, you can choose among several available cryptographic functions. There are several other symmetric ciphers available for use. The full list of these ciphers is provided by the command:

samar@Techgaun:~$ openssl list-cipher-algorithms


I hope this helps for your file encryption needs :)


Read more...

Thursday, 7 March 2013

Make An Encrypted Call On Android Using RedPhone

If you are quite worried about your privacy while making voice calls on your phone, RedPhone is a perfect tool to install in your android phone. RedPhone ensures that the eavesdropping attackers can not sniff your call by providing end-to-end encryption.

RedPhone is an open source communication encryption android software that well-integrates with the system dialer and lets you use the default system dialer and contacts apps to make calls as you normally would. The tool is written by Maxie Morlinspike, the same guy who wrote a famous tool called SSLStrip for performing HTTPS stripping attacks.

Install RedPhone





It is an open source tool licensed under GPL v3; the github README says, RedPhone is an application that enables encrypted voice communication between RedPhone users. RedPhone integrates with the system dialer to provide a frictionless call experience, but uses ZRTP to setup an encrypted VoIP channel for the actual call. RedPhone was designed specifically for mobile devices, using audio codecs and buffer algorithms tuned to the characteristics of mobile networks, and using push notifications to maximally preserve your device's battery life while still remaining responsive.

If you wish to understand more on Encryption protocol, you should refer to the WIKI.

Install RedPhone




Read more...

E-Paath - A Perfect Computer-based Learning Tool For Your Children

If you are looking for good computer based learning materials for your small children, e-paaath (E-/Online Lesson) is a perfect choice esp. for the Nepali education scenario. I don't know how much has been done to take this software to the reach of the students/children but I think this software can be a very useful interactive learning material for children.

Developed by OLE Nepal in collaboration with the Department of Education (Nepal), this web-based software provides several modules of online lessons for classes 2-6. The software consists of 18-30 lessons organized in a weekly fashion for four subjects: Nepali, English, Mathematics, and Science. The contents for science are available in both English and Nepali languages. However, mathematics is available only in Nepali language.



E-paath is a flash based content and hence requires flash player and can be run through any of the major web browsers such as Mozilla Firefox, Google Chrome, etc. Since e-paath is a web based content, you can run it in any platform without any problem (I had to change a little bit of code in karma.html file to run the tool smoothly in Linux but its still fine; having a web server to serve the pages solves all errors though).

You can download e-paath from HERE. For installation help, you can refer to this page. You can also access the software online from HERE. Btw, there is no specifically linux version of tool available in the website (except for Sugar desktop environment) and don't try to mirror the online version of e-paath as flash contents seem to be internally referencing the configuration files. Your best bet is to download either of the two available versions and then delete all the unnecessary stuffs in there. It just runs fine.


Read more...

Tuesday, 12 February 2013

Chaining The Proxies With ProxyChains

In this tutorial, we will learn to redirect our TCP traffics through the chain of proxies using a well known tool named ProxyChains.

ProxyChains is a tool for tunneling TCP and DNS traffics through chain of several proxy servers which supports HTTP, SOCKS4, and SOCKS5 proxy servers. Hence, this tool leverages several usages such as anonymity, bypassing filters, running any program through proxy servers, etc.

You can DOWNLOAD proxychains from SourceForge. In ubuntu, you can directly install it from repos:

samar@samar-Techgaun:~$ sudo apt-get install proxychains


Once you have installed the proxychains, you need to configure this tool. The global configuration file is located at /etc/proxychains.conf so if you wish to have your own configuration file, you could either create the proxychains.conf file in the current working directory or at $HOME/.proxychains/proxychains.conf.

In my example, I'll edit the global configuration file by issuing the command:

samar@samar-Techgaun:~$ sudo nano /etc/proxychains.conf


First, we will have to select the kind of chaining option we want to use. We can use one of the dynamic_chain, strict_chain, and random_chain chaining options. In most cases, it is good to just use the dynamic_chain so we uncomment the line containing dynamic_chain and comment all other chaining options.



Then we need to grab some proxies and then insert at the end of our configuration file which would look like:

socks4 127.0.0.1 9050
socks5 192.168.2.90 3128
socks5 1**.1**.*.* 8080


You could add as much as proxy servers in the list. Btw, the asterisks in the above example do not mean wildcards, they are just there to symbolize some proxy server. There are free sites on the Internet which provide big database of different kinds of proxies. Even several proxy scrapers are available all over the internet and you could even write one on your own. So getting list of good proxies is not the difficult job. Once you finish the configuration, you can run any command through proxychains. The syntax is as simple as below:

samar@samar-Techgaun:~$ proxychains <any_command>


For example, below is the example nmap scan run through the proxychains:

samar@samar-Techgaun:~$ proxychains nmap -p 1-1000 -O victim.tld


P.S. If you are interested in some GUI for using proxychains, you can use ProxyChainsGUI. Lastly, the default package from Ubuntu repository seems to be missing the proxyresolv command so I would recommend to compile the source code locally.

Read more...

Thursday, 7 February 2013

NCell Paisa Double For Prepaid and Pro Classic customers

Ncell has introduced yet another offer, the Paisa Double for all the prepaid and pro classic customers which will be available for next eight weeks.

With the Ncell's Paisa Double offer, you will be able to double the said amount. Ncell says that it is a new offer that acknowledges the loyalty of Ncell customers by providing them various amounts to double.

Once you have enough main balance, you can activate the offer by dialing 1212. In order to utilize the scheme, you have to follow the steps as below:

  • Dial 1212 and listen to find out what amount you can double. Then press 1 to get the double of the said amount. Alternatively, you can also dial *1212# and press 1.
  • After you press 1, the said amount will be deducted from your main balance and the double of it will be added as your Paisa Double balance.


While the offer sounds great, it is only applicable within Ncell network. You can use the Paisa Double balance to make calls, send SMS and MMS within Ncell network and even to access internet. You can subscribe Ncell Paisa Double offer only once and it will be auto-renewed every week until you deactivate or till the offer ends.

Dial *101# to know your remaining Paisa Double balance. If you wish to deactivate the service, type R and send it to 1212 through SMS. However, you can again activate if you wish within the offer period.


Read more...

Wednesday, 30 January 2013

Search Text Over Multiple PDF Files In Linux

You can use the old grep command or the small script using the pdftotext command to search text over multiple pdf files but we are talking about a simple utility that lets us to search text in PDF files.

The pdfgrep tool lets you perform grep style search over multiple pdf files easily from the terminal. It depends upon the poppler package and under ubuntu, you can just type the command below to install pdfgrep.

samar@\Techgaun:~$ sudo apt-get install pdfgrep


Once pdfgrep is installed, you can perform any kind of search like you would do while using the grep command. Enjoy grepping the PDF files :)


Read more...

Tuesday, 29 January 2013

Turn Your Greasemonkey Script Into Firefox Extension

Well I came across this online tool which lets you compile your greasemonkey scripts which we commonly call User Script into a working firefox extension. Hence I decided to share the link.

Greasemonkey Compiler

I hope the URL proves useful to you guys :)


Read more...

Swasthani.com Swasthani Ripper

Yesterday I came to know that I can listen Swasthani online at this site, www.swasthani.com and I decided to write a swasthani audio downloader. Since it would be useful for everyone, here is the script.

From the site itself, Sri Swasthani Brata Katha is a very popular ritual observed in Nepal in the Poush month (January – February) during winter. Goddess Sri Swasthani, known to grant wishes of her devotees, is worshipped for the whole month of Poush. The Swasthani Brat Katha (story) is recited everyday. The month long telling of the tales are dedicated to the Goddess and the stories that are mainly narrated are those of Swasthani Devi, Lord Shiva and other Gods.

#!/bin/bash
###############################################
# Swasthani.com Swasthani Ripper       #
# Samar @ http://www.techgaun.com       #
###############################################
if [[ ! -f /tmp/swasthani.txt ]]
then
 wget http://www.swasthani.com/ -O - | egrep '<li class="leaf( first| last)?"><a href="/swasthani/' | grep -o '<a .*href=.*>' | sed -e 's/<a /\n<a /g' | sed -e 's/<a .*href=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d' > /tmp/swasthani.txt
fi

while read -r line
do
 wget "http://www.swasthani.com$line" -O - | egrep 'data="soundFile=http://www.swasthani.com/system/files/' | cut -d\" -f6 | cut -d= -f2 | wget -nc -i -
done </tmp/swasthani.txt


Save the above file as swasthani, then chmod for executable permission and run it. If you have problem copying above code, you can check the Swasthani Downloader at GitHub. Enjoy listening Swasthani, geeks :)


Read more...

How To Check Which Groups You Belong To

In this post, you will get to know about a simple command that lets you know what groups the particular user belongs to. Users and groups are the one of the several concepts employed in the Linux systems for access control.

From the man page, the groups command does is:
Print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if the groups database has changed).

So if you are interested in finding what group a particular user is in, run the command as below. Replace samar with your USERNAME and you are good to go:

samar@Techgaun:~$ groups samar

samar : samar adm cdrom sudo vboxusers ....


I hope this proves useful :)


Read more...

Saturday, 26 January 2013

NCell PRBT Settings Information

This post provides the information regarding how to use the PRBT system provided by NCell.

Original Link: PRBT Information @ Ncell

Q1.What is PRBT?

PRBT service enables the ones who call you to listen to a popular melody or sound instead of the regular tone. The sound or melody is heard by the caller till the call is answered. Your friends and partners, regardless of operator, location and phone model while calling you can hear melodies, sounds and personal greetings chosen by you instead of usual phone tone.

Q2. How to activate PRBT service?

PRBT can be activated by one of the following ways:

I. SMS: On your Message box type A and send it to 900227

II. IVR: Dial 9208 and follow the instruction.

III. USSD: Dial *100*2# and follow the USSD guide instruction.

Q3. How to set a PRBT?

Any PRBT of your choice can be set via SMS, IVR or Web once the user has activated the PRBT service. Stated below are the ways a subscriber can set a PRBT.

I. SMS: Type BUY PRBTcode sends it to 9209.

II. Web :

i. Log on to prbt.ncell.com.np

ii. Click on Order for your choice of PRBT song

III. IVR: Dial 9208 to choose the tone of your choice.

Q4. What are the features with new PRBT system?

The PRBT system allows a subscriber to perform the following:

I. SMS

a. Download multiple PRBTs at once

Example:

DownPRBTcodePRBTcodePRBTcode

b. Gift PRBT to friend

Example: Gift Mobile number

II. Web

To activate any of the features below, the user will have to login with mobile number and password on prbt.ncell.com.np

a. Assign different PRBT to different callers.

i. Click on MY PRBT > PRBT Settings > Advanced Setting

b. Create Group and allocate a PRBT for a group.

i. Click on MY PRBT > Group Management

c. Play different PRBT in different time slots.

i. Click On MY PRBT > PRBT setting > Add

d. Copy a PRBT from a friend.

i. Click on MY PRBT > Copy PRBT

Q5. How much does a PRBT cost and what is the validity?

Each PRBT will attract Rs. 10 excluding the taxes.

Q6. Is there monthly subscription price?

Yes. There will be Rs 10 monthly subscription price without applicable taxes. The subscription will be renewed automatically unless the subscriber chooses to discontinue the service.

Q7. How deactivate PRBT?

You can deactivate by any of the following ways:

I. SMS : In your message box type R and send it to 900227

II. IVR : Dial 900 follow instruction

III. USSD : Dial *100*2# and follow the instruction




Read more...

Subterfuge - An Automated MITM Attack Framework

Subterfuge is a very useful tool for hackers and security experts for automating the man-in-the-middle attacks. It provides a complete framework for automating different kinds of MITM attacks.

Subterfuge largely transforms the complexity of performing the man-in-the-middle attacks with the tools such as ettercap and makes it far more easier to launch various form of MITMs. Hence, even a general computer user can perform MITM using this tool. Subterfuge provides a very clear interface accessible over HTTP through browser through which we can view the intercepted authentication data. The tool also supports several other form of MITM attacks such as session injection, http code injection, fake AP, and DNS spoofing.

Currently, the 4.3 beta version of this tool is available as the latest release. You can download the tool and read about the tool at code.google.com/p/subterfuge.

Installation is straightforward. Download the tar file from the above link and then run the following commands in terminal:

samar@samar-Techgaun:~$ tar -xvf SubterfugePublicBeta4.3.tar.gz samar@samar-Techgaun:~$ python install.py -i


After a while, the installation will complete. Now you can run the subterfuge framework by typing subterfuge in your terminal. Enjoy hacking :)

Read more...

Tuesday, 22 January 2013

Simple Sorting Algorithm Using DMA

This post provides the source code for simple and naive integer sorting algorithm by exploiting the dynamic memory allocation feature of C programming.

#include <stdio.h>
#include <stdlib.h>

int main()
{
 int *arr, i, j, n;
 
 printf("Enter the number of items: ");
 scanf("%d", &n);
 
 arr = malloc(n * sizeof(int));
 
 for (i = 0; i < n; i++)
 {
  printf("Enter the %dth item: ", i + 1);
  scanf("%d", &arr[i]);
 }
 
 for (i = 0; i < n - 1; i++)
 {
  for (j = 0; j < n - 1; j++)
  {
   int temp;
   
   if (arr[j] > arr[j + 1])
   {
    temp = arr[j];
    arr[j] = arr[j + 1];
    arr[j + 1] = temp; 
   }
   
  }
 }
 
 printf("The sorted array is:\n");
 
 for (i = 0; i < n; i++)
 {
  printf("%d\n", arr[i]);
 }
 return 0;
}
samar@samar-Techgaun:~$ gcc -Wall -o sort sort.c 
samar@samar-Techgaun:~$ ./sort 
Enter the number of items: 5
Enter the 1th item: 2
Enter the 2th item: 4
Enter the 3th item: 1
Enter the 4th item: 92
Enter the 5th item: 45
The sorted array is:
1
2
4
45
92




Read more...

Matrix Multiplication Using DMA [C Source Code]

This post provides a source code for matrix multiplication by dynamically allocating memory for matrices to be multiplied and multiplication of those matrices.

#include <stdio.h>
#include <stdlib.h>

int main()
{
 int **A, **B, **C, m, n, p, q, i, j, k;
 printf("Enter the size of matrix A: ");
 scanf("%d %d", &m, &n);
 
 printf("Enter the size of matrix B: ");
 scanf("%d %d", &p, &q);
 
 if (n == p)
 {
  A = malloc(m * sizeof(int));
  B = malloc(p * sizeof(int));
  C = malloc(m * sizeof(int));
  
  for (i = 0; i < m; i++)
  {
   A[i] = malloc(n * sizeof(int));
   C[i] = malloc(q * sizeof(int));
  }
  
  for (i = 0; i < p; i++)
  {
   B[i] = malloc(q * sizeof(int));
  }
   
  printf("Enter the matrix A:\n\n");
  for (i = 0; i < m; i++)
  {
   for (j = 0; j < n; j++)
   {
    scanf("%d", &A[i][j]);
   }
  }
  
  printf("Enter the matrix B:\n\n");
  for (i = 0; i < p; i++)
  {
   for (j = 0; j < q; j++)
   {
    scanf("%d", &B[i][j]);
   }
  }
  
  for (i = 0; i < m; i++)
  {
   for (j = 0; j < q; j++)
   {
    C[i][j] = 0;
    for (k = 0; k < n; k++)
    {
     C[i][j] = C[i][j] + (A[i][k] * B[k][j]);
    }
   }
  }
  
  printf("Multiplication of given matrices is: \n\n");
  
  for (i = 0; i < m; i++)
  {
   for (j = 0; j < q; j++)
   {
    printf("%d ", C[i][j]);
   }
   printf("\n");
  }
 
  for (i = 0; i < m; i++)
  {
   free(A[i]);
   free(C[i]);
  }
  for (i = 0; i < p; i++)
  {
   free(B[i]);
  }
  free(A);
  free(B);
  free(C);
 }
 else
 {
  printf("Matrix multiplication is not possible for given size\n\n");
 }
 return 0;
}
samar@samar-Techgaun:~$ gcc -Wall -o matrix_mul matrix_mul.c
samar@samar-Techgaun:~$ ./matrix_mul 
Enter the size of matrix A: 3 2
Enter the size of matrix B: 2 3
Enter the matrix A:

1 2
3 4
5 6
Enter the matrix B:

1 2 3
4 5 6
Multiplication of given matrices is: 

9 12 15 
19 26 33 
29 40 51 



Read more...

Thursday, 17 January 2013

Addition Of Two Matrices Using DMA [C Source Code]

Here is the source code in C that makes use of DMA function malloc() to dynamically allocate the memory for matrices and find their sum.
#include <stdio.h>
#include <stdlib.h>

int main()
{
 int **A, **B, **C, m, n, p, q, i, j;
 printf("Enter the size of matrix A: ");
 scanf("%d %d", &m, &n);
 
 printf("Enter the size of matrix B: ");
 scanf("%d %d", &p, &q);
 
 if (m == p && n == q)
 {
  A = malloc(m * sizeof(int));
  B = malloc(m * sizeof(int));
  C = malloc(m * sizeof(int));
  
  for (i = 0; i < m; i++)
  {
   A[i] = malloc(n * sizeof(int));
   B[i] = malloc(n * sizeof(int));
   C[i] = malloc(n * sizeof(int));
  }
   
  printf("Enter the matrix A:\n\n");
  for (i = 0; i < m; i++)
  {
   for (j = 0; j < n; j++)
   {
    scanf("%d", &A[i][j]);
   }
  }
  
  printf("Enter the matrix B:\n\n");
  for (i = 0; i < m; i++)
  {
   for (j = 0; j < n; j++)
   {
    scanf("%d", &B[i][j]);
   }
  }
  
  for (i = 0; i < m; i++)
  {
   for (j = 0; j < n; j++)
   {
    C[i][j] = A[i][j] + B[i][j];
   }
  }
  
  printf("The addition of two matrices is: \n\n");
  
  for (i = 0; i < n; i++)
  {
   for (j = 0; j < m; j++)
   {
    printf("%d ", C[i][j]);
   }
   printf("\n");
  }
 
  for (i = 0; i < m; i++)
  {
   free(A[i]);
   free(B[i]);
   free(C[i]);
  }
  free(A);
  free(B);
  free(C);
 }
 else
 {
  printf("Matrix addition is not possible for given size\n\n");
 }

 return 0;
}


Below is a sample run along with the compilation step.

samar@samar-Techgaun:~$ gcc -Wall -o matrix_addn matrix_addn.c
samar@samar-Techgaun:~$ ./matrix_addn 
Enter the size of matrix A: 2 2
Enter the size of matrix B: 2 2
Enter the matrix A:

1 2
3 4
Enter the matrix B:

4 3
2 1
The addition of two matrices is: 

5 5 
5 5 



Read more...

Tuesday, 15 January 2013

Transpose Of Matrix Using DMA [C Source Code]

This snippet utilizes the dynamic memory allocation function, malloc() and finds the transpose of the user provided matrix.

Below is the source code:

#include <stdio.h>
#include <stdlib.h>

int main()
{
 int **matrix, **transpose, m, n, i, j;
 printf("Enter the size of matrix: ");
 scanf("%d %d", &m, &n);
  
 matrix = malloc(m * sizeof(int));
 transpose = malloc(n * sizeof(int));
 
 for (i = 0; i < m; i++)
 {
  matrix[i] = malloc(n * sizeof(int));
 }
 
 for (i = 0; i < n; i++)
 {
  transpose[i] = malloc(m * sizeof(int));
 }
  
 printf("Enter the matrix:nn");
 for (i = 0; i < m; i++)
 {
  for (j = 0; j < n; j++)
  {
   scanf("%d", &matrix[i][j]);
  }
 }
 
 for (i = 0; i < m; i++)
 {
  for (j = 0; j < n; j++)
  {
   transpose[j][i] = matrix[i][j];
  }
 }
 
 printf("The transpose of given matrix is: nn");
 
 for (i = 0; i < n; i++)
 {
  for (j = 0; j < m; j++)
  {
   printf("%d ", transpose[i][j]);
  }
  printf("n");
 }

 for (i = 0; i < m; i++)
 {
  free(matrix[i]);
 }
for (i = 0; i < n; i++)
 {
  free(transpose[i]);
 }
 free(matrix);
 free(transpose);
 return 0;
}


Below is the sample run:

samar@Techgaun:~$ gcc -Wall -o transpose transpose.c 
samar@Techgaun:~$ ./transpose 
Enter the size of matrix: 2 3
Enter the matrix:

1 2 3
4 5 6
The transpose of given matrix is: 

1 4 
2 5 
3 6



Read more...

Friday, 11 January 2013

Java 0-day In The Wild - Disable Java Plugin NOW

Security researchers have discovered yet another critical Java 0-day exploit being used by majority of the browser exploit packs such as Blackhole and Cool. Users are urged to DISABLE the Java plugin RIGHT NOW.

French researcher Kaffeine discovered that the java 0-day has been spotted to be making big hits daily, in a blog post. This particular exploit has proven to be very serious threat for the users. The folks at AlienVault Lab have also reproduced the exploit and it seems to work over all the java versions across all platforms which is a very serious threat.

As for now, the users are highly urged to disable their JAVA plugins right now so that they do not get hit by these 0-days.

So what are you waiting for?

Important links:


How To Disable Java Plugin

Kaffeine's blog post

Alien Vault Labs Post


Read more...

Thursday, 10 January 2013

Create Backup Of List Of Apps Installed In Ubuntu

When my laptop's HDD was near to death, I had created backup of the list of all applications and packages I'd installed in my Ubuntu so that I would be able to install them easily in my new system in new HDD. I had forgotten about it but today suddenly remembered and am sharing this simple technique. Fire up the terminal and type the following:

samar@Techgaun:~$ sudo dpkg --get-selections > installed_apps




Now the list of packages will be saved in the installed_apps file and you can use it for future reference. I hope this is useful ;)


Read more...