Posts Tagged ‘geek’

multi-multi-multi function office machines

Thursday, August 28th, 2008

Currently in a waiting room and CNN is on. There was just a commercial for a Sharp deep freezer sized copier/scanner/printer/sink. The business person googled for a restaurant to take a client to on the built in touch screen then presses a button to print a full-color map to the restaurant. What business person would go to the copy building (a room is not big enough) to google a restaurant?

Sorry check back later for pics, Steve Jobs says I don’t need copy & paste as I’m sending this from the wordpress app on my iPhone.

Update:

One note of clearification, as crazy as the feature set on these machines is, I still wouldn’t mind having one to use whenever I wanted, imagine what you could do with it! The commercial I saw is available in flash form at
http://www.sharpusa.com/files/workwithoutlimits.swf.

No upstart Docs + asshole Canonical Employees = Fail

Monday, August 18th, 2008

I was in need of a means to disable upstart scripts in /etc/event.d via some means other than getting rid of the file. Since upstart has no documentation to speak of, I asked my buddy Google.

Google pointed me to the year old bug 94065 in launchpad. I added a quick ‘me too’ and subscribed to updates on the bug. This was back in March. Fast forward to last week and this arrives:

** Changed in: upstart
      Target: 0.5 => None

--
Add non-destructive means to disable a job
https://bugs.launchpad.net/bugs/94065
You received this bug notification because you are a direct subscriber
of the bug.

There is no mention of this change in bug meta-data on the launchpad site, or maybe I’m just not finding it since I lack the doctorate in navigating launchpad necessary to be able to use the site. This prompted an update from the original reporter on the bug asking for more information:

is there a disable method yet? i reported this initially over a year ago. (there may be, but since there’s no upstart manpage on hardy, it’s hard to know. :-)

Now for the asshole fail:

Scott James Remnant wrote on 2008-08-14: (permalink)

Does this bug report say that there is a disable method? Is it marked Fix Released?
No.

I’m not sure what Scott James Remnant <scott@canonical.com>’s roll at Canonical is but perhaps it should be modified to remove any tasks that involve interaction with the public?

The Definitive qmail Patch

Monday, August 11th, 2008


I have spent quite some time working on the definitive qmail patch. So as not to keep all this goodness to my self I have decided to make this patch available to all:

http://thegrebs.com/~michael/netqmail-1.06.patch.bz2

Polite Spam

Tuesday, July 15th, 2008
From: "claude je" <redacted>
To: <billing@linode.com>
Subject: You are about to get fired

You are about to get fired
http://[redacted]/view.exe

It is quite polite of the sender of this piece of mail to warn the recipient that they are about to get fired for infecting office machines (supposing they click the link from a suitable browser, that is).

screen copy mode can be used to copy/paste

Thursday, July 10th, 2008

I’m aware of many people that use GNU Screen’s copy mode to scroll back through terminal history but don’t actually use copy mode for copying text for later pasting. I was one of those people myself for some time. Screen supports some pretty nifty copy/paste tricks but a few basic key strokes will get you started.

Entering Copy Mode and Scrolling

By default, enter copy mode with CTRL+a then ESCAPE. You can use vi like commands to navigate through the scollback buffer. The arrows and PAGE UP/DOWN should work as well. A few useful commands some may be unfamiliar with:

  • M - jumps to the middle visible line
  • NN% - jumps to the specified percentage in the buffer (0 - start, 100 - end
  • g - jumps to the beginning of the buffer
  • G - jumps to the end of the buffer

These keys are even useful when you aren’t using copy mode to copy/paste text.

Copying Text

Once the cursor is at the beginning location, press SPACEBAR to set your first mark. Next navigate to the ending position and hit it again. The second SPACEBAR will set your end mark and exit copy mode. One neat and often useful feature is selecting a rectangle on the screen rather than full lines. Use c and C to set the left and right column margins to the cursor’s current location.

Pasting

Pasting is easy, just hit CTRL+a to activate screen then ] to paste.

There’s More!

There are loads more options such as multiple copy buffers, the ability to append marked text to the buffer rather than replacing it, etc. Check out the man page for more screen goodness.

dh-make-perl will rock your socks

Wednesday, July 2nd, 2008

dh-make-perl is the most awesome Debian package /ever/.

dh-make-perl --cpan Some::Module --build
sudo dpkg -i libsome-module-0.1-1_all.deb

