Wednesday, October 29, 2008

helpful svn commands

Here are some useful subversion commands I'd like to remember. But instead, I'll write them down, cause I'm always forgetting.

The simplest being the ubiquitous "checkout the latest version of the source", using ffmpeg as the example:
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

Here's an example of a command to checkout a specific version of code, where "co" is shorthand for "checkout" and "-r" is the parameter to specify a particular revision number:
svn co -r 12000 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

After you've downloaded that version, you can check the date stamps on the files by using the following command. The log option shows you dates/time/version numbers of the files in the svn repository. It sorts the code in the repository by date. I then pipe the output to awk to print only the date column and then remove blank lines with sed:
svn log ffmpeg | awk -F"|" '{print $3}' | sed '/^$/d'

that's all I have for now. I will update when I have time,
sodo

Tuesday, October 28, 2008

formatted date in Windows script

I find the output of the full date command in Windows lacking. Thus, I was trying to find a way to date/time stamp a logfile in a Windows batch script.
C:\WINNT>date /t
Tue 10/28/2008

I only wanted YYYYMMDD_HHmm, where
YYYY = four digit year
MM = two digit day
DD = two digit month
HH = two digit hour
mm = two digit minute

So, I needed to combine outputs from both the Windows date and time functions.

My batch script ended up looking like this:
set dt=%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%
bash "siteBackupAll.sh" | tee log%dt%.txt

In the example above, the resulting script outputs a logfile named:
log20081028_1433.txt

The Windows help for SET is pretty cryptic, much like any Unix man page. You can see all the options for Windows shell programming (variables, operators, expressions, etc) if you type
SET /?

at the command prompt.

Variable expansion in Windows is a little weird. Here is a snip from the help, but essentially, you can act on the expansion of a variable (ie, pluck parts from the output) by using a numbering scheme that will start counting from the left or right, depending on whether the number you specify is positive (start from left) or negative (start from right). In essence, the numbering is much like any programmatic substr (substring) function:

May also specify substrings for an expansion. %PATH:~10,5%would expand the PATH environment variable, and then use only the 5characters that begin at the 11th (offset 10) character of the expandedresult. If the length is not specified, then it defaults to theremainder of the variable value. If either number (offset or length) isnegative, then the number used is the length of the environment variablevalue added to the offset or length specified.

%PATH:~-10%would extract the last 10 characters of the PATH variable.
%PATH:~0,-2%would extract all but the last 2 characters of the PATH variable.

'sodo

Tuesday, October 14, 2008

Hacked!

This will be a new section on the site that will summarize articles that describe recent exploits that I've noticed occurring on my website. Most of the articles will detail the exploits and how to recognize them. Over time, this post will grow. Pay attention to the date and time of the post to find out when it was last updated.

ISC: SQL Injection hacks

'sodo

Saturday, October 04, 2008

vnc on linux won't connect to mac

I wanted to logon to my Mac via my Fedora 7 installation. Unfortunately, connecting to a mac from a linux box using RealVNC doesn't work:
http://www.realvnc.com/pipermail/vnc-list/2006-March/054423.html

After a bit of Googling, TightVNC seemed to be the ticket. Unfortunately, the VNC and TightVNC libraries conflict:
[root@ogre ~]# rpm -ivh tightvnc-1.3.9-1.i386.rpm
Preparing... ########################################### [100%]
file /usr/share/man/man1/vncviewer.1.gz from install of tightvnc-1.3.9-1 conflicts with file from package vnc-4.1.2-20.fc7


Therefore, I yanked out the RealVNC libraries:
[root@ogre ~]# yum remove vnc*
Loading "installonlyn" plugin
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package vnc-server.x86_64 0:4.1.2-19.fc7 set to be erased
---> Package vnc.x86_64 0:4.1.2-20.fc7 set to be erased
---> Package vnc-libs.x86_64 0:4.1.2-19.fc7 set to be erased
---> Package vnc-reflector.x86_64 0:1.2.4-3.fc7 set to be erased
---> Package vnc-ltsp-config.noarch 0:4.0-3 set to be erased
---> Package vnc-libs.i386 0:4.1.2-19.fc7 set to be erased


..downloaded Fedora Core 6 tightvnc rpm from here:
http://www.tightvnc.com/download.html

..and installed the Core 6 libraries (though I run Fedora 7) just fine:
[root@ogre ~]# rpm -ivh tightvnc-1.3.9-1.i386.rpm
Preparing... ########################################### [100%]
1:tightvnc ########################################### [100%]


Now my Fedora box can logon to my Mac using TightVNC:
[root@ogre ~]# vncviewer macwired
Connected to RFB server, using protocol version 3.8
Performing standard VNC authentication
Password:
Authentication successful
Desktop name "MACLT"
VNC server default format:
32 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Warning: Cannot convert string "-*-helvetica-bold-r-*-*-16-*-*-*-*-*-*-*" to type FontStruct
Using default colormap which is TrueColor. Pixel format:
32 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using shared memory PutImage
ShmCleanup called




Yeehaw!
'sodo
Feel free to drop me a line or ask me a question.