A Blog about technology, linux, peer2peer, cool new downloads and software development.

Friday, February 29, 2008

Start hamachi at boot on ubuntu

$ cd /etc/init.d

$ sudo su

$ cat > hamachi

paste the following script :

- - - - - - - - - 8< - - - - - - - - - - 8< - - - - - - - - -

#!/bin/bash
###################################
### Start-up script for Hamachi ###
###################################
USER=[username]
case "$1" in
start)
/sbin/tuncfg

/bin/su - $USER -c "rm -f /home/$USER/.hamachi/.lock"

/bin/su - $USER -c "/usr/bin/hamachi start"
;;
stop)
/bin/su - $USER -c "/usr/bin/hamachi stop"

/bin/su - $USER -c "rm -f /home/$USER/.hamachi/.lock"

;;
restart|force-reload)

/bin/su - $USER -c "/usr/bin/hamachi stop"

/bin/su - $USER -c "rm -f /home/$USER/.hamachi/.lock"

/bin/su - $USER -c "/usr/bin/hamachi start"
;;
*)
exit 1
;;
esac
exit 0

- - - - - - - - - 8< - - - - - - - - - - 8< - - - - - - - - -

$ vim hamachi

change in line 5 USER=to your username

$ chmod a+x hamachi

$ rcconf

check hamachi and select OK


$ chmod -R a+rw /home/[username]/.hamachi/

$ chmod a+rwx /home/[username]/.hamachi/


Downloading files with curl (resume transfer)

$ curl -C - -O  http://mirrors.kernel.org/opensuse/distribution/10.3/iso/dvd/openSUSE-10.3-GM-DVD-i386.iso

Sunday, February 24, 2008

Installing hamachi on ubuntu

debian:/tmp# tar -zxvf hamachi-0.9.9.9-20-lnx.tar.gz
hamachi-0.9.9.9-20-lnx/
hamachi-0.9.9.9-20-lnx/Makefile
hamachi-0.9.9.9-20-lnx/LICENSE
hamachi-0.9.9.9-20-lnx/README
hamachi-0.9.9.9-20-lnx/LICENSE.tuncfg
hamachi-0.9.9.9-20-lnx/LICENSE.openssh
hamachi-0.9.9.9-20-lnx/LICENSE.openssl
hamachi-0.9.9.9-20-lnx/hamachi
hamachi-0.9.9.9-20-lnx/tuncfg/
hamachi-0.9.9.9-20-lnx/tuncfg/Makefile
hamachi-0.9.9.9-20-lnx/tuncfg/tuncfg.c
hamachi-0.9.9.9-20-lnx/tuncfg/tuncfg
hamachi-0.9.9.9-20-lnx/CHANGES

debian:/tmp# cd hamachi-0.9.9.9-20-lnx
debian:/tmp/hamachi-0.9.9.9-20-lnx# ls
CHANGES  hamachi  LICENSE  LICENSE.openssh  LICENSE.openssl  LICENSE.tuncfg  Makefile  README  tuncfg

debian:/tmp/hamachi-0.9.9.9-20-lnx# make install
Copying hamachi into /usr/bin ..
Creating hamachi-init symlink ..
Compiling tuncfg ..
Copying tuncfg into /sbin ..

Hamachi is installed. See README for what to do next.

debian:/tmp/hamachi-0.9.9.9-20-lnx# tuncfg

debian:/tmp/hamachi-0.9.9.9-20-lnx# hamachi-init
Initializing Hamachi configuration (/root/.hamachi). Please wait ..

  generating 2048-bit RSA keypair .. ok
  making /root/.hamachi directory .. ok
  saving /root/.hamachi/client.pub .. ok
  saving /root/.hamachi/client.pri .. ok
  saving /root/.hamachi/state .. ok

Authentication information has been created. Hamachi can now be started with
'hamachi start' command and then brought online with 'hamachi login'.

debian:/tmp/hamachi-0.9.9.9-20-lnx# hamachi start
Starting Hamachi hamachi-lnx-0.9.9.9-20 .. ok
debian:/tmp/hamachi-0.9.9.9-20-lnx# hamachi set-nick [nick]
Setting nickname .. ok
debian:/tmp/hamachi-0.9.9.9-20-lnx# hamachi login
Logging in ....>....... ok
debian:/tmp/hamachi-0.9.9.9-20-lnx# hamachi join [name]
Password:
Joining [name] .. ok

