DeutschEspañolFrançaisItalianoNederlandsPortuguêsΕλληνικάРусскийالعربية中文(简体)中文(繁體)日本語한국어
 
Donate Bitcoins
Google
 
www smithii.com
 

Blogs

Migrating from Oubliette to KeePass

To migrate my data from Oubliette, to KeePass, I created the HTML template keypass_xml.tpl and the bash shell script keypass_xml.sh.

Generating 63 byte WPA keys for your wireless router

Here's a quick little script to use to generate several 63 byte WPA keys for your wireless router:

#!/bin/sh

echo Generating 10 random 63 byte WPA key... >&2

for i in 1 2 3 4 5 6 7 8 9 0
do
	head -c 256 </dev/random | tr -cd "[!-~]" | head -c 63
	echo
done

Removing unused query parameters from the URL

I have a web form with several fields. When the user submits the form, they usually only enter data into one of the fields. I wanted the resulting GET url to only include the field(s) they entered any information into. Here's the code I came up with:

<script language='JavaScript' type='text/javascript'>
<!-- // <![CDATA[
function frmSubmit(thiz) {
	var e = thiz.elements;
	for (var i = 0; i < e.length; ++i)
		if (e[i].type == 'text' && e[i].value.length == 0)
			e[i].disabled = true;
	return true;
}
// ]]> -->
</script>
<form method='get' onSubmit='return frmSubmit(this)'>

This appears to work on at least the following browsers:

  • Firefox 1.0.6
  • IE 6.00
  • Opera 8.0

If anyone has a better solution, either client-side, or server-side, I would love to hear it.

Fixing udev's breaking apt-get dist-upgrade

I ran

apt-get dist-upgrade

on my sid box, and got the error

Preparing to replace udev 0.056-3 (using .../archives/udev_0.063-1_i386.deb) ...
udev requires a kernel >= 2.6.12, upgrade aborted.
dpkg: error processing /var/cache/apt/archives/udev_0.063-1_i386.deb (--unpack):
 subprocess pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/udev_0.063-1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

which is mentioned here.

So, after looking at the manual for
apt_preferences, I added

Package: udev
Pin: version 0.056*
Pin-Priority: 1001

to /etc/apt/preferences and reran

apt-get dist-upgrade

and all is well.

I don't understand why someone would commit a package that relies on a kernel that isn't even in sid yet.

Perforce unnecessarily changes text files

I was having a terrible time with Perforce 2005.1 (and 2004.2) changing the line ending characters on my bash shell scripts, DOS batch files, and other text files. This was causing my scripts to fail in one way or another. Also, several of my PHP scripts were malfunctioning as well. Web pages I wrote that allowed users to download Excel spreadsheets were now generating a spreadsheet that contained nothing but garbage.

I then discovered, that in order for Perforce to leave the line ending characters alone, I needed to change the ClientSpec and add the files with

LineEnd: unix

and then change the ClientSpec back, and sync them with

LineEnd: share

To determine this, I wrote a small DOS batch file to analyse all possible combinations of LineEnd options, for both adding and syncing.
Here's the output from the program (edited slightly for clarity):

Add	Sync	file		Result
-------	-------	---------------	-------------------------------------
local	local	mac-cr.txt	_  cr   _  cr
local	local	unix-lf.txt	_  cr  lf   _  cr  lf
local	local	win-crlf.txt	_  cr  lf   _  cr  lf
local	mac	mac-cr.txt	_  cr   _  cr
local	mac	unix-lf.txt	_  cr   _  cr
local	mac	win-crlf.txt	_  cr   _  cr
local	share	mac-cr.txt	_  cr   _  cr
local	share	unix-lf.txt	_  lf   _  lf
local	share	win-crlf.txt	_  lf   _  lf
local	unix	mac-cr.txt	_  cr   _  cr
local	unix	unix-lf.txt	_  lf   _  lf
local	unix	win-crlf.txt	_  lf   _  lf
local	win	mac-cr.txt	_  cr   _  cr
local	win	unix-lf.txt	_  cr  lf   _  cr  lf
local	win	win-crlf.txt	_  cr  lf   _  cr  lf
mac	local	mac-cr.txt	_  cr  lf   _  cr  lf
mac	local	unix-lf.txt	_  cr  lf   _  cr  lf
mac	local	win-crlf.txt	_  cr  lf  cr  lf   _  cr  lf  cr  lf
mac	mac	mac-cr.txt	_  cr  lf   _  cr  lf
mac	mac	unix-lf.txt	_  cr  lf   _  cr  lf
mac	mac	win-crlf.txt	_  cr  lf  cr  lf   _  cr  lf  cr  lf
mac	share	mac-cr.txt	_  lf   _  lf
mac	share	unix-lf.txt	_  lf   _  lf

My BartPE plugins

I have updated my list of BartPE plugins here.

For the plugins listed as a patch of another plugin, a plugin.diff file is included detailing what was changed from the original plugin.

Also see pebuilder.mak, a make file I created to automatically build and burn a BartPE disk with a single command.

Of course, before I run pebuilder.mak, I slipstream SP2 and apply all the latest security patches using xpsp2.mak.

I've ported Samba 3.0.14a to Windows (Cygwin) (via a plugin for BartPE)

