Thursday, December 27, 2012

Try bitvise ssh client (tunnelier) & Bitvise SSH Server (WinSSHD)

Tried out, bitvise SSH client (tunnelier), sftp client and & Bitvise SSH Server (WinSSHD) - Pretty awesome and surely an edge over pure putty. Try out folks...

Monday, November 5, 2012

githut d3 example

Chris Manning page

Friday, November 2, 2012

daily JS - Awesome

Tuesday, October 23, 2012

Thursday, October 18, 2012

Reverting git commit

Reverting - git commit - $ git commit -a - Commit mistake $ git reset --soft HEAD^ - Revert the commit $ vi - Do what you need to do, any additional changes $ git add . - as usual $ git commit -c ORIG_HEAD - Now, Good intentional commit

Tuesday, October 16, 2012

DBIX Deployement Handler Tips

Awesome javascript frameworks compared

Thursday, October 4, 2012

Magic with css

Wednesday, September 26, 2012

Awesome site for html color codes

Friday, September 21, 2012

Wednesday, September 19, 2012

html 5 data attributes simplified

Introducing Gith - GitHub WebHooks For Node

Slightly off topic but interesting

Friday, September 14, 2012

Git: Not currently on any branch

"Not currently on any branch" means you have a detached head, i.e. your HEAD pointer is directly referencing a commit instead of symbolically pointing at the name of a branch. You can get into this situation by checking out a commit by SHA1, or when you’re in the middle of a rebase, or when a merge fails. It’s hard to say what you may have done to get into this situation by accident. It’s said that you may lose your changes when you switch from a detached HEAD to some branch, but the reflog will always keep track of where your HEAD moved. In fact, Git 1.7.5 will warn you when switching from a detached HEAD will lose commits. The only time you can really lose work is when you have uncommitted changes, which you may want to commit or stash. A simple way to see what happened is git reflog or git log -g --decorate for a more verbose listing. The --decorate option will label every SHA1 with the names of all the branches that point at it. If the SHA1 of your current HEAD is exactly the same as master, then you don’t have to do anything but git checkout master to get back on track. Otherwise, see if the SHA1 is pointed to by some other branch. If not, you may wish to create a branch to hang on to it. Another good command is git branch -av, which will similarly list all branches and what they point to, so you can see what your (no branch) is really supposed to be.

What's inside .git directory