debian:/tmp/hamachi-0.9.9.9-20-lnx# hamachi go-online [name]
Going online in zatz0r .. ok

Friday, February 22, 2008

php/html editors for windows and linux

Some editors for php/html development :

Linux - Bluefish (apt-get install bluefish / yum install bluefish)

Windows - NuSphere PhpED - seach in emule "phped yag"

windows mobile warez

PPC Warez is the best board for all windows mobile software, games, gps related downloads

iGo/Mio latest maps (2008)

Here is the latest map collection, enjoy

 iGO/Mio latest maps

Wednesday, February 20, 2008

Tabbed putty shell

PuTTY Connection Manager is a shell that allows to run several instances of putty in tabs.

 

andLinux - run ubuntu inside windows ala cygwin style

andLinux is an almost full ubuntu distribution that runs inside windows with a linux kernel - cygwin style with very high performance as opposed of vmware that is taxing on system resources as it is an vm emulation.



Xming - free xserver for windows

Xming is a free xserver for windows

works perfectly with putty

Sunday, February 17, 2008

recovering a disk with bad sectors by copying it to another disk with linux

In this tutorial example the dump is from hda to hdb (the hdb disk has to be same size of larger)

# dd_rescue -A -v /dev/hda /dev/hdb

ramdisk in linux tutorial

 

# mkdir /mnt/ramdisk

# mount -t tmpfs none /mnt/ramdisk

map bad sectors on a mounted ext3 partition tutorial

Mount partition as readonly :

# mount -f -r -o remount /dev/hda1

(replace had1 with your mounted ex3 partition)

Scan and mark badblocks :

# e2fsck -c -C 0 -y -v /dev/hda1

(replace had1 with your ex3 partition)

Wednesday, February 13, 2008

mount a directory in another directory (ln -s replacement that works inside chroot)

To allow access to other directory/file from apachee/ftp chroot where ln -s dosent work use :

 

mount --bind olddir newdir

 

from mount man :

Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is
              mount --bind olddir newdir
       After this call the same contents is accessible in two places.  One can also remount a single file (on a single file).

Saturday, February 9, 2008

New downloads update

 

TVUPlayer 2.3.5 beta 4

XAMPP for Windows 1.6.6

Sysinternals Suite Build 02/04/08

Gom Player 2.1.9.3752

Force uninstall of windows applications

use :

msicuu
and
msizap

Linux Performance analyzing tools

nmon performance: A free tool to analyze AIX and Linux performance
Dstat: Versatile resource statistics tool
Linux Benchmarking tools

Simple Home File Server (Based On Ubuntu)

Link to the tutorial :

Simple Home File Server (Based On Ubuntu)

Install Photoshop CS2 on Your Ubuntu PC

Link to the tutorial :

Install Photoshop CS2 on Your Ubuntu PC

progressbar when copying files on linux with cp

A link to a script that displays a progress bar in cp :
http://chris-lamb.co.uk/2008/01/24/can-you-get-cp-to-give-a-

Tuning mysql performance read & write

mysql r/w optimization tips :
read
write

Nagios 3.0 - A Extensible Host and Service Monitoring

http://www.novell.com/coolsolutions/feature/19807.html

ocfs tutorial

http://www.novell.com/coolsolutions/feature/18287.html

Monitor Website in Real-Time with Apachetop

http://www.howtogeek.com/howto/ubuntu/monitor-your-website-in-real-time-with-apachetop/

.vimrc

set nocompatible " must be the first line
filetype on
filetype indent on
filetype plugin on
set laststatus=2


set statusline=%<%f\%h%m%r%=%-20.(line=%l\ \ col=%c%V\ \ totlin=%L%)\ \ \%h%m%r%=%-40(bytval=0x%B,%n%Y%)\%P
syntax on
colorscheme murphy
set number
set tabstop=4
set shiftwidth=4
set ignorecase
set autoindent
set hlsearch
set diffopt+=iwhite
set ruler
set cul

Installing Ubuntu hardy alpha-3 on Lenovo / Ibm ThinkPad T60

