photo
Jordan Sissel
geek. sysadmin. blogger.

Sat, 30 Jun 2007

Random statistics.

  • Lines of code in my svn repository, by file extension: c 27676, cpp 11488, h 2780, html 1566, java 5496, js 2994, pl 2278, pm 3215, py 2062, sh 1459, xml 8602.

    These were generated via 'wc -l' and hence don't ignore comments. There's a few thousand lines of code in there that I didn't author, but I didn't expect those numbers to be so high. Crazy.

  • Number of posts to this website: 314 posts, 11 articles, 22 projects.
  • Histogram of length for unique commands my shell history:

Comments: 0 (view comments)
Tags: ,
Permalink: /geekery/random-code-stats
posted at: 02:58

Wed, 27 Jun 2007

New keynav release available

This release of keynav adds necessary support for configuration files and the benefits obtained from dynamic configuration.

View the project page and/or download keynav-20070629.tar.gz

Update: 20070627 had problems with $HOME so I released a new version (0629).

Comments: 0 (view comments)
Tags: , , , ,
Permalink: /geekery/keynav-20070627-released
posted at: 04:08

Mon, 25 Jun 2007

SuperHappyDevHouse 18 - review

This past shdh was my first. It wasn't what I expected; way more people showed up than I thought would show. Totally sweet.

There were 6 or so tables setup with chairs and power strips. Wifi. Someone setup a projector to display sniffed google/yahoo searches flying over the wireless. I was already doing my standard 'ssh -D8888 somewhere' and having firefox proxy over that.

The projector was displaying the decoded contents of search queries. My first work that day was on hacking the projected screen. The first one was hacking pushing search queries with wget(1) that had terminal control codes. After that, I figleted-things to the screen using figlet, awk, xargs, and wget. Some time later I got around to doing something way cooler. Basically, I had a script that would read every key stroke I typed, and send a search query consisting of a clear-screen sequence followed by the whole string I had typed. When I demoed it, I managed to convince some through assumption that I had owned the machine itself, and not that I was doing this all via search queries. Hehe, fun. Here's what I was using:

(stty raw; x=""; while true; do a="$(dd bs=1 count=1 2> /dev/null)"; if [ "$a" == "^H" ] ; then x=${x%?}; else x="${x}${a}"; fi; wget --read-timeout=.001 --tries=1 "http://www.google.com/search?q=^[[2J^[[0;0H$x"; done)

There was a large ruby-fan presence. Lots of people working on facebook apps, too.

If you didn't see the slurry of posts I made during shdh about code I was working on, here's a short list:

  • Got a prototype of jquerycmd working
  • Wrote a google maps direction scraper with jquerycmd
  • Wrote Makefiles for navmacro and xdotool that work without pkg-config
  • Started working on the urledit firefox extension
  • Implemented urledit with xdotool and a shellscript
Tons of code written. I had a good time, but next time I'm going to try for a more social approach instead of sitting in a corner coding like a fiend ;)

Comments: 4 (view comments)
Tags: , ,
Permalink: /geekery/shdh18-review
posted at: 18:02

xdotool project page posted

I've gotten enough positive feedback about xdotool to convince me to put up a real project page for it. You can view it here at /projects/xdotool

Comments: 0 (view comments)
Tags: , , , ,
Permalink: /geekery/xdo-project-page-posted
posted at: 04:31

Sun, 24 Jun 2007

Firefox 'url editor' implemented with xdotool

You'll need xdotool and these 3 scripts for this example: Then just run 'ffue' and it'll open up vi with the current url split so you can edit it. Save+quit and it'll unsplit it and use ffup to go to the modified url.

Comments: 0 (view comments)
Tags: , ,
Permalink: /geekery/firefox-urleditor-with-xdo
posted at: 03:57

Firefox URL Editor extension - in progress.

The goal of this project is to allow me to edit any parameter in the url bar quickly, rather than having to scroll slowly and inaccurately across the single line that is the urlbar. This is extremely necessary when you're dealing with long urls.

Comments: 1 (view comments)
Tags: , , , ,
Permalink: /geekery/firefox-urleditor-hackery
posted at: 02:30

Sat, 23 Jun 2007

jquerycmd+xpathtool == direction scraping on google

Show the first 3 steps that google maps tells you to take.
./getpath.sh "atlanta to nyc" | head -3
Head southeast on Trinity Ave SW toward Washington St SW        0.2mi
Slight left at Memorial Dr SW   0.3mi
Turn left at Martin St SE       361ft
Pipe that to lpr and you've got printed directions on under 5 seconds.

