Archive for the ‘Tips’ Category

Code formating script

No Comments »
#!/usr/bin/perl -w
 
my $ifile = shift;
my $blank = 0;
my $indent = 2;
open(IFILE, "$ifile") or die "Cannot open $ifile\n";
while(my $line = ) {
  if($line =~ /^\s*else/i
     or $line =~ /^\s*end/i
    ) {  #reduce indent before xxx
    $blank = $blank - 2;
  }
  if($blank > 0) {
    print " " x $blank;  #print several blanks
    print "$line";
  } else {
    print "$line";
    $blank = 0;
  }
  if($line =~ /^\s*if/i
     or $line =~ /^\s*else/i
     or $line =~ /^\s*loop/i
    ) {  #increase indent after xxx
    $blank = $blank + 2;
  }
}

Secure browsing, How to use SSH (encrypted tunnel) for browsing

2 Comments »

Using ssh as a proxy or encrypted tunnel to browse the web can sometimes be necessary:

  1. When you’re at some public place but need to login securely to your work place.
  2. When local access restrictions make life really difficult.

I use SSH for the security reasons. I want to make sure that my security and login information will remain secure:

ssh -D 12345 myuser@remote_ssh_server

Replace myuser with your user account and remote_ssh_server with the IP or Hostname of your server.

The above command will do all, but if you want to add more options, you can add other options like:-

-D 12345: This does the dynamic stuff and makes it behave as a SOCKS server.
-f : This will fork the process into the background after you type your password (for Linux only, on windows skip that).
-C : Turns on compression.
-q : Quiet mode. Since this is just a tunnel we can make it quiet (for Linux only, on windows skip that).
-N : Tells it no commands will be sent. (the -f will complain if we don’t specify this)

Next, set up your browser to use the proxy server. Most browsers include proxy support. For Firefox, go to Edit→Preferences→Advanced→Network→Settings, and specify that you want to use a Manual Proxy, localhost, port 12345 and SOCKS v5 (although OpenSSH supports both versions 4 and 5).

HTTP Proxy (The first input). Must be left blank and add this config to SOCKS only.

Now your browser is using a secure tunnel to your remote SSH server, Enjoy


Securing Linux for Physical Access

No Comments »

 

Physical access is everything, it is almost impossible to prevent machine access/password break if somebody else got physical access to some Linux machine.

But there are some steps you can make somebody work hard to access the machine physically (provided they have good knowledge of Linux). Read the rest of this entry »


How To Download a RPM Package Using yum Command Without Installing On Linux

No Comments »

If you ever wanted to download the rpm package instead of installing it with yum ! you can do that with ease, that is useful when you want to keep backup of some RPMs or want to see what’s inside RPM etc.
Read the rest of this entry »


Install XWindows (Graphical mode) in Linux

4 Comments »

 

If you recently installed linux (CentOS/Fedora/RedHat) with text mode and now want to use its Graphical GUI which was left unchecked during the installation, you can install it from Internet very easily.

Read the rest of this entry »


Facebook Activity Log – How to

No Comments »

 
Recently I lost when I was unable to delete some post from my timeline and then I found that our activity log on our timeline serves many purposes.

You can use it to quickly hide old statuses you have made in the past, or delete them, you can also use it to Unhide statuses that you had previously hidden.
In addition, it shows you comments that you have made on other peoples’ stories/statuses/pictures and will allow you to delete those too, all in one convenient place.

To get there, go to your Timeline, and click on Activity Log.

That will open the activity log, and then you can scroll down to where that story is (or use the date links at the bottom) to find the post/story you want to hide or unhide. Look at the icons in the far right to see which ones are hidden and which ones are visible.

You can then click on the little circle/crossed out circle to select if you want it hidden or not.

If you “Feature” a story, it will take the full width of your timeline, so as to draw attention to that item. Think of it like “this one is important”.