Oct
18
2007
Discovered that the bash shell has a variable called $RANDOM, which outputs a pseudo-random number every time you call it. Sweet! Allowed me to randomize the lines in a file for a process I needed to do, thusly:
for i in `cat unusual.txt`; do echo “$RANDOM $i”; done | sort | sed -r ’s/^[0-9]+ //’ > randorder.txt
In other words, put a random number on every line, sort the file, then take off the random numbers. Worked like a charm.
View Comments | posted in linux, system administration, unix
Oct
5
2007
Had a bit of hardware trouble, with a hard drive failing today. However, due to my sysadmin ninja skills, no data was lost and the RAID 1 is rebuilding.
[root@nexus ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 hdc1[2] hda1[0]
79360960 blocks [2/1] [U_]
[>....................] recovery = 2.2% (1809408/79360960) finish=25.9min speed=49725K/sec
md0 : active raid1 hdc2[1] hda2[0]
1052160 blocks [2/2] [UU]
unused devices:
If you need to do this:
# dd if=/dev/hda of=/dev/hdc bs=512 count=1
# mdadm –manage /dev/md0 –add /dev/hdc2
# mdadm –manage /dev/md1 –add /dev/hdc1
In other words, copy the master boot record from the good drive to the new drive so you have the same partitions, then hot add the new partitions to your array. WARNING DANGER DANGER WARNING. Backup all your data first, and test your backups work. Change the partitions and drives to match your own situation. Failure to do so will cause you to hose your system… That is all.
Now if only Linux could do all this automatically like other sane operating systems.
Update: I’m getting a little suspicious that just copying the MBR from one hard drive to another, messed up something with Linux’s software RAID. Sigh. This is exactly how I would do it in Solaris, but Linux has no great documentation on how to do it easily. Lazyweb?
Update, 2 Aug 2008:
I did this again and this time realized that copying the MBR will work fine with DD, but Linux needs to be explicitly told to rescan the partition table. I simply opened up the device with fdisk, checked the partitions looked how I wanted and then rewrote the partition table. Fdisk then calls the IOCTL to tell the kernel to rescan the partitions. Problem solved.
View Comments | posted in linux, system administration
Sep
27
2007
# uname -a
Darwin Matt Michie’s iPhone 9.0.0d1 Darwin Kernel Version 9.0.0d1: Fri Jun 22 00:38:56 PDT 2007; root:xnu-933.0.1.178.obj~1/RELEASE_ARM_S5L8900XRB iPhone1,1 Darwin
# python
Python 2.5.1 (r251:54863, Jul 27 2007, 12:05:57)
[GCC 4.0.1 LLVM (Apple Computer, Inc. build 2.0)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
Mmmmm tasty! iPhone with SSH, Python, BSD subsystem. Life is good.
View Comments | posted in apple, iphone, python, unix
Sep
25
2007
Surprisingly, the upgrade went pretty smoothly. While dinking around in the admin section, I noticed:
Akismet has protected your site from 15,874 spam comments.
Man, I hate spammers. The more popular my domains get, the more they get targeted. One of my other sites was used as a forged from address in a bunch of e-mails and I got all the bounces. Thanks for checking SPF everyone.
Update:
Ugh! Damn it.
WordPress database error: [Table 'wp_post2cat' doesn't exist]
SELECT cat_ID AS ID, MAX(post_modified) AS last_mod FROM `wp_posts` p LEFT JOIN `wp_post2cat` pc ON p.ID = pc.post_id LEFT JOIN `wp_categories` c ON pc.category_id = c.cat_ID WHERE post_status = ‘publish’ GROUP BY cat_ID
WordPress database error: [Table 'wp_post2cat' doesn't exist]
SELECT cat_ID AS ID, MAX(post_modified) AS last_mod FROM `wp_posts` p LEFT JOIN `wp_post2cat` pc ON p.ID = pc.post_id LEFT JOIN `wp_categories` c ON pc.category_id = c.cat_ID WHERE post_status = ‘publish’ GROUP BY cat_ID
Yes, I ran the update which supposedly updated my DB. Lovely.
Update 2:
Apparently I need to update my Google Sitemaps plugin as found in this thread: http://wordpress.org/support/topic/135564
View Comments | posted in system administration, wordpress
Sep
17
2007
Keith Adams has an intriguing post about VMWare vprobes:
VProbes attempts to provide a set of tools for answering the question, “What the heck is this computer doing?” It’s an open-ended question, so vprobes is accordingly open-ended, as well. In its current form, it provides an interactive, safe way of instrumenting a running VM at any level: from user-level processes down to the kernel, and even into VMware’s VMM and hypervisor, if need be.
First, we are aiming to provide a Dtrace-like tool for other commercially important operating systems than Solaris. Second, VProbes can combine with other virtualization-based techniques in powerful ways. For example, VProbes and deterministic replay combine to make the most potent tool that I’m aware of for debugging intermittent performance anomalies.
View Comments | posted in software, system administration, troubleshooting, virtualization
Aug
12
2007
View Comments | posted in humor, ruby
Jul
22
2007
I wasn’t aware of this until today:
Customers can immediately enable IP over FireWire and then connect two or more Macintosh systems by FireWire for file sharing, Internet sharing, or the use of any other IP-based service. IPv6 and zero-configuration networking are also supported. Many Macintosh products have 10/100 Ethernet and FireWire 400, making FireWire the fastest option for local area IP. For help activating IP over FireWire, open Mac Help and enter “IP over FireWire”. IP over FireWire can also be used as the starting point for new development, such as for cluster computing applications. Established IP services such as AFP, HTTP, FTP, SSH and TCP/IP can all be used on FireWire to support new development.
IP Over Firewire (apple.com)
Sweet! (yes, Gigabit Ethernet is faster and better supported, but I love having a wide range of devices on the Physical layer of the stack)
View Comments | posted in grid computing, network, osx
Jul
14
2007
“David Weinberger’s new book covers the breakdown of the established order of ordering. He explains how methods of categorization designed for physical objects fail when we can instead put things in multiple categoreis at once, and search them in many ways. This is no dry book on taxonomy, but has the insight and wit you’d expect from the author of The Cluetrain Manifesto, Small Pieces Loosely Joined, and a former writer for Woody Allen.”
The video starts out a little slow and I kept thinking, “yes, this is obvious,” but it picks up pace and puts all the things that are happening in the taxonomy / folksonomy field into perspective. Also Melvil Dewey of the Dewey Decimal System, sounds a lot more insane than I ever realized. David Weinberger really gets to some issues that I hated about the way that Universities somewhat arbitrarily divide learning into Colleges.
How does it make sense that Computer Science and Painting are both in the College of Arts & Sciences, yet Electrical Engineering is in the College of Engineering, for example. Some important cross fertilization is missed simply because students are physically separated into different buildings. Damn you Aristotle, damn you! *Shakes fist*
Update: just read an article in the NY Times about a library abandoning the Dewey Decimal System
View Comments | posted in internet, philosophy, psychology, video
Jun
29
2007
Linux : FreeBSD :: Ruby : Python
Discuss.
View Comments | posted in freebsd, linux, python, ruby
Jun
18
2007
Tonight, I heard a bunch of sirens beyond the typical living in First Hill next to 10 hospitals sirens, and lacking a scanner I was curious what was going on. I fired up Google and found a nice mashup of real time Seattle 911 Dispatch overlaid on Google Maps. Someone must have convinced the Seattle.gov guys to make it easy to parse again. I know there was a flareup where for “security” reasons they turned the whole thing into an image.
Anyway, I assume the incident I heard was:
22:26:09
Rescue Heavy
0 – 0 Nb I5 At 45A14 A14 B5 B6 DEP1 E17 E2 E22 E25 L7 L9 M16 M16 M44 R1 SAFT2 STAF10
Which according to the legend, and as best I can tell, they dispatched 2 Aid Units (Basic Life Support), 2 Battalion Chiefs, 4 Engines (water, hose and a pump), 2 Ladders (ladders and a large assortment of tools), 3 Medic Units (Advanced Life Support), 1 Rescue Unit and 3 others which I’m not sure how to interpret (DEP1, SAFT2, STAF10) to a location on I-5. Searching around the Seattle Fire Dept Gallery didn’t reveal much. Anyone know what those other 3 units are? Must have been a pretty nasty accident. Hope everyone comes out safely.
View Comments | posted in seattle