Original Documentation is here: All credit for this documentation goes to and not me. I am just putting here in case, they deprecate the document. I absolutely love this. what's inside your .git directory UPDATE: I’ve recieved some very helpful comments regarding corrections to the various files and what they do. Thanks for letting me know and keeping me on my toes. One of the things I like best about Git is that it keeps all of its information in one place: your .git directory in your project’s root. If you haven’t been digging around it yet, don’t fret! There’s plenty of goodies to be had within it. Let’s take a look into the important files and folders and try to get a better sense of what’s going on under the hood. The basic structure looks like this: . |-- COMMIT_EDITMSG |-- FETCH_HEAD |-- HEAD |-- ORIG_HEAD |-- branches |-- config |-- description |-- hooks | |-- applypatch-msg | |-- commit-msg | |-- post-commit | |-- post-receive | |-- post-update | |-- pre-applypatch | |-- pre-commit | |-- pre-rebase | |-- prepare-commit-msg | `-- update |-- index |-- info | `-- exclude |-- logs | |-- HEAD | `-- refs |-- objects `-- refs |-- heads |-- remotes |-- stash `-- tags Let’s go over some of the normal files that you may see living in the base directory: COMMIT_EDITMSG: This is the last commit’s message. It’s not actually used by Git at all, but it’s there mostly for your reference after you made a commit. config: Contains settings for this repository. Specific configuration variables can be dumped in here (and even aliases!) What this file is most used for is defining where remotes live and some core settings, such as if your repository is bare or not. description: If you’re using gitweb or firing up git instaweb, this will show up when you view your repository or the list of all versioned repositories. FETCH_HEAD: The SHAs of branch/remote heads that were updated during the last git fetch HEAD: The current ref that you’re looking at. In most cases it’s probably refs/heads/master index: The staging area with meta-data such as timestamps, file names and also SHAs of the files that are already wrapped up by Git. packed-refs: Packs away dormant refs, this is not the definitive list of refs in your repository (the refs folder has the real ones!) Take a look at gitster’s comment to see more information on this. ORIG_HEAD: When doing a merge, this is the SHA of the branch you’re merging into. MERGE_HEAD: When doing a merge, this is the SHA of the branch you’re merging from. MERGE_MODE: Used to communicate constraints that were originally given to git merge to git commit when a merge conflicts, and a separate git commit is needed to conclude it. Currently --no-ff is the only constraints passed this way. MERGE_MSG: Enumerates conflicts that happen during your current merge. RENAMED-REF: Still trying to track this one down. From a basic grep through the source, it seems like this file is related to errors when saving refs. There’s plenty of directories as well: hooks: A directory that will fast become your best friend: this contains scripts that are executed at certain times when working with Git, such as after a commit or before a rebase. An entire series of articles will be coming about hooks. info: Relatively uninteresting except for the exclude file that lives inside of it. We’ve seen this before in the ignoring files article, but as a reminder, you can use this file to ignore files for this project, but beware! It’s not versioned like a .gitignore file would be. logs: Contains history for different branches. Seems to be used mostly with the reflog command. objects: Git’s internal warehouse of blobs, all indexed by SHAs. rebase-apply: The workbench for rebasing and for git am. You can dig into its patch file when it does not apply cleanly if you’re brave. refs: The master copy of all refs that live in your repository, be they for stashes, tags, remote tracking branches, or local branches. Just one word of wisdom when messing around with Git internals: make sure you know what you’re doing, and if not, have a backup! Messing around with the config files or hooks is pretty simple but I wouldn’t go spelunking in the datastore if I didn’t have to. If for some reason you are as part of your normal workflow, you might be doing it wrong. There’s plenty more about the internals of Git that we haven’t covered yet. One of the best guides is the Git Community Book, and of course, you can just download the source for yourself and take a look. If you have more information about what’s going on in the .git folder, let us know in the comments!

Thursday, September 13, 2012

How to install 'MySQL' driver on Solaris platform:

How to install 'MySQL' driver on Solaris platform:


Download DBD-mysql-4.007.tar.gz
by using wget tool from unix10/unix22 boxes because ftp/telnet/scp/sftp
is prohibited.


Copy this file into /tmp/mysql ( Create a temporary directory mysql under /tmp )


gzip -d DBD-mysql-4.007.tar.gz


tar xvf DBD-mysql-4.007.tar


cd DBD-mysql-4.007

(This can vary depending upon where mysql libraries and header files are)
perl Makefile.PL --libs="-L/usr/local/mysql/lib/mysql -lmysqlclient -lz" \


make install

STEP 8: mysql driver has been installed if 'make install' does not produce any errors.

STEP 9: How to verify if - mysql driver is installed.

Used this perl script to verify:

#!/opt/local/bin/perl -w

use strict;
use DBI;

my @x_drivers = DBI->available_drivers();
foreach (@x_drivers){ print $_ . "\n";}


Sun Solaris One liners

Unix/Solaris: One-Liners

Listed here are a bunch of unix commands.

--> change file date stamp
touch –t 199906042020 filename

--> move partitions
ufsdump 0f - /dev/rdsk/c0t0s0s0 | (cd /home; ufsrestore xv -)

--> lay down file system with 1% minfree and inode density
newfs –m1 –i81920 /dev/rdsk/c0t0d0s0

--> check file system
fsck /dev/rdsk/c0t0d0s0

Q: starting sybase
login as sybase, run: ./install/RUN_SYBASE

Q: logging in as sybase sa
isql -U sa

--> dump a partition and pipe to gzip. Watch > 2GB limit
ufsdump 0f - /home | gzip - >/tmp/home.dump.gz

