Creating an SSL key, CSR and self-signed cert

cd /etc/pki/tls cd private openssl genrsa -des3 -out `hostname`.key 1024 # password: whatever you want # TO MAKE IT HAVE NO PASSPHRASE (optional): cp `hostname`.key `hostname`.key.orig openssl rsa -in `hostname`.key.orig -out `hostname`.key # MAKE THE CSR cd ../csr openssl req -new -key ../private/`hostname`.key -out `hostname`.csr # answer the questions # MAKE THE SELF-SIGNED CERT: cd … Read moreCreating an SSL key, CSR and self-signed cert

CVS: recursively add files

Have you ever worked in a CVS module, added a deep tree of directories and files and needed to add them to CVS. If you have, you may have had to go through a painful process of adding one dir at a time, then all the files in that dir, then repeat until you’ve done all the dirs. I have a solution for that:

Just run this over and over again, until all files are added:

Read moreCVS: recursively add files

Perl, Extended Find and Replace

Use with caution, this will not make backups:

search="searchRegExp"
replace="replaceStr"
egrep -lri --exclude="Entries" --exclude="*.gif" --exclude="*.WAV" --exclude="*.wav" --exclude="*.zip"  "$search" * | xargs perl -pi -e "s/$search/$replace/gi"

the “gi” option means globally, case-insensitive, so take the “i” off if you want it to be case-sensative.

If you want to make backup files, replace “perl -pi” with “perl -pi.bak”

Read morePerl, Extended Find and Replace

PHP Upload Progress Bar

Originally posted August 23, 2006

———————————————–
Update: 4/8/07, added a 5.2.1 patch to the php5 tar ball
———————————————–

Ever wanted to display the progress of an upload to your user? This is handy for large uploads, gives users of your web site an idea of how long is left on the upload.

Unfortunately, PHP doesn’t provide this ability natively. Your first line of code in your PHP program receiving the upload doesn’t run until after the upload is complete. Therefore, there is no way, natively, for you to know the progress of the upload during the upload. Fortunately, I have a real solution. I downloaded a PHP source code patch (original patch available here http://pdoru.from.ro/) that adds this ability to PHP, then modified it to log data to a MySQL table or a flat file. The original patch did flat file only, which doesn’t work well on load balanced systems that need to share a data repository.

Read morePHP Upload Progress Bar

Backup Tivo shows to your linux desktop

This is for a Linux desktop, I used Fedora Core 7 at the time. Also, working with Series 2 Tivo DVR. Anything else, who knows, maybe the same, maybe similar, maybe not at all, I have no idea. Everything in this write up uses freeware.

First, get and install tivodecode and pyTivo (which requires ffmpeg)
http://tivodecode.sourceforge.net/
http://pytivo.armooo.net/
http://sourceforge.net/projects/ffmpeg/

…. tivodecode creates mpeg2 files out of .TiVo files. This makes it more suitable for other applications. Really a .TiVo file is a .mpg, but with some special header or something on it. tivodecode just makes a new file without the header, just a pure mpeg2 file that most other applications can read.

“pyTivo”, works like the Tivo Desktop, but it’s for Linux. You can backup your TiVo recorded shows to your linux desktop, then share them back with your TiVo. This lets you move shows off your Tivo, making disk space for more shows. If you’re like me, your Tivo only has a little 40 Gig hard drive, but my desktop is loaded.

Read moreBackup Tivo shows to your linux desktop

Daemonize any program with daemontools and ucspi-tcp

Daemontools and ucspi-tcp are VERY commonly used with qmail, one of the most popular email MTA programs on the net today. Once you get the hang of it, you’ll see it’s very cool for daemonizing a script. This example will be a PHP script that does very little, just echo’s what you type back at you. Just enough to get the point across that you can deamonize your script with these two tools.

Below is blow by blow instructions for installation and setup of the echo.php daemon

Read moreDaemonize any program with daemontools and ucspi-tcp