photo
Jordan Sissel
geek

Tue, 31 Jul 2007

Defcon 15, this weekend.

I'll be making my yearly trek to Vegas for Defcon 15. If you're going, and want to meet up, let me know :)

Comments: 1 (view comments)
Tags: , ,
Permalink: /geekery/defcon-15-pre
posted at: 02:03

Mon, 30 Jul 2007

fex - field extraction tool

I recently posted about a tokenizing tool based somewhat on xapply's field extraction. I think it's polished enough for a release.

fex-20070729

Comments: 0 (view comments)
Tags: ,
Permalink: /geekery/field-extraction-tool-fex-release
posted at: 01:58

Wed, 25 Jul 2007

Field extraction tool

Tonight was spent implementing and extending one of my favorite features of xapply: its subfield extracting feature, aka this syntax: %[1,2:1]

The gist of this is that you specify a sequence of field number, separator, field number, separator, etc, to get some very quick tokenization to pull the specific data you want. Basically it gives you *extremely* concise syntax for the a subset of the features provided by cut(1).

My tool expands on this a bit further. It's best shown by example:

% ./fex '0:-2/1' < /etc/passwd | sort  | uniq -c
      3 bin 
      1 dev 
      4 home 
      2 nonexistent 
      1 root 
      2 usr 
     14 var 
The string '0:-2/1' means:
  • 0 - the full string (aka "root:x:0:0:root:/root:/bin/bash".
    "0" here uses awk semantics where $0 in awk is the full record and $1 is the first field.
  • : - split by colons
  • -2 - take the 2nd to last token (by colon) (aka "root")
    Negative offsets aren't available in xapply, but are valid here.
  • / - split that by "/"
  • 1 - take the 1st token (aka "root")
The output is essentially the root directory for everyone's home directories. Doing this in awk, cut, perl, or any other tool would be much more typing.

You can also specify multiple field extractions on a single invocation:

# Take the first and 2nd to last token split by colon
% ./fex '0:1' '0:-2' < /etc/passwd  
root /root 
daemon /usr/sbin 
bin /bin 

# Alternatively, {x,y,z,...} syntax selects multiple tokens
# note that the output is joined by colons.
# Again, this is a feature unavailable in xapply's subfield extraction
% ./fex '0:{1,-2}' < /etc/passwd
root:/root
daemon:/usr/sbin
bin:/bin

# Parse urls out of apache logs:
% ./fex '0"2 2' < access | head -4
/
/icons/blank.gif
/icons/folder.gif
/favicon.ico

I still have tests to write and bugs to fix, so you won't find a release yet.

Comments: 1 (view comments)
Tags: , ,
Permalink: /geekery/field-extraction-tool
posted at: 04:04

Mon, 16 Jul 2007

xscreensaver hack: show your screen while locked

There are some rare cases when you need to have your screen locked, but still have the current display visible without a screensaver or blanker.

Here's a hack to do it with xscreensaver and xdotool:

#!/bin/sh
while true; do
  xdotool search --onlyvisible --name xscreensaver \
  | xargs -r -n1 sh -c 'xdotool windowsize $1 1 1' -
  sleep 3
done
Run this and lock the screen. Every 3 seconds this script will try to shrink the xscreensaver window to 1x1 pixels and reveal your desktop below it. Useful if you need it.

Comments: 0 (view comments)
Tags: , ,
Permalink: /geekery/xscreensaver-visible-screen-hack-with-xdotool
posted at: 21:40

Fri, 13 Jul 2007

new xdotool version available (20070713)

Hop on over to the xdotool project page and download the new version.

The changelist from the previous announced release is as follows:

20070713:
  * Add flag SIZE_USEHINTS to xdo_window_setsize
  * Add flag --usehints to xdotool windowsize

  Increments are used often in terminals that say "my font is 5 by 7 pixels, so
  resize by that increment". So, you can use this to set a terminal to be 80x24
  characters instead of pixels. Verified by resizing xterm and gnome-terminal.

20070712:
  Added new search options to 'xdotool search'
    --onlyvisible shows only visible windows in the results
    --title causes only the window title to be matched
    --name causes the window name to be matched
    --class causes the window class to be matched

  For information on names and classes, check out the xprop tool.
    For example, for an xterm you will see this in the xprop output:
    WM_CLASS(STRING) = "xterm", "XTerm"
  "xterm" is the name, "XTerm" is the class. Don't ask me what the differences
  are supposed to be. ;)

Comments: 0 (view comments)
Tags: ,
Permalink: /geekery/xdotool-20070713
posted at: 04:00