--> rewind offline a tape
mt –f /dev/rmt/0 rewoffl

--> only allow 300MB for user /tmp access
swap - /tmp tmpfs – yes SIZE=300M

--> verbose interactive restore
ufsrestore –ivf /dev/rmt/1

--> remove a printer from a class
lpadmin –p level5-line1 –r level5-line

--> truss a command
truss –-f -–o /tmp/log.txt

--> [DB] feed a script into sybase
isql –Urfe_xfer -Uuser -Ppassword -isqlscript >>blah.txt

--> make a printer class
lpadmin –p level5-line1 –c level5-line

--> remove level2-line2 printer from printer class level2-line
lpadmin -p level2-line2 -r level2-line

--> add level2-line3 to printer class
lpadmin -c level2-line -p level2-line3

--> [DB] how to change your password in isql
sp_password password, password-new

--> move a directory
tar cf - ./games | (cd /tmp; tar xvBpf - )

--> [DB] run a sybase script, and dump to file

--> move a directory to another server
tar cf - ./games | rsh brucey cd /tmp\; tar xvBpf -

--> check for SUID SGID files
ncheck -F ufs -s /dev/dsk/c3t0d0s

-- remove core files
find / -name core –exec rm –f {} \; -o –fstype nfs –prune

--> rebuild man pages
catman –w –M man-page-directory or /usr/lib/makewhatis

--> vi command to show special characters
: set list

--> adding an account
useradd -u 120 –g dls -d /apps/dls –s /bin/ksh -c "comment" -m dls

--> create a mysql database
mysqladmin -uroot -ppassword create ebs

--> starting mysql database
/etc/rc.d/init.d/mysql.server start

--> Invoke CPAN module install
perl –MCPAN –eshell

--> dump to zip
ufsdump 0f - /filesystem | /opt/local/gzip - > /tmp/dump.gz

--> shutdown mysql databse
/usr/local/bin/mysqladmin shutdown -ppassword
/etc/rc.d/init.d/mysql.server stop

--> test the loading of a module
PERL_DL_DEBUG=255 perl -e 'use CGI;'

--> shows open files
fuser –cu /

--> Writing a Daemon:
1. edit /etc/services
add service and port.
2. edit /etc/inetd.conf
add in: edwardd stream tcp nowait root /bin/sh /bin/sh /home/sextone/bin/SERVER.mine
3. kill –HUP inetd.conf

--> how to mount a file system
mount /dev/dsk/c3t0d0s4 /apps/data/easysoft/DEVT

--> look at sar log
sar –f /var/adm/sa/sa24

--> write file checksums and size
cksum filename

--> show storage array info
ssaadm display /dev/rdsk/c1t5d2s0
--> show all disks on device d
luxadm display d

--> examine for a specific OS finerprint
nmap –sS -p 80 -O -v = examine OS

--> show print jobs
/usr/ucb/lpq –Plevel6

--> Scan for known ports. log it. do OS scan.
nmap –sS -F -o foo.log -v -O =

--> show status of printer
/usr/ucb/lpc status

--> make a swap file:
dd if=/dev/zero of=swapfile bs=1024 count=65535
mkswap ./swapfile
chmod 600 ./swapfile
swapon ./swapfile

--> show open files for process
lsof –p PID

--> show open files for all TCP connections
lsof –iTCP

--> show open files for internet address
lsof -iTCP@

--> as above
lsof -i @

--> examine tcp ports
lsof -iTCP@sarah:1-50000

--> show open files for user.
lsof –u username

--> show processes that has the file in use.
lsof /apps/cms/ECMS-Server

--> show open files and retry every 5 seconds
lsof –p process-id –r 5

--> mount a floppy
mount -t vfat /dev/fd0 /mnt/floppy

--> check here for debugging processes and errno.h for errors

--> scp a whole directory, preserve mods
sudo scp -prv devel webadmin@

--> take processor 2 and 3 offline.
psradm -f 2 3
--> show processor stats verbose.
psrinfo –v

