Admin Panel Finally Fixed

In case you were wondering, the lack of posts wasn’t because I’d abandoned this blog. It’s because my host’s PHP install is broken and the admin panel wouldn’t load.

I’ve finally managed to figure out how to work around that, so expect to see a large dump of new postings within the next week or two. 🙂

Posted in Site Updates | Leave a comment

My new lists

Long story short, I wrote up a list of all the gender-bending fiction I knew and had so much fun that I did another one for music with decent lyrics. You’ll probably want the master list though.

Enjoy. I’ll be making more as I find the time and inspiration.

Posted in Geek Stuff, Music, Otaku Stuff | Leave a comment

Resources for the eBook lover

So you bought something nice, but now you have no money for eBooks… or maybe you hate DRM and don’t feel right about buying a paperback and then torrenting a digital copy. Well, there’s lots of help out there.

I don’t remember all of the free eBook sites I’ve bumped into and bookmarked over the years, but here are the ones I can remember right now:

And last, but certainly not least, don’t forget about Wikipedia: List of digital library projects. Enjoy them and let me know about any others you find. 🙂

Posted in Geek Stuff, Web Wandering & Opinion | 2 Comments

A new way of examining the size of the IPv6 address space

Ok, you’ve probably heard the usual examples for visualizing how big IPv6’s address space is. 7 IP addresses for every atom of every person on Earth gets the point across, but it’s not exactly very useful… so I decided to try something more practical.

Since I like to do my experimentation in a Python interactive interpreter, I’ll share the raw shell session. First, let’s get some data to work with:

>>> people_on_earth = int(6.5e9) # 6.5 billion (approximately)
>>> ipv6_range = 2**128 # 340,282,366,920,938,463,463,374,607,431,768,211,456
>>> habitable_planets_in_our_galaxy = int(30e6) # 30 million. An estimate from a SPACE.com article I read recently.
>>> cells_in_the_human_body = 10**14 # 100 trillion (Estimate from Science NetLinks via Ask Yakoo!)

Ok, now that we’ve got some frame of reference, let’s see if we can show how huge IPv6’s address space really is. First, there’s the traditional “addresses per person” count:
>>> ipv6_range / people_on_earth
52351133372452071302057631912L

Ok, what if we became galactic conquerors and put 6.5 million humans on every Earth-like planet in our galaxy?
>>> ipv6_range / people_on_earth / habitable_planets_in_our_galaxy
1745037779081735710068L

Oh! We mustn’t forget that some people have lots of computers…
>>> ipv6_range / 4 / people_on_earth / habitable_planets_in_our_galaxy
436259444770433927517L

Nor should we forget the little wireless gizmos like cell phones…
>>> ipv6_range / 16 / people_on_earth / habitable_planets_in_our_galaxy
109064861192608481879L

Hmm… Looks like it’s time to bring out the sci-fi “big guns”. What if every person was host to a colony of Internet-connected nanobots… one for each cell?
>>> ipv6_range / cells_in_the_human_body / people_on_earth / habitable_planets_in_our_galaxy
17450377L

Ok… what if we also had… The T-1000 Butlernator? (assuming 3 per person)
>>> ipv6_range / cells_in_the_human_body / people_on_earth / habitable_planets_in_our_galaxy / 4
4362594L

And in case you’re lost, that number shows how many galaxies could sustain such IPv6 usage before we’d run out. Enjoy!

Posted in Geek Stuff, Web Wandering & Opinion | Leave a comment

Crontab Timing Tricks

Have you ever had a cronjob that needs to run as root, but you can’t do so easily because of the following reasons?

  • /etc/crontab is managed by your package manager
  • vixie-cron ignores /etc/cron.d/
  • Root’s private “crontab -e” crontab is easily overlooked when backing up /etc
  • It needs some odd interval like “every 3 days”

Well, if your interval is evenly divisible into days, (“every 2 days” is OK, “every 1.5 days” is not) then I have just the solution. Create a new cron script in /etc/cron.daily, make it executable, and put the following inside it (For our example, I’ll use two days as the interval and “emerge –sync” as the command):

#!/bin/bash

TODAY=`date +%j`
if [ $((${TODAY#0} % 2)) == 0 ]; then
        /usr/bin/emerge --sync > /dev/null
fi

It’s that simple. Here’s how it works:

  1. Once per day, the cron daemon calls the script
  2. The script calls `date +%j` and gets the “day of the year” (between 1 and 365, inclusive, or 1 and 366 if it’s a leap year)
  3. It then strips off any leading zeros to prevent “invalid number for given base” errors. (“085” would be “invalid octal” by bash syntax.)
  4. The script does a “modulo 2” operation on it (takes the remainder of integer division by 2)
  5. If there is no remainder, then the current date satisfies the “every second day” requirement and the command is run.

Because I chose the evenly-numbered days using “== 0”, a non-leap year will end with a two-day interval, rather than a leap year ending with the command being called two days in a row. Use “!= 0” if you want to change this behaviour.

The “> /dev/null” ensures that only stderr messages (usually only errors) generate status emails. I use that to keep my admin mailbox uncluttered.

UPDATE: Oops. I forgot that bash is one of the many languages which uses a zero prefix to indicate octal. I’ve corrected the example.

Posted in Geek Stuff | 1 Comment

Archival and Optical Media

Have you ever worried about the lifetime of your stored data? You should.

  • Google did a study that has shown an hard drive reliability to be even lower than previously thought.
  • Professionally pressed DVDs and CDs have a shorter lifespan than recordable ones due to the materials involved. (Sorry, no link. Let me know if you have one.)
  • Hard drive density is now so high that error correction is constantly active (Again, let me know if you remember where I read this)

Now that I’ve scared you a bit, you’re probably asking about the one format type I seem to be leading to. Recordable Optical discs.

If you’re curious, I’ll provide links, but I’ll summarize for the busy: When backing up, use DVD+R (Avoid DVD-R) discs and make sure they were manufactured in Japan or Taiwan. (Especially avoid Indian discs) If your job depends on it, make sure you get “Archival-grade” discs.

Here are the details:

And, as usual, store your stuff in a cool, dry place and use cases made from acid-free plastic. That alone will probably make your old DVD-Rs and CD-Rs stay readable for twice as long. 🙂

Posted in Geek Stuff, Web Wandering & Opinion | 2 Comments

udev and evdev: Removing devices

Yes, there is a legitimate reason for removing devices, and a special way to do it. In my case, I needed to because my cheap USB numpad exported two evdev-compatible devices with the same name. This confused evdev-plug… especially since one of them is completely inert.

The trick is to find the modalias for the troublesome interface in question. That will uniquely identify that evdev interface file leaving the other one untouched. Assuming the device node is /dev/input/event6, this should do the trick:

udevinfo -a -p `udevinfo -q path -n /dev/input/event6` | grep 'ATTRS{modalias}=="usb'

Take the output of that line and substitute it into this udev rule: (See my previous post for details))

BUS=="usb", ATTRS{modalias}=="usb:v1267p0103d0101dc00dsc00dp00ic03isc00ip00", OPTIONS="ignore_device"

It should be pretty self-explanatory.

UPDATE: On a related note, if you are using one of those Mouse+Keyboard USB-to-PS/2 bridges and don’t mind the lack of “Plug and Play”-like flexibility, the simplest way to select one of the two devices is to use something like this:

Driver      "evdev"
Option      "Name" "CHESEN PS2 to USB Converter"
Option      "Phys" "*/input0"

You can get the values for Name and Phys using

cat /proc/bus/input/devices
Posted in Geek Stuff | 3 Comments