Dec 12

Useful little shell productivity tricks:

I work remotely a lot. To avoid the lag associated with VPN’s and
to assure I have all the tools I love, I setup up an environment in
Cygwin that gets me all I need to do development. The one thing
that’s irritating is when it comes time to test in the customers
environment (or just a far machine). This is where this little while
loop comes in. I open a new xterm and

while :
do
rsync -zav /home/tony/work/SomeCustomerProject/ Far.Box.com:/home/tony/work/SomeCustomerProject/
read foo # wait here until any key is hit
fortune # gives me unique phrase/thought to remind me if I’ve pushed or not
done

After running the loop I resize the window down to one or two lines. Whenever I want to rsync, I focus on it and hit return.

Other ways to simulate a Linux/UNIX environment:

Netcat is native to Cygwin however you have to choose it in the ’setup’ app.
# simulate a network server – cats whatever is written, great for text protocols/SOAP, etc. Binary protocols will work, but you’ll have to go out of your way to translate them.
while :; do nc -n -t -vv -l -p 4913 127.0.0.1 ; echo “—–” ; done

Cygwin also implements named pipes:
mknode /usr/local/groundwork/nagios/var/spool/nagios.cmd p
# keep the pipe read so it doesn’t block
echo “while :; do cat /usr/local/groundwork/nagios/var/spool/nagios.cmd; done”

Mysql compiles under Cygwin. I use mysql-5.0.33.tar.gz because I have it laying around. It installs all the libs you need to compile DBD::mysql. It has pretty bad performance, but is great for development and light loads.

# add a user to cygwin’s /etc/passwd:
mysql:unused_by_nt/2000/xp:1003:513:mysql user:/usr/local/var:/bin/bash

### config line
./configure –enable-assembler –with-mysqld-ldflags=-all-static
make install # installs to /usr/local/*

After that it’s just a regular MySQL setup.

-Tony

written by admin

Sep 06
It drives me crazy to watch an admin figure out how to login to a box with putty. I believe that you can’t manage Unix systems without Unix tools. I switched to Cygwin years ago, except for /dev/random it’s indistingusiable from a workstation. I can do anything I’d do on a Unix box, including installing perl Expect which requires compiling and a tty. It’ll even compile MySQL from source and run it 100% Unix style. It’s seems to have some preformance issues, but you can develop and test with it.  

I love having all my tools on a single box. On the Windows side I use True X-Mouse. It has real sloppy focus and seamless highlight/middle-mouse button for cut-and-paste. 

Under Cygwin I run the light and fast ‘fvwm.’  Here are the instructions and a tar file for doing a Cygwin X11 install from scratch.

written by admin