Wed, 11 Jul 2007

xargs tip

Under normal circumstances, I use this kind of xargs invocation:
xargs -n1 -I@ sh -c 'wget http://@/ | sed -e "s/^/@ /"'
The one argument passed to each invocation is replaced by '@'. This sucks if you have awkward characters such as quotes. Instead, use sh's argument processing.

# Failed invocation due to quotes:
easel(~) % echo "one\n'\"two'\nthree" | xargs -n1 -I@ sh -c 'echo "@"'
one
sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file
three

# Successful invocation:
% echo "one\n'\"two'\nthree" | xargs -n1 sh -c 'echo "$1"' - 
one
"two
three
The trailing - is required, because sh will set $0, $1, etc, based on those arguments. For example:
% sh -c 'echo "$0, $1"' foo bar
foo, bar
In an effort to use the shell "properly" I use $1 and pass - as the $0 argument. This lets you do neater things that the -I flag doesn't, such as multiple arguments in a given invocation.

% echo "one\ntwo\nthree\nfour" | \
  xargs -n2 sh -c 'echo $1 and $2' -
one and two
three and four
Super useful.

Comments: 0 (view comments)
Tags:
Permalink: /geekery/xargs-tip
posted at: 01:44

Mon, 09 Jul 2007

Nethacks.org bingesoft testing

George Gensure (and others) has been working on some neat patches for nethack allowing for cooperative and tournament gameplay. It's called Bingesoft, named for the half-day nethack binge tournaments held by the folks I went to school with.

Being addicted to nethack, I went to test it. One of the changes included making the dungeon 10x larger (500ish levels instead of 50). This proved interesting. It was mostly a vanilla nethack install + bingesoft patches. These include a postal service and auction house.

In the game, I had finished all my normal activities (mines, sokoban, the quest) before I visit Medusa. I got to dungeon level 51 and was wondering where exactly medusa was. It was at this point I found out there would be 200 levels down. So, I used a cursed scroll of teleport (I had teleport control) to go to level 200.

Keep in mind, that the kind of monsters generated at any given level (assuming you don't have the Amulet of Yendor) are based on an average of your experience level and the current dungeon level. The average at dungeon level 50 was 30ish, and it only went up from there.

Level 200 was still the normal dungeons, except the only monsters spawning were Archons (due to reasons mentioned). Since I was lawful, they were peaceful. I managed to tame 4 of them along the way. 4 Archons vs something equals dead something. Using wands and scrolls of create monster, I ended up making them extinct. Any invocations of wands of create monster did nothing; there were no archons left! Hah.

So I level telported again down to some randomly-large number, 280. This dumped me in the valley of the dead at level 265. Remember what I said about only Archons spawming? The same was true for the bad levels below medusa about liches. Only arch-liches and master liches were spawning. My posse of Archons took care of 20-30 of them before I got bored and teleported to level 1 where I left the dungeon.

This was my first game as a knight. Fun class. My end-game stats are here.

Comments: 2 (view comments)
Tags: ,
Permalink: /geekery/nethack-bingesoft-testing
posted at: 22:39

Wed, 04 Jul 2007

urledit firefox extension project page is up.

I put up a project page for the new urledit extension. It includes download links and a screencast demo.

/projects/firefox-urledit

Comments: 1 (view comments)
Tags: , , , ,
Permalink: /geekery/firefox-urledit-project-page
posted at: 14:41

Mon, 02 Jul 2007

Firefox URL Editor extension ready.

Last week, I posted about a new firefox extension I was working on that would let you edit the contents of the urlbar more easily. Well, I have good news. It's alive.

The current incarnation is very basic, but I have some ideas for how to extend it in the future. I won't go into that now.

This extension adds a menu item to the context menu in the url bar labeled 'Edit URL'. This will bring up a dialog box with a table of key-value pairs listed. You can edit, add, or delete entries. Clicking 'OK' will modify the url based on your changes. It automatically unescapes values and re-escapes them later.

Download urledit.xpi

Comments: 1 (view comments)
Tags: , , , ,
Permalink: /geekery/firefox-urledit-20070701
posted at: 04:52

Search this site

Navigation

Metadata

Home About Resume My Code

Articles

ARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work Efficiency

Projects

fex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scripts

Presentations

Yahoo! Hack Day '06 Unix Essentials Vi/Vim Essentials

Tag Cloud

Calendar

< July 2007 >
SuMoTuWeThFrSa
1 2 3 4 5 6 7
8 91011121314
15161718192021
22232425262728
293031    

Friends

BarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler Shields

Technorati