0. Internet 1. Text 2. Graphics 3. System 4. File 5. Misc 6. Palm 7. OS X |
vi for nano lovers # For the very occasional vi / vim user who just wants to edit a config file on a remote server, thank you very much: Switch to insert mode (from which you can enter text) i Switch to command mode (from which you issue the commands below) ESC Quit without saving changes :q! Save (write) the file :w Save (write) the file and quit vi :wq Delete characters under and after cursor (like Del key in most apps) x Delete characters before the cursor (like Backspace key in most apps) X Find previous ? Find next / Cursor up, down, left, right (arrow keys may also work) k, j, h, l /nix | Mar 31, 2009 Bypass Dell Inspiron 1100 battery check during BIOS update #Installing Ubuntu (or any Linux distro for that matter) on a Dell Inspiron 1100 requires updating the BIOS to version A32 for video to work properly (8.10 instructions). Unfortunately, the BIOS flashing utility (I1100A32.exe) will halt if it does not detect a charged battery: ERROR Battery must be installed. ROM update not performed. Press any key to exit.Perhaps there are some documented command line switches or arguments? Apparently not: A:\>I1100A32 /h Flash BIOS Update Program - Version A32 Copyright 1990-2003 Dell Computer Corporation. All Rights Reserved. usage: I1100A32The scanty documentation was equally unhelpful, as were my attempts to reverse engineer the flasher with IDA Pro and OllyDbg. Thankfully, Christopher Muto had posed the following question to alt.sys.pc-clone.dell back in 2004: does anyone know of a way to flash the bios on an inspiron 3800 that does not have a battery?Even more fortuitously, Bill Joy had responded: I have heard of a /forceit option when executing the flash. Another option I have seen is /jabil when forcing it to flash when it thinks it has an incompatible BIOS update -- maybe try it if the other option does not work? Since these batteries are available on eBay for only $40-50, it is probably not worth the risk of damaging your system.Throwing caution to the wind, I decided to give the /forceit option a try (readers: do so at your own risk and joy). Lo and behold, the evil battery check was miraculously bypassed! Hallelujah! /misc | Mar 29, 2009 Who needs a database when you've got sed and awk? ;-) #As a simple text-based site, TinyApps.Org is ideal for parsing with *nix text processing commands. Here is a one-liner to calculate the average file size of the Palm apps: grep -o "\[.*\]" palm.html | sed 's/[^0-9]//g' | awk '{s+=$1}END{print s/NR}' Let's break it down: First, grep will return all patterns within palm.html matching an open bracket, followed by anything, followed by a close bracket. The -o option (only-matching) instructs grep to show only the part of a matching line that matches the pattern (as opposed to returning the entire line). This gives us output like: [58k] [62k] [296k] ...Next, we'll use sed to (s)ubstitute any non-numeric character with nothing, (g)lobally: sed 's/[^0-9]//g' which returns: 58 62 296 ...Finally, we'll use awk to total and average the numbers: awk '{s+=$1}END{print s/NR}' {s+=$1} sums the first (and only) column. {print s/NR} prints the sum divided by NR (an awk variable that returns the Number of Records (i.e., lines) read so far). And the result is: 112.324This worked beautifully on all of the other app pages as well (osx.html, internet.html, etc) save for one: system.html. On that page, one of the entries reads: "[various sizes]". This is the only instance in all of the app pages where a number is not listed within the brackets. As a result grep -o "\[.*\]" system.html | sed 's/[^0-9]//g' displays a blank for that line:
...
1454
<-- Note the blank line here
30
...
which means that awk divides (in this case) 18729 by 55 records instead of the correct 54.In order to remedy this problem, we will add a second command to sed, separated from the first by a semicolon: sed 's/[^0-9]//g;/./!d' /./!d deletes any line which does not contain at least one character, thus removing the single blank line. Now awk will divide the total by the correct number of lines to arrive at the true average (346.833). The full one liner is now: grep -o "\[.*\]" palm.html | sed 's/[^0-9]//g;/./!d' | awk '{s+=$1}END{print s/NR}' Do you have a faster/leaner/tinier method? Or perhaps another interesting one liner? Please share the goodness! /nix | Mar 28, 2009 Random harvest #
/misc | Mar 28, 2009 Regular expression builders and tutors #
/misc | Mar 28, 2009 Calculate wattage for your PSU #eXtreme Power Supply Calculator Lite helps you estimate what size power supply might be appropriate for your hardware. Although it is a simple web-based app, the following notice appears at the top in red caps: "ATTENTION: FOR PERSONAL, NON-COMMERCIAL USE ONLY". There is a Pro version for $1.99 which presumedly permits commercial use, though this is not explicitly mentioned in the comparison table. /misc | Mar 22, 2009 Bypass Seagate DiscWizard's brand check #Seagate Discwizard is now based on Acronis True image 11, which offers cloning (proportional if desired), backup/restore, and wiping of disks. Normally, an internal Seagate/Maxtor brand drive is required for the boot CD to function (otherwise the following message appears: "Error - To use the product, at least one Seagate or Maxtor device should be installed in your system"). This is an unfortunate bug for users of Seagate/Maxtor external devices. Thankfully, fmyhr has posted a workaround on Seagate's Community Forums that was provided by one of their techs: at the error screen, hold down Alt while typing "t" then "o" (for "tech override") and then click OK. /misc | Mar 21, 2009 Command line time tracker #Michael Stumpf kindly informs us of Trevor Caira's Timebook, "a small utility which aims to be a low-overhead way of tracking what you spend time on. It can be used to prepare annotated time logs of work for presentation to a client, or simply track how you spend your free time. Timebook is implemented as a python script which maintains its state in a sqlite3 database." /nix | Mar 15, 2009 |
Categories
Blosxom Archive
2010: 9 8 7 6 5 4 3 2 1
2009: 12 11 10 9 8 7 6 5 4 3 2 1 2008: 12 11 10 9 8 7 6 5 4 3 2 1 2007: 12 11 10 9 8 7 6 5 4 3 2 1 2006: 12 11 10 9 8 7 6 5 4 3 2 1 2005: 12 11 10 Blogger Archive
Ezine Archive
|