September 23, 2011

Chrome and Popup Windows in OS X Lion

If you're an OS X Lion user and have found that Google Chrome popup windows send your Desktop/Spaces into conniptions when switching between Chrome windows (I always have Chrome windows in multiple Spaces and the popup wreaks havoc with window switching, while remaining invisible), here's how to fix it:

  • Activate Mission Control (3-finger swipe up)
  • find the popup in the window groups
  • click on it and drag it to a Desktop with no other Chrome windows

Now, switch to that desktop and you can close the popup.

Better solution: Google, FIX CHROME.

Update:

Chrome windows jumping to another desktop in Mac OS X Lion says that if you select "Options > Desktop > None" in the contextual menu for Chrome in the Dock, it fixes it.

Dock-1

Good to know.

R.E.M. by Listserv

Back in the day (1994), we had to get our R.E.M. information from the listserv (that's email for you kids) run out of Lynchburg College in Virginia.

image from images.instagram.com

I've carried this manila folder containing the R.E.M. FAQ and 3/4" of lyrics around from place to place while finishing college, working in Europe, getting engaged, married, moving 3 times, adopting 3 kids, to the day R.E.M. broke up.

This was how I learned to love them and their music, and I'm never getting rid of it.

February 27, 2011

Python StatsD Server

Thanks to Joshua Frederick (github user jfred), we now have an actual Python implementation of the statsd server, so if you don't want to install node.js (though why wouldn't you? :-) ) you can run it all in python.

from pystatsd import Client, Server

# client usage
sc = Client('example.org',8125)

sc.timing('python_test.time',500)
sc.increment('python_test.inc_int')
sc.decrement('python_test.decr_int')

# server usage
srvr = Server(pct_threshold=90, 
  graphite_port=2003, graphite_host='localhost')
srvr.serve()

Get the code (now version 0.1.1) from Github or Pypi

February 24, 2011

node-statsd

I guess once I get a bee in my bonnet I can't let things go. First, it was python, then it was perl. After a couple hours effort, I just released node-statsd, you guessed it - a StatsD client for node.js.

Now, if I could only get a project to use one or more of these clients.

February 18, 2011

On a Roll: StatsD from Perl

Apparently I'm having too much fun -- I've posted a perl client for Etsy's StatsD on Github.

use Net::StatsD::Client;

my $client = Net::StatsD::Client->new();

$client->timing('perl_test.timing',500);
$client->increment('perl_test.inc_int');
$client->decrement('perl_test.decr_int');

February 17, 2011

pystatsd is now on pypi

(With apologies to my non-nerd readers...)

Yesterday I got pystatsd pushed up to pypi (pystatsd on pypi), so you can now install it with:

% pip install pystatsd

If you installed it already, just use -U:

%pip install -U pystatsd

February 16, 2011

Statsd and Python

Short version: pystatsd is fire-and-forget site metrics from python, using Etsy's StatsD and Graphite.

The brilliant devops folks at Etsy released (and posted about) an awesome little node.js-based stats server called statsd.

Statsd sits in front of the Graphite metrics server, providing a simple API for applications to send stats over UDP. UDP is "old tech" but is fire-and-forget -- clients don't have to wait for a response to keep processing.

I took a few hours last night (after reviewing my python socket programming) and ported Etsy's PHP example to Python. Until (and if) it gets pulled into the main repo, yo can find the python sample client in my Github fork of statsd.

>>> from python_example import Statsd
>>> Statsd.timing('some.time','500|ms')
>>> Statsd.increment('some.int')
>>> Statsd.decrement('some.int')

Stand-alone Client

I reworked this code into a standalone client you can now find on Github:

>>> from pystatsd import Statsd
>>> statsd_client = Statsd(host, port)
>>> statsd_client.timing('some.time','500|ms')
>>> statsd_client.increment('some.int')
>>> statsd_client.decrement('some.int')

Enjoy!

February 14, 2011

Related Items for Movable Type

