years ago i saw my dad working in a terminal and i could have sworn i typed "oops " when he made a typo and it worked: the command was fixed and rerun, he didn't need to retype the whole thing. i always wanted the oops command.
however, it didn't exist, or at least as i knew it. so i wrote a portable version of it (it seems it exists in zsh, a shell i just don't use). the python part of it is really simple, just a levenshtein distance calculator and a replacement engine. you need to create a command alias for it however:
ksh, sh, bash:
$ alias oops='history>/tmp/oops_history && ~/bin/oops.py'
csh and derivatives:
% alias oops 'history > /tmp/oops_history && ~/bin/oops.py'
here's a brief example of it in action:
$ emacss ~/bin/oops.py
ksh: emacss: not found
$ oops emacs
[ emacs opens and voila, working ... ]
i make a lot of typos and rather than cutting, pasting, fixing the line this makes it easier. some bugs and limitations:
i need to make it use the damerau distance, which is better for spelling errors)
not extensively field tested at all
it doesn't leave a corrected mark in your history file
it doesn't work for shell built-ins (e.g. cd)
let me know if you're interested in playing around with it.
i work with a lot of foreign language websites, most in languages i
do not read. to help me with that i often use google translate. but,
i got sick of copying and pasting URLs or text, so i built this
translate button for firefox.
it works like this: when you're on a page and you want to translate it,
surf to the "translate" bookmark (i've located mine in the bookmark toolbar
folder in ffox). poof, automagically translated into english. the magic
is that the bookmark is javascript that will construct the proper URL
for your current page as a target of google translate, and then surf
you there. voila.
make a "translate" bookmark and make this the "location" in its properties.
now you, too, can have a translate button.
javascript:var h = escape(location.href);
newurl = 'http://translate.google.com/translate?u=' + h + '&hl=en&ie=UTF-8&sl=*&tl=en';
document.write(newurl);
window.location = newurl;
paste that code in. simple as that. if you need to change the target language
you can change "tl=en" to another laguage (e.g. "es" or "fr"). the
source language is automatically determined by google translate (see
"sl=*").
little dom's been feverin' lately, but he's slowly getting better.
for the past year and a half i've been working my way through cookbooks and
stuff, learning new recipes and techniques, rarely repeating myself. it's
a challenge, and sometimes beth wants an old favorite that fell way back,
but overall we've found a few gems. here's a couple we made this week:
been getting into wooden toys for dominic. i can't bring myself to spend $56 a set on wooden blocks, so
i've been investigating making my own. stay tuned ...
does dominic need his own homepage on
kidmondo? it may simplify stuff for his relatives to keep track of him.
also been thinking about finally painting inside the house. i wonder if we
could pull off peacock blue cabinets.
found this online while digging for a story i heard recently.
shadow, many years ago, was an awakening for me to a resurgent hip hop and
way better DJs than when i was a kid. i still enjoy his work. he's on tour
this summer with cut chemist in their third installment of an all 45rpm
scratchfest, the hard sell. i've heard excerpts. quite impressive, yet again.
as a quick report, Sauteed Chicken with Olives, Capers and Roasted Lemons was not so good. the acid of the lemons and the brine of the capers and olives did not make for an appetizing flavor. next time i'll skip the olives and capers. however, Chicken with Piquillos, aka pollo casero, was a hit. one small serving left at home.