Problematic hardware on my specific machine variant :
Intel 82573L copper NIC
Atheros AR5418 wifi NIC
ATI Radeon X1300 Display
1. get the ubuntu as the kubuntu power managment dosent work (didnt check the other variations)
2. check your hardware : sudo su -; lshw | less
3. Install the Intel copper NIC driver for the Intel 82573L chip : http://downloadcenter.intel.com/Detail_Desc.aspx?strState=LIVE&ProductID=983&DwnldID=9180&lang=eng
(follow the instructions, connect the cable before the make / make install or else the phy is powered down to save power)
4. Install the Atheros AR5418 wireless network driver : get the latest driver source from the http://madwifi.org/ svn and compile/isntall per instructions, reboot and use the network manager to configure the wireless network as usual.

vim tabs tutorial

open multiple files in tabs $vim -p file1, file2, ... file10
switch between tabs :tabn / :tabp
add another tab :tabe filename
The full documentation of the tabs system can be accessed with :help tabs

Distributed administration using SSH

http://www.ibm.com/developerworks/aix/library/au-satdistad

HowTo: Emergency Reboot a Remote Machine

http://portal.itauth.com/2007/10/29/linux-howto-emergency-reboot-remote-machine

The first step is to enable the SysRq system, if it's disabled:

echo 1 > /proc/sys/kernel/sysrq

Now you can reboot (instantly, be forewarned) if the machine is hung:

echo b > /proc/sysrq-trigger

LatencyTOP

http://www.latencytop.org/

LatencyTOP is a Linux tool for software developers (both kernel and
userspace), aimed at identifying where system latency occurs, and what
kind of operation/action is causing the latency to happen. By identifying
this, developers can then change the code to avoid the worst latency
hiccups.

HowTo: Linux: Double your disk read performance in a single command

http://portal.itauth.com/2007/11/20/howto-linux-double-your-disk-read-performance-single-command

 


Here's the magic to double sequential read performance:

[root@cyberman mydb]# blockdev --getra /dev/sdb
256
[root@cyberman mydb]# blockdev --setra 262144 /dev/sdb

nixcraft Linux tutorial collection, part-2

http://www.cyberciti.biz/tips/apache-url-rewriting-examples.html
http://www.cyberciti.biz/tips/ubuntu-linux-on-usb-flash-pen-drive.html
http://www.cyberciti.biz/tips/install-photoshop-cs2-on-linux.html
http://www.cyberciti.biz/faq/linux-unix-measure-lateceny-throughput-of-webserver/
http://www.cyberciti.biz/tips/rhel-linux-optimize-3ware-raid-read-performance.html
http://www.cyberciti.biz/faq/howto-rhel-install-xcahce-php-opcode-cacher/
http://www.cyberciti.biz/tips/lighttpd-apache-run-xcache-in-chrooted-jail.html
http://www.cyberciti.biz/tips/linux-use-rsync-transfer-mirror-files-directories.html
http://www.cyberciti.biz/tips/how-do-i-sync-data-between-two-load-balanced-linuxunix-servers.html
http://www.cyberciti.biz/tips/howto-duplicate-directory-using-mirrordir-command.html
http://www.cyberciti.biz/faq/apache-web-server-prevent-directory-folder-listing/
http://www.cyberciti.biz/faq/linux-unix-autologin-cron-ftp-script/
http://www.cyberciti.biz/faq/linux-http-https-reverse-proxy-load-balancer/
http://www.cyberciti.biz/faq/rhel-centos-debian-ubuntu-jumbo-frames-configuration/
http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/
http://www.cyberciti.biz/faq/linux-burn-iso-images-to-cds-and-cd-rws-howto/
http://www.cyberciti.biz/tips/how-do-i-write-cd-at-debain-linux-command-prompt.html
http://www.cyberciti.biz/tips/splits-directory-into-multiple-with-equal-size-for-iso-burning-purpose.html
http://www.cyberciti.biz/tips/rhel-centos-linux-install-configure-rssh-shell.html
http://www.cyberciti.biz/faq/howto-use-linux-truss-strace-command/
http://www.cyberciti.biz/faq/tunning-linux-ext3-filesystem/
http://www.cyberciti.biz/tips/speed-up-apache-20-web-access-or-downloads-with-mod_deflate.html
http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html
http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html
http://www.cyberciti.biz/tips/howto-write-perl-script-to-monitor-disk-space.html
http://www.cyberciti.biz/tips/rhel-centos-mounting-remote-filesystem-using-sshfs.html
http://www.cyberciti.biz/tips/howto-log-user-activity-using-process-accounting.html
http://www.cyberciti.biz/tips/linux-how-to-encrypt-and-decrypt-files-with-a-password.html
http://www.cyberciti.biz/tips/howto-monitor-and-restart-linux-unix-service.html
http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html
http://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a-file.html
http://www.cyberciti.biz/tips/howto-linux-kill-and-logout-users.html
http://www.cyberciti.biz/tips/sending-mail-with-attachment.html
http://www.cyberciti.biz/tips/linux-bond-or-team-multiple-network-interfaces-nic-into-single-interface.html
http://www.cyberciti.biz/tips/how-to-mount-remote-windows-partition-windows-share-under-linux.html
http://www.cyberciti.biz/tips/howto-configure-ubuntu-fedora-linux-pptp

