Simple filesharing in Linux – Python HTTPServer

So, want to show something on your machine to another user? Or want to share a file ?
If you have Python installed (default for most *nix systems) the following trick is awesome.

Create the following alias in your .bashrc

alias webshare=’python -c SimpleHTTPServer’

Now just type the command “webshare” in your terminal, and all files in current folder and beneath will be available at

http://localhost:8000

If you dont want to create an alias, just type the following command in your terminal

python -c “import SimpleHTTPServer;SimpleHTTPServer.test()”

Remember, if you start the webserver in your /home/username; folder, you share everything in the folder !

NetHogs – See what process uses your bandwidth

Ever wanted to see what is taking up your bandwidth. There are lots of tools out there for this, but lately I have been taking a closer look at NetHogs.
It is really worth checking out..

NetHogs is a small ‘net top’ tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. NetHogs does not rely on a special kernel module to be loaded. If there’s suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This makes it easy to indentify programs that have gone wild and are suddenly taking up your bandwidth.

Download Nethogs here

MacBook Pro – Bluetooth not available

I just experienced that a recent update from Apple rendered my bluetooth functionality completely dead. The status bar icon was greyed out with a horizontal lightning bolt looking icon crossed through it.

After some time on Google, i find i am not the only one :)
Solutions listed below worked like a charm..


Try resetting the SMC and the PRAM:
http://support.apple.com/kb/HT3964

http://support.apple.com/kb/ht1379

Another solution for a Intel based Macbook Pro..
1. shut down the computer.
2. remove power cord.
3. press the power button for 5 sec.
4. connect the power cord.

Worked excellent

the Euclidean algorithm

Ever heard of the Euclidean algorithm??

From wikipedia:
In mathematics, the Euclidean algorithm[a] (also called Euclid’s algorithm) is an efficient method for computing the greatest common divisor (GCD) of two integers, also known as the greatest common factor (GCF) or highest common factor (HCF).

I have just written a short python program for finding the GCD.. Enjoy..

Gnome – Loosing Maximize Minimize buttons in titlebar

On my Linux Mint installation i have recently experienced that the titlebar is gone. Loosing the minimize,maximize and close buttons.

I have been doing some extensive googling on the problem and found two solutions, whereas only one worked for me.

Open terminal and type :

metacity –replace

This solution worked on my Linux Mint 11 installation

The solution below did not work for me, but others have stated that it worked on other Gnome based distros.

Open terminal and give the command:

xfwm4 &

Java – Using configuration files

I recently came across a situation where i needed a small configuration file in my Java project.
Using XML would in most cases be the way to go, but in this particular situation, using XML would be complete overkill.

I only needed a few variables in my configuration file, and for this, Java has a built-in solution that works great.
Ever heard of .properties files ??

Continue reading

Backspace error in SSH sessions – acts as Delete key

In OSX 10.6.xx (Snow Leopard) users who use the Terminal application to SSH into remote servers might experience that the backspace key works as the delete key in some applications (VI, Nano, Pico etc) I have not heard of this happening in any other OS or application, so an easy way to fix this in Terminal configuration on your Mac.

Go to Terminal preferences, select the Advanced tab, and check “Delete sends Ctrl-H”. That’s all it takes to get the “delete” key to work correctly in all applications used in your SSH sessions.

 

 

CCleaner – Add your custom files or folders for deletion

CrapCleaner is a great tool for removing all sorts of crap, *doh, from your computer.
But many users doesn’t know about all features in this program.
Most users often don’t bother with exploring what is actually available in different software.

Well, in CCleaner you can add any folder you want, for deletion when you run the Cleaner.

Continue reading

Remove weird 100mb partition in Windows 7

When installing Windows 7 on a fresh and new HDD with no partitions present, the installation process will create a 100mb partition that is marked as system reserved. This partition is available only for:
Windows 7 Ultimate,
Windows 7 Business
Windows 7 Enterprise ed.

The 100 MB system partition is used primarily as BitLocker partition for BitLocker encryption, and the WinRE (Windows Recovery Environment).

Here is a trick to remove that partition, using Windows 7 own tool, diskpartContinue reading

Import of big mySQL dumps

Trying to import your huge SQL dump through phpMyAdmin etc , could sometimes cause huge problems.

BigDump: The staggered MySQL Dumper

Staggered import of large and very large MySQL Dumps (like phpMyAdmin 2.x Dumps) even through the web servers with hard runtime limit and those in safe mode. The script executes only a small part of the huge dump and restarts itself. The next session starts where the last was stopped.

Visit Ozerov for the excellent script….