--> how to skip grant tables in mysql (over ride security)
/usr/local/libexec/mysqld -Sg

--> how to feed in an SQL program
--> rm all files in directories
find . -type f -exec rm {} \;

--> dump packets to a capture file
sudo snoop –o /tmp/tcp.txt cp

--> backup one liner
tar cvf - /home/ebs | gzip - > ebs.tar.gz

--> Look at selected packets in capture file
sudo snoop -i /tmp/tcp.txt

--> unzip and pipe to tar
gzip -dc
--> watch packets from two servers.
snoop sarah brucey

--> enable ip masquerading
/sbin/ipchains -P forward DENY
/sbin/ipchains -A forward -s -j MASQ

-> view su log file
cat /var/adm/sulog

--> establish a default router or gateway.
echo "" > /etc/defaultrouter
echo " sagacity" >> /etc/hosts
change /etc/nsswitch.conf so that hosts has files, dns
edit resolv.conf put in
search .

--> turn off automounter on /export/home.
vi /etc/auto_master, comment out /export/home

--> configuration file for sudoers

--> building ssh-1.2.27 on x86Solaris2.6 needed a few things:
/usr/openwin/bin in path
/usr/xpg4/bin in path
declare AR="/usr/xpg4/bin/ar"
declare NM_PATH="/usr/xpg4/bin/nm"

--> snoop network packets and get size and time stamp entries.
snoop -S -ta empa1

--> access perl CPAN
perl -MCPAN -e shell
install DBI

--> search for no password entries and lock all accounts.
for i in `passwd –sa | grep NP | awk ‘{print $1’`
echo “locking $i”
passwd –l $i

--> delete from a tar
tar --delete -f fs_backup_Sunday.tar home/ebs/tmp

--> Example on backing up files to tape. Must specify non rewinding, else you will over-write the files.
for file in `ls`
echo "sending $file to tape..."
echo `date`
tar cvpf /dev/rmt/0n $file

--> making/adding a partition.
1. use fdisk to make a parition.
2. mkfs -t ext2 -c /dev/hda11
3. mount -t ext2 /dev/hda11 /opt2
4. update /etc/fstab

--> rebuild the windex file
catman –w –M /usr/share/man

--> execute tar on remote host sarah and send tarball to standard output,
which becomes standard input for tar xvf – and the file gets dumped locally,
in this case on crawl. you have to cd to dir before tar or else you
will include path in tar
ssh maggie "cd $DIRNAME; tar cvf - $BASENAME" | (cd $TPATH; tar xvf - )

--> dump a remote filesystem and send it to local tape drive.
ssh -–x $fw /usr/sbin/ufsdump 0cf - $fs | dd obs=63k of=$TAPE

--> encrypt filename 1 and output to 1.crypt file
crypt < 1 > 1.crypt ; rm 1

--> decrypt filename 1.crypt and stdout to screen
crypt < 1.crypt

--> send a file to tape
tar cvpf /dev/rmt/0 filename

--> quicker way to search and replace in vi
: %s/existing/new/g

--> shows where and which shared library files an application uses.
ldd binary

--> shell script stuff:
# repeat a command 100 times
while [ $x -gt 0 ]

--> Something very important to remember about partitions
It is important to note that Cylinder 0 contains the disklabel, which
contains the partition table. A normal filesystem can be placed
starting at Cylinder 0, since it will not touch the disklabel.
If you lay down a raw device, for a database, over Cylinder 0,
then you will completely lose all your partitions. You will then
have to restore the disklabel, and backup from tape if you happen to do this.

--> move a partition
find . |cpio -pdm /apps

--> cron structure
min hour day-of-month month weekday command

--> PatchDiag Tool. Get patches from:
patchdiag.xref is available at:
/opt/local/bin/patchdiag -x /opt/local/lib/patchdiag.xref > patchdiag.`uname -n`

--> command showing system parameters

--> Get Ambient Temperature of Server
/usr/platform/SUNW,Ultra-4/sbin/prtdiag -v

