Tue, 31 Jul 2007Defcon 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)
Mon, 30 Jul 2007fex - 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.
Comments: 0 (view comments)
Wed, 25 Jul 2007Field 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:
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)
Mon, 16 Jul 2007xscreensaver 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 doneRun 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)
Fri, 13 Jul 2007new 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)
Wed, 11 Jul 2007xargs 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 threeThe trailing - is required, because sh will set $0, $1, etc, based on those arguments. For example: % sh -c 'echo "$0, $1"' foo bar foo, barIn 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 fourSuper useful.
Comments: 0 (view comments)
Mon, 09 Jul 2007Nethacks.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)
Wed, 04 Jul 2007urledit 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.
Comments: 1 (view comments)
Mon, 02 Jul 2007Firefox 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.
Comments: 1 (view comments)
|
Search this siteNavigationMetadataHome About Resume My CodeArticlesARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work EfficiencyProjectsfex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scriptsPresentationsYahoo! Hack Day '06 Unix Essentials Vi/Vim EssentialsTag CloudCalendar
FriendsBarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler ShieldsTechnorati |
|||||||||||||||||||||||||||||||||||||||||||||||||