Done.

Dependencies

If you have apt-file installed and Some::Module requires Lib::Foo for which a Debian package is available, the dependancy will automatically be created. If Lib::Foo does not have a Debian package already available, you will likely need to manually run dh-make-perl on Lib::Foo first.

I haven’t seen the apt-file trick mentioned elsewhere. Honestly when someone mentioned it on IRC I didn’t believe him. Sure enough, looking at the source for dh-make-perl revealed that it does indeed check apt-file for each module that Some::Module lists as required in the META.yml.

Why?

Now dpkg/apt know that you have Some::Module installed. If an official package for Some::Module comes out, it will likely have the same name and if it is for a newer version of Some::Module aptitude upgrade will automagically upgrade you to it. The real win is ease of cleanly uninstalling though. How many times have you found what you thought was the perfect module for task XYZ and installed it. Only to find that it isn’t so hot 5 minutes after beginning to use it. Making sure ‘make uninstall‘ really uninstalled every thing can be a pain.

Rotate through Screen Windows

Thursday, June 26th, 2008

A new command in screen version 4.00 is the idle command.

idle time command

Executes screen command, command when idle for time seconds. E.g. to rotate through screen windows with a 3 second interval:

idle 3 next

To cancel, idle 0

Superman vs. Spiderman

Saturday, June 7th, 2008

I promise I’m not a comic book/super hero[tm] nerd, not that it’s a bad thing. I’ve never owned comic books but last night I was thinking about Superman vs. Spider-Man for some reason.

I think that Superman is the clear winner, he was super duper from the start. Spider-Man on the other hand, he just happened to get bit by a messed up spider. I didn’t consider this a highly weighted factor though. Superman is impervious to all but kryptonite, Spider-Man is way vulnerable.

Batman, though crazy cool with all the gadgets, isn’t even in the running what with no super powers and all.

Weather in Screen Statusbar

Thursday, June 5th, 2008


Caspar Clemens Mierau recently wrote about a nifty Debian package named weather-util and his method for embedding the current temperature into the screen status bar. Quite nifty. I did the same with one small exception, including the predicted probability of precipitation if it exists.

My one liner that runs from cron (split to multiple lines for readability):

 weather -iKACY -f | head -n 9  | \
     awk '/Temperature/ { print $2 "F" }
          /Relative/ { print $3 }
          /precipitation/ { sub (/ chance of.+$/, ""); print "POP " $NF }' | \
     xargs echo > /home/michael/.weather

More details on the full implementation in the original post over at Caspar Clemens Mierau’s blog. And yes, I stole his loadavg stuff too ;)

UPDATE:

Silly me, upon further investigation, two things to note. First, the -i option applies only to current conditions and not to the forecast. In my case I actually want weather -f ACY and /etc/weatherrc takes care of the rest. Secondly, the field number for the precipitation percentage changes, oops. I’ve correctly accounted for this in the updated awk script above.

After making these changes I decided the awk script was getting a bit long for a single line so I went all out creating ~/bin/weather.awk:

#!/usr/bin/awk -f

/Temperature/       { temp = $2 }
/Relative Humidity/ { rh = $3   }
/precipitation/     { sub (/ chance of.+$/, "");
                      precip = $NF;
                      exit
                   }

END{ print temp "F " rh " POP " precip }

My crontab entry now looks like:

*/5 * * * *     weather -f ACY | /home/michael/bin/weather.awk > /home/michael/.weather

Much simpler.

Module::Signature Rocks My Socks

Sunday, June 1st, 2008

Just discovered the perl module Module::Signature by 唐鳳 (Audrey Tang) the other day. It’s pretty spiffy.

Implementing is easy (stolen from the docs):

MakeMaker:

    WriteMakefile(
        (MM->can('signature_target') ? (SIGN => 1) : ()),
        # ... original arguments ...
    );

Module::Build:

   Module::Build->new(
        (sign => 1),
        # ... original arguments ...
    )->create_build_script;

Don’t forget to add SIGNATURE to your MANIFEST if needed.

Then when running make dist you will be prompted for the pass phrase for your gpg key. For extra goodness, add 0-signature.t to your tests. It includes a single test that verifies the package cryptographically during make test if the TEST_SIGNATURE environment variable is set.

If you know waltman and haven’t heard of this module, yell at him for not telling you about it, he’s mentioned in the AUTHORS file for his stellar documentation patches.