Thursday, December 2, 2010

Capture standard output (stdout) in console command running at VBS

We can use WScript.Shell.Exec( ) and WScript.Shell.StdOut.ReadLine( ) to perform the task:




Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("cmd /c dir")
strText=""
Do While Not objExecObject.StdOut.AtEndOfStream
strText = strText & objExecObject.StdOut.ReadLine() & chr(13)
Loop
Wscript.Echo strText

Sunday, October 10, 2010

Using X-Forward-For Header

Say if you have a web server on top of your application server, you can use "x-Forward-For" HTTP header in the application server to get the real IP of the client.

Note: Remote host only returns the IP of the web server instead.

Sync multiple git repo at once

Use the following command in Linux will do the job:  ls -d RepoNames* | xargs -I{} git -C {} pull