Why not just do this with plain page scraping? Because there's lots of javascript in google maps that presents the user with the directions. Firefox (Gecko, really) already parses it, so why bother reinventing the wheel? Let's use the wheel that already works.

Download jquery-20070623.1828.tar.gz. The download of jquerycmd comes with the xul app, 'jquerycmd.sh' and 'getpath.sh'.

For the lazy who just want to see the scripts:

Comments: 0 (view comments)
Tags: , , , , ,
Permalink: /geekery/superhappydevhouse18-part2
posted at: 21:16

At SuperHappyDevHouse 18

I've been working on the jquery commandline tool. The base features work, now all that remains is endlessly interating over adding features.
% ./jquerycmd.sh --url http://www.google.com --query img
<IMG width='276' height='110' src='/intl/en_ALL/images/logo.gif' alt='Google' />
% ./jquerycmd.sh --url http://www.technorati.com/ --query form
<FORM method='post' action='/query.php'>
        <div class="controls">
            <a href="/search?advanced">advanced search</a>
        </div>
... < remainder cut > ...

Comments: 0 (view comments)
Tags: , , ,
Permalink: /geekery/superhappydevhouse18-part1
posted at: 20:23

Fri, 22 Jun 2007

xdo updates: window operations and searching

Today's efforts are summarized best by:
% ./xdotool search "Mozilla Firefox"
31457484 
% xwininfo -id 31457484 | egrep 'Width|Height' | paste - -
  Width: 1278     Height: 1008
% ./xdotool windowsize `./xdotool search "Mozilla Firefox"` 500 500
% xwininfo -id 31457484 | egrep 'Width|Height' | paste - -
  Width: 500      Height: 500
This new 'search' command will walk the list of windows in X and basically output any windows with a matching title, name, or class. In this case, I have 1 "browser" window open under firefox that has "Mozilla Firefox" in the title. So I then resize it to 500x500, trivially.

Longer summary of today is that I added 4 new functions to xdotool:

  • windowsize <windowid> <width> <height>
  • windowfocus <windowid>
  • windowmove <windowid> <x> <y>
  • search <regexp>
Thanks to valgrind, I also fixed the crashes in Linux. Was due to an off-by-one bug. Sweet tool: valgrind.

Turns out XTEST works as I'd expect, and this example will do what you think, and switch to the 2nd console (assuming you're running one).

% ./xdotool key "ctrl+alt+F2"

Goal: Focus the first window found that is a local xterm (ie; not ssh'd anywhere). My xterms have title with 'host(pwd) - activity' in them. So if my local host is 'snack' I can do:

# Look for xterms starting with 'snack(' and focus the first one
./xdotool search '^snack\(' | head -1 | xargs ./xdotool windowfocus
And magically one of the xterms running a shell locally is focused. I can see this being pretty useful.

Today's code: navmacro-20070622.tar.gz.

Comments: 0 (view comments)
Tags: , ,
Permalink: /geekery/xdo-updates-2
posted at: 04:12

Wed, 20 Jun 2007

xdo "beta" release

I've been working furiously on xdo the past few days. Good times :)

The result so far is as follows:

  • xdo is now a library, so you can simply call xdo_click(...) and it will handle all the hard stuff for you for the case that you want to use this in your own code.
  • xdotool is the commandline interface to the xdo api.
  • navmacro (bad name) is a very small gtk launcher. Basically it's an input box that runs the contents when you hit enter
I include a sample script 'ffsp' which is short for 'firefox searchbar paste'. It works on my system, but obviously on other systems you'll need to tweak it. The basics are there.

So right now, I can do this:

  1. Select a piece of text in an xterm
  2. Activate navmacro and type 'ffsp' and hit enter
  3. Enjoy the fact that firefox has been told to search for the contents of my clipboard
'ffsp' is located in my $HOME/bin/ so I execute it like any other shell script or program.

Interested in the code? Download navmacro-20070620.tar.gz.

Note: navmacro works on my ubuntu and freebsd systems just fine. However, xdotool crashes at the end when I do free(xdo->charcodes) only on my Ubuntu system. Uncertain why, I'm way too tired to debug.

Comments: 0 (view comments)
Tags: , , , , , ,
Permalink: /geekery/xdo-updates
posted at: 05:08

Search this site

Navigation

Page 1 of 2  [next]

Metadata

Home About Resume My Code (SVN Web)

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

< June 2007 >
SuMoTuWeThFrSa
      1 2
3 4 5 6 7 8 9
10111213141516
17181920212223
24252627282930

Friends

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

Technorati