--> good ps formatting showing percent cpu first.
ps -edf -o pcpu,pid,user,arg

--> full details on ps
/usr/bin/ps –A -o user,pid,pcpu,pmem,vsz,rss,tty,s,stime,time,args

--> chown the hidden files as well.
find . -print -exec chown -R sextone:staff {} \;

--> The nsradmin command is a command-line based administrative
program for the NetWorker system. Normally nsradmin monitors
and modifies NetWorker resources over the network.

--> Spray a server
-c number of packets
-d delay in microseconds
-l pakcet size in bytes
/usr/sbin/spray -c 1 –d 20 -l 4096 maggie

--> Turn on bold.
bold=`tput smso`
offbold=`tput rmso`
echo "${bold}You must be the \"root\" user to run this script.${offbold}"

--> good way to send a dir to tape
tar cf /dev/rmt/0n directory

--> example of bringing up an interface
ifconfig hme0:1 inet up

--> show all connections
netstat –f inet

--> rpcinfo makes an RPC call to an RPC server and reports
what it finds.
rpcinfo -b 390109 2 | sort -u

--> rewind a tape fast
< /dev/rmt/0

--> show loaded modules

--> find world readable files and dirs
find / -type d –perm -2 –print
find . -type f –perm -2 -print

--> adding in a boot alias, eg:
boot sarahroot1 –s
nvalias sarahroot1 /sbus@1f,0/sunw,fas@e,8800000/sd@9,0:a

--> clever way to archive
tar cvf - `find . –print` >/tmp/dumpfile.tar
tar xvf -
--> tee to a file
echo "Start Date/Time: `date`" | tee -a $LOG_FILE

--> read a snoop file
snoop -i anz-telnet.snoop

--> write a snoop log (this will count the number of connections, which is pretty neat).
snoop –osnoop.log sarah

--> set default run level. 5 for gui.

--> show all exported filesystems
showmount -e crawl

--> shows all configurable variables for tcp interface.
sudo ndd -get /dev/tcp
- ?
sudo ndd -get /dev/tcp tcp_conn_req_max_q
ndd /dev/arp \?
ndd /dev/ip \?
ndd /dev/tcp \?
ndd /dev/udp \?
ndd /dev/icmp \?

--> set sticky bit on group files, only the owner can change the mode.
--> the +l is mandatory file and record locking while a program
--> is accessing that file.
chmod g+s,+l file

--> print duplex landscape 4 qudrant printing
mpage –t –l –4

--> install a patch
installpatch .

--> check to see if a patch has been installed
showrev –p |grep package name

--> unzip, untar in a /tmp directory
zcat 104708-16.tar.gz | ( cd /tmp; sudo tar xvf - )

--> check out revision level on ssa controller
/usr/sbin/ssaadm display controller

--> unzip and untar a file without having to create an intermediate tar file
sudo gzip -dc /tmp/270599/post-EOD.tar.gz |tar xvf -

--> selectively extract from a tar archive
tar xvf /tmp/iona.tar ./iona/.sh_history

--> send a bunch of files to tape
tar cf /tmp/rules.tar ruleb* objects.C *.W

--> examine section 5 of man
man -s 5 signal

--> shows signals and definitions of structures, eg sigaction

--> location of the limits file on solaris

--> send an attachment via email from command prompt
uuencode file.tar.gz file.tar.gz | mailx –s “backup” root@crawl

--> zero a file
cat /dev/null > isam.log

--> good way to restore from cdrom a binary file
zcat < /cdrom/cdrom0/Solaris_2.6/Product/SUNWcsu/install/reloc.cpio.Z |
cpio –idm usr/lib/fs/ufs/ufsrestore

--> running su as a user then ssh
su - dls-PROD -c "/opt/local/bin/ssh drp-stagger \"cd /tmp; /bin/ls\" "

--> verify a newfs format
sudo newfs –Nv /dev/md/dsk/d96

