Friday, September 29, 2006

i have lost the ability to read

I think one of the by products of the internet generation is the lost of ability to read.

Lets face it. there is so much junk out there that after a while you get ignore the bulk of it, or start reading 3 words and make up the rest of the article or email.

I have to admit out of the 50 - 80 emails I get a day from my 3-5 mailboxes, I probably only read like 5 and that is like . This means that I only read less than 10% of my emails. I mostly just read the title and quickly decide if it is spam or not.

The same with web surfing, and new program interfaces. if it isn't immediately intuitive its probably not worth using.

So who do you think needs to be improved, the creator or the user?

Thursday, September 28, 2006

tabbing in IE 7 - continued

Well, I ought to correct my previous post. IE 7 does allow you to keyboard shortcut between tabs now since I finally upgraded my browser due to a corrupt application data directory which refuses to fix itself.

Apparently its ctrl tab to move forward following the windows standard. and to go back? Its some finger dexterity which is ctrl-shit-tab.

I suppose it does make some sense to use the right hand to hold the shift if you do need to go back, but I can't say that is second nature to me yet.

How do you beat ctrl page up and page down? thats just so cognitive.

Tuesday, September 19, 2006

windows sshd with cygwin

Apart from using remote desktop or vnc, its good to have a secondary backup method of communicating with your windows machine.

When you install cygwin, make sure you select openssh. this installs both the ssh client as well as the server.

To setup the server there needs to be a couple of really simple steps.

Right click My Computer, Properties, Advanced, Environment Variables.

Click the "New" button to add a new entry to system variables: variable name is "CYGWIN" variable value is "ntsec tty" without the quotes

also add ";c:\cygwin\bin" to the end of the existing PATH variable. To test this start cmd from the command line and type "bash -l"

To setup sshd as a service, just type "ssh-host-config"
"privilege separation be used", answer yes
"install sshd as a service", answer yes
When the script asks you for "CYGWIN=", your answer should be ntsec tty

Basically its like yes to everything and after that type "cygrunsrv --start sshd" or "net start sshd" to start it off.

you can test it by typing ssh localhost on your machine. Make sure you have your windows firewall to allow inbound ssh traffic.

d: drive is /cygdrive/d , e: drive is /cygdrive/e , etc.

Thursday, September 14, 2006

how to setup vtun tunnel via ssh

install vtun

Download the vtun installation rpms (for centos)

wget http://mirror.optusnet.com.au/dag/redhat/el4/en/i386/dag/RPMS/lzo-1.08-4.2.el4.rf.i386.rpm
wget http://mirror.optusnet.com.au/dag/redhat/el4/en/i386/dag/RPMS/vtun-2.6-0.2.el4.rf.i386.rpm

# rpm -ivh lzo-1.08-4.2.el4.rf.i386.rpm
# rpm -ivh vtun-2.6-0.2.el4.rf.i386.rpm



/etc/vtund.conf on client


options {
port 5002; # Connect to this port.
timeout 60; # General timeout

# Path to various programs
ppp /usr/sbin/pppd;
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/ipchains;
ip /sbin/ip;
}


work_to_home {
passwd password; # Password
type ether; # Ethernet tunnel
device tap1; # Device tap1
up {
# Connection is Up

# Assign IP address and netmask.
ifconfig "%% 10.1.0.2 netmask 255.255.255.0";
# Add route to net 192.168.0.0/24
route "add -net 192.168.0.0 netmask 255.255.255.0 gw 10.1.0.1";


};
down {
# Connection is Down

# Shutdown tap device
ifconfig "%% down";
};
}


/etc/vtund.conf on server

options {
port 5002; # Listen on this port.

# Syslog facility
syslog daemon;

# Path to various programs
ppp /usr/sbin/pppd;
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/ipchains;
ip /sbin/ip;
}

# Default session options
default {
compress no; # Compression is off by default
speed 0; # By default maximum speed, NO shaping
}

work_to_home {
passwd password; # Password
type ether; # Ethernet tunnel
device tap1; # Device tap1
proto tcp; # UDP protocol
compress lzo:1; # LZO compression level 1
encrypt yes; # Encryption
stat yes; # Log connection statistic
keepalive yes; # Keep connection alive

up {
# Connection is Up

# Assign IP address
ifconfig "%% 10.1.0.1 netmask 255.255.255.0";

# Add route to net 10.2.0.0/24
route "add -net 131.242.216.0 netmask 255.255.255.0 gw 10.1.0.2";
route "add -net 203.9.184.0 netmask 255.255.255.0 gw 10.1.0.2";

# Enable masquerading for net 10.2.0.0.0/24
# firewall "-A forward -s 10.2.0.0/24 -d 0.0.0.0/0 -j MASQ";
};

down {
# Connection is Down

# Shutdown tap device.
ifconfig "%% down";

# Disable masquerading for net 10.2.0.0.0/24
# firewall "-D forward -s 10.2.0.0/24 -d 0.0.0.0/0 -j MASQ";
};
}


creating connection script for client

Some of this only needs to be done once. The last ssh command creates the sshd tunnel for vtund

echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding

iptables -A POSTROUTING -j MASQUERADE -t nat

vtund -n -f /etc/vtund.conf work_to_home localhost &

ssh -L 5002:localhost:5002 user@server

Tuesday, September 12, 2006

help with unix scripts

To define date and time

DATE=`date '+%y%m%d'`
TIME=`date '+%k%M'`

using awk

LIST=`awk '{print $1}' file`
for OBJECT in ${LIST}
do
echo OBJECT
done

the default awk uses a space, using other separators, use a -F


calling sqlplus

sqlplus -s /nolog </dev/null
connect / as sysdba
set echo off embedded on feedback off heading off linesize 120 pagesize 0 recsep off verify off termout off
EOF


calling ftp

ftp -nv 147.132.19.52 < user userid password
prompt
asc
get file
bye
EOF


mail alerts

mailx -r "reply.to@host.com" -s "Subject" mail.to@host.com < file_contents


using varibles from command line

#!/bin/sh
# Example script to copy files to different hosts
# Assumes same user is on all other servers

if [ $# -lt 1 ]; then
echo "\nUsage: script file [newfile]\n"
exit 1
fi

file=$1
echo $file | grep -q '^/'
if [ $? -ne 0 ]; then
file=$PWD/$file
fi

if [ $# -gt 1 ]; then
newfile=$2
else
newfile=$file
fi
thishost=`uname -n`
user=`id -un`
hostlist="host1 host2"

if [ ! -f $file ]; then
echo "\nCannot copy $file (doesn't exist?)\n"
exit 1
fi


# Copy the file to all the (other) hosts

echo Copying $file to $newfile
for host in $hostlist; do
if [ $host != $thishost ]; then
echo "Copying to $host:"
scp $file ${user}@$host:$newfile
fi
done

Splitting the home network

Who wouldn't want to separate the traffic at home for security reasons. The more common ones include wireless guest and wireless users. ...