A Samba plugin is now available at samba.zip. It uses a Cygwin port of Samba 3.0.14a. Here's the makefile samba.mak and the patch samba-3.0.14a.cygwin.patch.

The plugin's help file is available here. This plugin requires the Cygwin plugin cygwin.zip.

You can also run Samba inside "normal" Windows, such as XP, 2003, or 2000. Details are here.

I've ported email 2.3.4 to Windows (Cygwin)

Using this Makefile and this patch, I ported email 2.3.4 to Windows (Cygwin). Email is a great little utility, one that I use every day. Here's the blurb for it:

Command line sending of email, optionally with GnuPG encryption.
Email is a simple command-line program to send emails. It can be configured
to use either your sendmail installation or directly via SMTP.
It supports binary attachments, and a simple text based address book, with groups.
Also, if GnuPG is installed, it can digitally sign and encrypt outgoing emails.

mkisofs and cdrecord 2.01 for Windows (Cygwin) (Updated binaries)

Using the makefile cdrecord.mak, I compiled version 2.01 of cdrecord for Windows.

The resultant binaries (cdrecord, mkisofs, etc.) are available as cdrtools-latest.zip.

In order to compile under Cygwin 1.5.23, I applied the patch cdrtools-2.01.cygwin.patch.

You can use these without installing Cygwin, but you will need to have cygwin1.dll (included) in the same directory as the commands, or copy it to somewhere in your PATH.

If you have, or later install, Cygwin, you will need to delete the included cygwin1.dll, as Cygwin will not operate correctly if there two or more instances of cygwin1.dll.

Using the makefile cdrecord_dvdpatch.mak, I compiled a version of cdrecord that supports burning DVDs. The binaries are available as cdrtools-latest-dvdpatch.zip.

This version was produced using the following patches:

  1. cdrtools-2.01.01-dvd.patch.bz2 (From Warly)
  2. cdrtools-2.01a27-o_excl.patch.bz2 (From Warly)

Added two new cdrecord plugins for BartPE

I've created two new plugins to run cdrecord & mkisofs in BartPE.

1. cdrecord - cdrecord 2.01

This version includes version 2.01 of cdrecord compiled for native Windows, found at http://cdrtools.bootcd.ru (mirrored at http://stud3.tuwien.ac.at/~e0227529/mirror/). It requires msvcrt.dll to be in the path, which is true for BartPE.

2. cdrecord_cygwin - cdrecord 2.01.01a01 (includes a patched version of cdrecord to burn DVDs called dvdrecord)

This version includes version 2.01.01a01 of cdrecord compiled using Cygwin. It requires cygwin1.dll to be in the path. So you will either need to also include the Cygwin plugin, or copy cygwin1.dll to SYSTEM32 or another folder in the path.

If you aren't using Cygwin, and don't need to burn DVDs, use cdrecord, otherwise use cdrecord_cygwin.

Automating the building of a BartPE bootable disk (updated for pebuilder 3.1.3)

To automate the tedious process of building a bootable BartPE disk, I created the Makefile pebuilder.mak to build a BartPE disk with a single command.

To build the disk, all you need to type is:

$ make -f pebuilder.mak

The Makefile, and the supporting files are available as pebuilder-makefile.zip.

Of course, to run make, you will need to install Cygwin and select the make and wget packages. Alternatively, you could unzip cygwin-1.5.23.zip, which contains only the executables needed to run make.

It helps speed the build process by telling pebuilder to not build the .ISO. It then calls InfCacheBuilder, and then calls mkisofs. Finally, it calls cdrecord. A Windows version of cdrecord is available as cdrtools-latest.zip.

Also included is inirw.exe, a small C program I wrote to read and write .ini files. inirw.exe is also available separately (including source) as inirw.zip.

I installed DSPAM 3.0 at my ISP

I installed DSPAM 3.0 at my ISP. It was pretty easy. I followed the instructions at http://dspam.nuclearelephant.com/text/README-3.6.7.txt and http://splodge.fluff.org/docs/single-user-dspam. Unfortunately, the later is for DSPAM 2 and needed some changes. Here's what I did.

Migrating from CVS to Perforce

Here's a simple Cygwin script to migrate files from a CVS repository to Perforce.

Make sure the directory you are in, is prefaced with /cygdrive, or cygpath gets confused.

#!/bin/bash
# cvs2p4.sh

REPOSITORIES="example1 example2"

PWD=`cygpath -w \`pwd\``
p4 edit ...

for repo in $REPOSITORIES
do
	cvs export -r HEAD $repo
done

find . -type f -printf '"%P" ' | p4 -x - add
p4 submit

I finally released Freebeer

After a long wait, I finally released Freebeer, A PHP application framework.

It needs a lot of more work, especially web site documentation, but at least its posted.

A better ssh-copy-id

For whatever reason, ssh-copy-id
(or try ssh-copy-id)

doesn't seem to work for me.

So I wrote a script to perform the same function, sshcopy.sh.

It works in both *nix and Cygwin.

Syndicate content
DeutschEspañolFrançaisItalianoNederlandsPortuguêsΕλληνικάРусскийالعربية中文(简体)中文(繁體)日本語한국어
 
Donate Bitcoins
Google
 
www smithii.com
 
Special thanks to Riester Rente Online for a generous donation!