--> making lost_found. must be 8192 bytes in size.
mkdir ./lost+found;chown root ./lost+found; chgrp root ./lost+found ;chmod 700 ./lost+found’; cd ./lost+found
nofiles=0 ; while [ "$nofiles" -le 650 ] ; do ; /usr/ucb/touch $nofiles ; nofiles=`expr $nofiles + 1` ; done

--> execute lynx
lynx -cfg /usr/lib/lynx.cfg

--> sed search example
sed '/Sep\ 25/!d; /castill/!d' /var/log/syslo

-->should only be used at the EEPROM
boot –r
--> should be used at single user mode
reboot -- -r
--> should be used in multiuser mode
touch /reconfigure

--> performing a remote dump

|cpio -oc |gzip -c
|ssh brucey -l chaup dd obs=18k of=/dev/rmt/0n

- to extract -
cd /ssa/emphasys/sybase/dump
dd ibs=18k if=|gunzip -c |cpio –idc

--> boot block located here.
/usr/platform/`uname –i`/lib/fs/ufs

--> getting a server on the network
add hosts entry for IP address
clear configs: ifconfig pe0 unplumb
ifconfig pe0 netmask up
route add default 1
verify the routing table: netstat –rn
add resolv.conf entry: domain nameserver
edit /etc/nsswitch.conf change hosts to files, dns

lesson here is to unplumb interface, and let ifconfig setup the routing.
if you specify an ip address and a netmask it will manage
the routing and the broadcasting.

--> find all, files associated with PID 22240
/usr/proc/bin/pfiles 22240
find file based on inode
find –i number
“ncheck –i number

--> good redirection example
./a.out trash

--> synchronize files from one server to another. This is useful for
synchronizing database dump files, binary files, etc. This is definitely a powerful tool.

rsync -avz -e ssh --rsync-path="/usr/local/bin/rsync" `pwd`

--> Example Awk Script

# run with awk -f/tmp/1.awk /etc/group

BEGIN { FS = ":" }
{ print $1 | "sort" }
{ nlines++ }
END { print nlines }

--> awk example.
awk '/#/ {print "Got a comment"}' /etc/hosts

--> delete every 2nd field in file
awk '{$2= ""; print}' datafile >

--> awk average/standard deviation program

x1 += $1
x2 += $1*$1

x1 = x1/NR
x2 = x2/NR
sigma = sqrt(x2 - x1*x1)
if (NR > 1) std_err = sigma/sqrt(NR - 1)
print "Number of points = " NR
print "Mean = " x1
print "Standard Deviation = " sigma
print "Standard Error = " std_err

Python Advance books

A Good link for description of these books.

Awesome details on HTML 5 custom data attributes (private data storage)

Monday, September 10, 2012

Thursday, August 30, 2012

Drawing game with Node.js

Wednesday, August 29, 2012

js clipboard

Cool JavaScript ClipBoard discussion

Tuesday, August 28, 2012

node.js screencast

Wednesday, August 22, 2012

Infinite scrolling like facebook and interest

Copy to clipboard - Best of web -

After spending few hours, reading and analyzing 'copy to clipboard' solutions using javascript or system clipboard ctrl-c & ctrl-v (on MAC, cmd-c & cmd-v), These are the best solutions/discussions. These questions have been asked millions of times because, 99% of the answers are just re-directed or assumed to be working. So I am putting here, best answers. This may not be exact code solutions. - -

Monday, August 20, 2012

SchemaSpy, I made work - pretty cool

Tuesday, August 14, 2012

Awesome read on putting text to a clipboard to copy

Monday, August 6, 2012

Friday, August 3, 2012

Cross domain browser security issue, ajaz, jason

Very Well exlained:

Friday, July 6, 2012

Best intro to perl Moose,0

Monday, May 14, 2012

logrotate demystified with excellent examples:

Thursday, May 10, 2012

CPU load nicely explained

Friday, January 6, 2012

Setting root password in Ubuntu

Its quite simple:

- Open a terminal
- sudo passwd root

& follow the instructions.