nixcraft Linux tutorial collection, part-1

Collection of the best tips from nixcraft :


http://www.cyberciti.biz/tips/how-do-i-drop-or-block-attackers-ip-with-null-routes.html
http://www.cyberciti.biz/faq/howto-null-route-an-attackers-ip/
http://www.cyberciti.biz/faq/ip_conntrack-table-ful-dropping-packet-error/
http://www.cyberciti.biz/faq/unable-to-display-remote-x-applications-through-telnet-in-linux/
http://www.cyberciti.biz/tips/linux-iptables-how-to-specify-a-range-of-ip-addresses-or-ports.html
http://www.cyberciti.biz/tips/linux-increasing-or-decreasing-tcp-sockets-timeouts.html
http://www.cyberciti.biz/tips/mysql-performance-tuning-tips-and-techniques.html
http://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html
http://www.cyberciti.biz/tips/lighttpd-mod_proxy-to-run-php-fastcgi-app-server.html
http://www.cyberciti.biz/tips/speedup-linux-unix-web-site.html
http://www.cyberciti.biz/tips/howto-create-high-performance-web-site-pages.html
http://www.cyberciti.biz/tips/linux-unix-download-accelerator.html
http://www.cyberciti.biz/tips/distributed-administration-using-ssh.html
http://www.cyberciti.biz/tips/execute-commands-on-multiple-linux-or-unix-servers.html
http://www.cyberciti.biz/tips/linux-creating-shared-storage-with-ocfs2-xen.html
http://www.cyberciti.biz/tips/linux-procfs-file-descriptors.html
http://www.cyberciti.biz/tips/set-up-web-server-cluster.html
http://www.cyberciti.biz/tips/howto-run-wget-in-background.html
http://www.cyberciti.biz/tips/linux-wget-your-ultimate-command-line-downloader.html
http://www.cyberciti.biz/tips/howto-rhel-centos-fedora-squid-installation-configuration.html
http://www.cyberciti.biz/tips/how-to-use-screen-command-under-linux.html
http://www.cyberciti.biz/tips/backup-postgres-mysql-securely-using-ssh.html
http://www.cyberciti.biz/tips/how-fast-is-linux-sata-hard-disk.html
http://www.cyberciti.biz/tips/install-photoshop-cs2-on-linux.html
http://www.cyberciti.biz/tips/howto-see-grep-command-output-in-colours.html
http://www.cyberciti.biz/tips/linux-increase-outgoing-network-sockets-range.html
http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html
http://www.cyberciti.biz/tips/rhel-centos-fedora-linux-iscsi-howto.html
http://www.cyberciti.biz/faq/howto-setup-debian-ubuntu-linux-iscsi-initiator/
http://www.cyberciti.biz/faq/linux-open-iptables-firewall-port-22-23/
http://www.cyberciti.biz/faq/howto-display-iros-under-linux/
http://www.cyberciti.biz/faq/proxy-authentication-in-linux-unix-squid-cache/
http://www.cyberciti.biz/tips/howto-linux-iptables-block-p2p-traffic.html
http://www.cyberciti.biz/faq/delete-all-root-email-mailbox/
http://www.cyberciti.biz/tips/howto-find-memory-used-by-program.html
http://www.cyberciti.biz/faq/linux-unix-tunneling-xwindows-securely-over-ssh/
http://www.cyberciti.biz/tips/linux-unix-profiling-network-connectivity-with-fping.html
http://www.cyberciti.biz/tips/linux-unix-subversion-svn-howto.html

Compiling emule that dosent upload - leecher mod

