Category: "Fun"
Bingo Game Maker
Nov 22nd
This is a very simple way to create bingo boards with random layouts.
Granted you need PHP and Linux, but if you have them, and you want to create bingo boards, you're all set.
The way it works is you create a text file with one square per line. You need at least 25 lines to fill the board because I didn't feel like making any FREE squares.
Run it through bingo.php on the command line like so:
php bingo.php
Once you're happy with it, you can run it a bunch of times using:
source bingo.sh
bingo.php
<?php
$header = <<< HEADER
Bingo
Thanksgiving Bingo
Mark each square as the event occurs.
First person to get all four corners, a complete row across, or a diagonal row gets a prize.
HEADER;
$footer = <<< FOOTER
FOOTER;
$squares = explode(PHP_EOL,trim(file_get_contents('bingowords.txt')));
shuffle($squares);
echo $header.PHP_EOL;
echo ''.PHP_EOL;
for ($j = 0; $j < 25; $j++) {
if (($j % 5) === 0) {
echo ''.PHP_EOL;
}
echo ''.htmlentities($squares[$j]).' '.PHP_EOL;
if (($j % 5) === 4) {
echo ' '.PHP_EOL;
}
}
echo '
'.PHP_EOL;
echo $footer.PHP_EOL;
bingo.sh
#!/bin/bash
rm out.html
for i in `seq 1 25`;
do
php bingo.php >> out.html
done
Windows 7 Dual-Boot CentOS 6.4 on an External USB Drive
May 28th
Before you do this, make recovery disk(s) for Windows 7. Unless you already have them. You may want to backup anything you have on the Windows 7 drive, but if you’re only using it to run browsers, you haven’t invested that much anyway. Make sure you have some sort of recovery disks or you will either have to buy them or pay someone to fix your disk. Label the disk. Eventually.
The first thing you’ll need for this is a CentOS 6.4 LiveCD. Go to one of the CentOS mirrors (http://www.centos.org/modules/tinycontent/index.php?id=15) and use the following URL pattern: http://mirror.example.com/centos/6/isos/i386/CentOS-6.4-i386-LiveCD.iso. If you have a 64-bit machine, use x86_64. You can also use a USB to boot, I recommend http://unetbootin.sourceforge.net/
Install CentOS on the external drive. I recommend doing a minimal install to get the boot loader set up, then you can either reinstall or add packages to get the system set up the way you want it to.
Once CentOS is on the drive, try to boot from it. You’ll probably have to press a key (on this Asus laptop it is Esc) to choose which drive to boot from. If it won’t boot, you’ll need to adjust the grub settings.
Apparently you can’t change the Windows 7 boot loader. I’m not going to claim this is an authoritative statement, however, installing grub on the Windows 7 drive caused it to fail to boot with a ‘Hard disk error’ (or something similar). This required the Windows 7 recovery disks to recover.
Therefore, you must put the bootloader on the external drive and configure the BIOS to try to boot from the external drive first, with an option to go to Windows.
The problem I had was that by booting off a USB stick the device numbers were a bit off.
Once I had grub loaded on the external drive, I use the find command to determine how the disk was referenced. Then I manually edited the device.map file and grub.conf files after booting into the LiveCD.
For an Asus laptop with Windows 7 on the internal hard disk, and an external USB disk drive, the device.map file looked like this:
It wasn’t really generated by anaconda since I edited it, but that’s okay.
# this device map was generated by anaconda
(hd0) /dev/sdb
I edited grub.conf using hd0 to refer to the external drive and hd1 to refer to the internal drive.
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/vg_asuslaptopcentos-lv_ro
ot
# initrd /initrd-[generic-]version.img
#boot=/dev/sda1
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-358.6.2.el6.i686)
root (hd0,0)
kernel /vmlinuz-2.6.32-358.6.2.el6.i686 ro root=/dev/mapper/vg_asuslapto
pcentos-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=vg_asuslaptopcent
os/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_asuslaptopcen
tos/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-358.6.2.el6.i686.img
title CentOS (2.6.32-358.el6.i686)
root (hd0,0)
kernel /vmlinuz-2.6.32-358.el6.i686 ro root=/dev/mapper/vg_asuslaptopcen
tos-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=vg_asuslaptopcentos/l
v_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_asuslaptopcentos/
lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-358.el6.i686.img
title Windows 7
rootnoverify (hd1,1)
chainloader +1
What I learned:
Drive references may vary based on how the machine was booted.
You can’t just plug an external drive into a different machine and work with it, you may mess up the other machine.
Don’t change the Windows 7 boot loader, although you can use EasyBCD to recover. Maybe.
Taking the time to read the grub documentation is well worth the investment.
Cartoonify (quantize) an image
Dec 20th
Quantizing an image reduces the number of colors. It’s an easy way to convert a photo into an image that looks more like a paint by number pattern, or ‘cartoon’.
It might be a fun way to create an avatar, improve image presentation while speeding delivery, or just have fun.
Thanks to: http://www.imagemagick.org/Usage/quantize
Generate Backgrounds with ImageMagick
Nov 18th
Link is to a page that has daily dynamically generated background tile images, with a gradient overlay.
A fun way to make a site more interesting, especially for those with limited design skills. :)
dojox Gallery / SlideShow Demo
May 29th
Link is a demo of the dojox Gallery / SlideShow widget.
Implementation considerations:
Table of contents (left column) provides links for SEO, as well as navigation by site visitor/organization of content.
-
A detail page could be developed for each page that would include additional text, both for SEO and to provide more information for site visitors.
-
Images are just color gradients - easy to see them change.