Search this site


[prev]  Page 3 of 3

Metadata

Articles

Projects

Presentations

Firefox, Greasemonkey, and del.icio.us

I got bored and decided to play with greasemonkey. The results are somewhat crude but it works and I think I like it better than my current solution to interface with del.icio.us.

delicious.user.js

Requires: Firefox, the greasemonkey extension, and a del.icio.us account (free)

For those out of the Know: Greasemonkey is a sexy extension for Firefox that lets you execute "user" scripts whenever a page loads. This lets you add functionality, remove banner adds, clean up pages, change themes, etc of pages you are viewing. This prospect is extremely exciting.

Since the Mozilla family support xpath and other neat things in its javascript engine, you can do huge set of actions on the pages you view. This includes using xpath to find advertisements and deleting those elements, for instance. The possibilities are potentially limitless. I highly recommend people having a gander.

Go to GreaseMonkey

procmail, formail, and duplicates

People are fundamentally bad at using 'reply-all' - or perhaps it is that 'reply-all' itself is bad. Either way, reply-all to lists will reply to the list AND to the poster, who most likely is a member of the list anyway. So, s/he gets two copies. This irritates me because I have to end up removing duplicates myself, manually.

Worry not, here comes procmail and formail to save the day. The following 2 rules will put duplicates in a 'duplicates' folder.

# Keep track of message IDs.
:0Whc
| formail -D 8192 messageid.cache

# I don't want to see duplicate messages
:0a
duplicates
A special note on duplicate detection. Every email (hopefully) will have a Message-ID. Replies will hopefully have an In-Reply-To or a References header that specified the Message-ID that it is in response to. This is how MUA's (mail user agents) know how to sort mail by "thread."

At any rate, formail -D tells formail to look in the cache (messageid.cache) for an existing message id. If it's not found, it is stored and formail exits with failure status. If it is found, formail exits with a success

Read the procmailrc manpage if you want to know what the W, h, c, or a flags mean on rules.

getting pageup/pagedown to work properly under solaris (Xsun)

The default handling of pageup and pagedown by xterm under Xsun is annoying. When you hit page up in xterm, it scrolls up. This behavior is undesirable and different from what I'm used to using. So, Xresources to the rescue.

Xterm supports a number of options including keybindings, here's my fix. This will send a "page up" or "page down" character sequence to your terminal if you hit page up or page down, respectively. Shift+pageup still works as expected (actually scrolls)

! Override default action when hitting pageup and pagedown - actually
! send the ANSI code for page up
*VT100.translations: #override \n\
	~Shift <Key>Prior: string(0x1b) string("[5~") \n\
	~Shift <Key>Next: string(0x1b) string("[6~") \n

Put that in your .Xresources and load it with:

xrdb -merge .Xresources

This file should get loaded automatically when you login through dtlogin, but I haven't tested this yet.

xterm -e screen? Something better...

I got tired of losing my terminal sessions whenever I decided I needed to restart X for some reason, or one of my assclown dorm-mates decides to ctrl+alt+backspace my X session. So, instead of enabling DontZap in my XF86Config, I figured I would just use screen to compensate. This wasn't enough, seeing as xterm -e screen would just start up a new screen session completely ignoring the current detached ones and thus defeating the purpose of using screen for convenience. Thus, I wrote a two line script to fix this problem:
#!/bin/sh

SESSION=`screen -ls | grep '(Detached)$' | sed -ne '1p' | awk '{print $1}'`
[ -z "$SESSION" ] && screen || screen -x "$SESSION"

What this does is look for the first detached screen session listed by screen -ls and use it to attach to. If there are no currently-detached screen sessions running it'll start up a new one and running your default shell.

Ok, so how is this useful? Put the script above in a file called "attach" and throw it in ~/bin/ (make that directory if you have to). Make sure you chmod 755 ~/bin/attach! Now change the way you open terminals in your windowmanager to:

xterm -e ~/bin/attach [other xterm opts here] 

And you're good to go :)

sshall again

So xapply -f doesn't cut it for when I want interactive ssh sessions, so I updated my sshall script to use the apply syntax instead of xargs - this lets me do

sshall

and actually get a login prompt. If I used xapply (as previously) it would complain about not being able to grab stdin (or a tty) because we were doing:

cat hostlist | xapply -f 'ssh ...'

This would give the error message (for each host):
project1 -
Pseudo-terminal will not be allocated because stdin is not a terminal.
The solution to this problem is varied. You'll probably need the -t option for ssh: ssh -t [email protected] will allocate a terminal for you on the remote server so console-based applications will work.

x2x2x2x2x

I love my laptop keyboard and mouse nipple. I love them lots, and since my desktop keyboard is kinda borked right now (some keys don't work all the time) I decided I'd use x2x from my laptop -> my desktop. My destop also has x2x from it to my ultra1.
If the mouse from my laptop is being sent to the desktop currently, then I can use the desktop's mouse to go to the ultra1's head and use mouse+keyboard there...
so I end up using laptop keyboard + desktop mouse on the ultra1.. haha <3 x2x

ion-devel

So with much a-fiddling, I discovered that you can create floating workspaces with the default keybinding "F9" - At the prompt, "Go to or create workspace: " enter WFloatWS:<workspace name> where <workspace name> can be anything. Hitting F2 starts up my friend, xterm, on this new floating workspace.

I haven't yet figured out how to create empty WFloatFrames, but I'm working on it. It seems that if the parent frame has only one child you can't cfocus the parent until the child is dead.

That is:

WIonWS
  |
  +---> WIonFrame
    |
    +----> WFloatWS
You can't give focus to the WIonFrame until WFloatWS either is destroyed or moved outside of the frame. I'm sure there's a way around this.

ion rocks me

I've been comfortable with my assumption that ion was lacking in a way to do floating workspaces and windows and had groomed my desktop enviroment to fit this assumption. However, yesterday as I was poking around in the various lua config files I saw how to create floating workspaces.

From what little bit I've played with this feature you can do a ton of crazy cool things (From simply having a full-screen floating workspace to attaching a floating workspace to an existing WIonFrame.)

Mad kudos to Tuomo for writing such a kick ass window manager. I'm going to produce some documentation soon on how to use Lua in Ion and a brief introduction on the floatws module and how to use it.

screen/xapply = fun

So I rewrote an 'sshall' script I had been using for some time to use xapply instead, I don't know if I'll keep it this way.

I added screen support to, so doing:
sshall -s
in a screen session will open each ssh command in a new screen window. Woot?

Cool vim command of the day.

Accidentally hit # in vim. :help # showed that this goes in reverse looking for the word the cursor is on. * is the opposite and will jump forward. In vim type :help * for more info! I love vim :(