I posted a quick update on the Wallrazer blog about some recent work: the Related Items plugin for MT, released under the perl license thanks to Endevver (I'll update this to point to Endevver's repo once it's been updated with the latest changes).

February 10, 2011

Set up your own Github-backed Notational Velocity

When I last posted, I described how I was using a Github-backed wiki as my notes directory in Notational Velocity (and the fork I use, nvalt). That post got some interest, so I decided to try and make the process a bit easier by creating a project for it on GitHub: Veloci-Wiki. In nutshell, once you have a github wiki checked out locally, you checkout Veloci-Wiki and pass the path to your wiki clone to the setup script:

veloci-wiki% perl setup.pl <path/to/your/wiki/clone>

...and Veloci-wiki creates and installs the launchd config file for you, which runs the vw-update.pl script (in the veloci-wiki repo) against your wiki checkout anytime a file is changed, added, or removed there, pushing the changes to your Github wiki:

Full instructions are in the README. Happy hacking, and you can report any issues on Github, leave a comment, or email me (steveivy @ gmail).

February 08, 2011

Wiring Notational Velocity to a Github Wiki

Warning: Serious nerditry to follow.

I use Notational Velocity as my note-taking app. It's a super-easy app that you can drive with the keyboard and syncs with SimpleNote, so I can also access my notes on my iPhone. Specifically, I use nvalt, a fork of NV which adds some nice Markdown-specific features, including a preview.

I got to thinking about how I'd love to be able to edit a wiki through NV, which led to a brainstorm (in the shower, of course).

Update

I took some time and created a project to make this as easy as possible for any of you nerdy types who want to try this at home: Set up your own Github-backed Notational Velocity.

Notational Velocity works with files

NV has a feature that lets you store your notes as formatted text (markdown) documents on the file system. If you select this option, all your files go in ~/Library/Application Support/Notational Data. I thought "Github has a wiki... that uses files!"

My first step was to init a git repo in NV's Data directory:

% cd ~/Library/Application Support/Notational Data
% git init
% git add .
% git commit -m "initial add"

Github works with files

Then, I went over to Github and created a private repository for my notes, at https://github.com/sivy/notes-of-interest/wiki. Sorry, it's private.

Then, I added that repo as a remote on my local repo:

% git remote add origin git@github.com:sivy/Notes-Of-Interest.wiki.git
% git push origin master

I hate updating Github

Like most nerds, I hate doing things manually. I needed to get my changes pushed into the wiki regularly without needing to remember it.

#!/usr/bin/env perl

###
# I have a github wiki wired up to my Notational Velocity file system data store
# It's an amusink little gizmo
#
my $USER='steve';
my $status= `cd /Users/$USER/Library/Application\\ Support/Notational\\ Data/; /usr/local/git/bin/git status`;

if ($status =~ /modified|untracked\ files\ present|deleted/) {
    my $out = `cd /Users/$USER/Library/Application\\ Support/Notational\\ Data/; /usr/local/git/bin/git add .; /usr/local/git/bin/git commit -a -m "NV Wiki Update"; /usr/local/git/bin/git push;`;
    `/usr/local/bin/growlnotify 'NV Wiki Update' -m "Your Notes Wiki was updated:\n$out"`;
} else {
    print "NV Wiki Update: No update needed.\n"
}

Launchd

I use OS X's built-in scheduler, launchd, to run my updater every minute. I created this XML .plist file and stored it in ~/Library/LaunchAgents/com.steveivy. updategithubwiki.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>Label</key>
    <string>com.steveivy.updategithubwiki</string>
    <key>ProgramArguments</key>
    <array>
        <string>perl</string>
        <string>/Users/steve/bin/update_gh_wiki.pl</string>
    </array>
    <key>QueueDirectories</key>
    <array/>
    <key>StartInterval</key>
    <integer>300</integer>
    <key>WatchPaths</key>
    <array/>
</dict>
</plist>

Then:

% launchctl load ~/Library/LaunchAgents/com.steveivy.updateghwiki.plist

Note that the perl script pipes the result through Growl, so I don't have to even think about it - I just know that the wiki has been updated.

Updates

  • Updated to correct that the "store notes as files" feature is in the official Notational Velocity app -- you don't need nvalt to get it.
  • I'm updating my watcher script to use OS X's File System Events (launchd's "watchpaths" feature). Stay tuned for progress.
  • Added link to the original Notational Velocity as I seem to have overlooked it.
  • While I wrote the launchd plist in Veloci-Wiki to use WatchPaths, Notational Velocity saves so often (a good thing for not losing information) that Github was boing updated every 10-15 seconds. I've rewritten the plist to use StartInterval set to 300 (5 minutes) to reduce the amount of traffic.

Status

By The Power Of

monkinetic runs on TypePad.