Visual Studio 2005 is needed to compile emule.
The easiest way to compiling emule is to download the emule source together with the libraries, the best one is emule-morphXT mod :
http://emulemorph.sourceforge.net/modules.php?name=Downloads&d_op=viewdownload&cid=2
Moding emule for no upload :
Find the file : UploadQueue.cpp
in it change the function :
"void CUploadQueue::AddClientToQueue(CUpDownClient* client, bool bIgnoreTimelimit) {"
add a "return;" below the declaration so that the function return immediately.

.screenrc

here is a .screenrc that displays various statistics like cpu, load avarages, memory, bandwidth utilization and display and easily switch between virtual windows (work like tabs)
escape char : ^x
create window ^x-c
switch between windows : F11/F12
Screenshot :

$ cat > ~/.screenrc
---------- 8< ---------- 8< ---------- 8< ----------




vbell on
startup_message off
shell -bash
term linux
#term screen-bce
#term xterm
defbce on
defscrollback 2000
defescape ^Xx
escape ^Xx
term screen-256color
defutf8 on
bindkey -k F1 prev # F11
bindkey -k F2 next # F12

backtick 0 10 10 awk '{ printf "%sC", $2 }' /proc/acpi/thermal_zone/THRM/temperature

backtick 1 60 60 awk '{if ($1=="MemTotal:") mt = $2; if ($1=="MemFree:") mm = $2; if ($1=="Buffers:") mb = $2; if ($1=="Cached:") mc = $2} END {printf ("%2.1f"), ((mt-(mm+mb+mc)) * 100 / mt);print "%M"}' /proc/meminfo

backtick 2 60 50 awk '{if ($1=="SwapFree:") fs = $2; if ($1=="SwapTotal:") ts = $2} END {printf ("%2.1f"),((ts-fs) * 100 / ts );print "%S"}' /proc/meminfo

backtick 3 0 0 awk 'BEGIN {file = "/proc/stat";while (a==a) {getline < u="$2-up;s=" n="$4-np;i=" up="$2;sp=" np="$4;i" p="$5;close(file);system(" file="/proc/net/dev" a="=" d="substr($1,6,10);u=" printf="" 1f="" k="" s="" pri="">
ntf "%4.1f k/s\n",((u-up)/1024)}};close(file);dp=d;up=u;system("sleep 2")}}'

caption always "%{wk}%H|%{wk}%0` %1` %2` %3` |%4` %{wk}| %{wk}%l%{wk} | %Y-%m-%d %c | %{+b w}%-w%{-b kw}%n %t%{-}%+w %-= %=%{wk}|"

borland colorscheme for vim

Download the borland.vim file and follow the instructions to install from : http://www.vim.org/scripts/script.php?script_id=92
Screenshot :

.vimrc

syntax on
colorscheme murphy
set number
set tabstop=4
set shiftwidth=4
set ignorecase
set autoindent
set hlsearch
set diffopt+=iwhite
set ruler

installing squid on windows

Download squid for windows from :

http://squid.acmeconsulting.it/download/squid-2.6.STABLE18-bin.zip

Read the installation instructions in the documentation.

Change the c:\squid\etc\squid.conf from the default :

acl home src 192.168.0.0/255.255.255.0 # (change if different network subnet)

http_access allow home

cache_dir aufs c:/squid/var/cache 1000 16 256

dns_nameservers 208.67.222.222

run the following commands :

mkdir c:\squid\var\cache

c:\squid\sbin\squid -z

Done, run squid :

squid

configuring squid proxy on ubuntu

$ sudo su -
# apt-get install squid
# vi /etc/squid/squid.conf
configure the proxy port to 8081 (this the port that needs to be configured in the browser)
search for "http_port" and change to "http_port 8081"
configure the cache to use 2GByte storage
search for "cache_dir" and change to "cache_dir aufs /var/spool/squid 2000 16 256"
(change the storage type from ufs to aufs, explanation from the squid.conf file :
# The aufs store type:
#
# "aufs" uses the same storage format as "ufs", utilizing
# POSIX-threads to avoid blocking the main Squid process on
# disk-I/O. This was formerly known in Squid as async-io.)
configure the access list for example :
acl our_networks src 192.168.0.1/24
http_access allow our_networks
start squid :
# /etc/init.d/squid restart

We Come In Peace Shirt



Get it here

htop - replacement for the top command in linux















htop - an interactive process viewer for Linux

htop is an interactive process viewer for Linux. It is a text-mode application (for console or X terminals). works with Linux 2.4 and 2.6.

http://htop.sourceforge.net/