svn log made easy

svn log is a great command to see what's going on in your subversion repository. Unfortunately, at my job we are using a really old version (1.1.4!), a version so old that it doesn't support the --limit argument. This makes the svn log painful to use as it outputs EVERYTHING.

Luckily, svn log is so awesome that it overcomes this weakness and allows you to use a date based criteria for listing log statements. Unfortunately, the syntax is hard for me to remember. Thus, I wrote this little shell script function that'll list activity for the given days in the past. You can put it in your .bashrc and run it like svnlog 14. That'll output logs from the last 14 days.

svnlog() {
    svn log -r HEAD:{"`date -d "$OFFSET days ago" +%Y-%m-%d`"} $*
Add a comment
Category: programming Tags:

Commandline Fun

Insprired by an article on about using twitter from the command line, I wrote up a simple little script to get your friends updates.

Here it is:

$ curl -s -u username:password \ |
awk '/<text/ {
  text = $0;
/screen_name/ {
  gsub(/ *<\/*screen_name>/,"");
  print $0;
  print text;

All it does it is use cURL to grab the timeline from twitter. Then it passes it through awk to extract the name and text from your buddies. Simple and silly, yes?

Add a comment
Category: shell Tags:

More Keyboard Fun

Continuing along on the keyboard theme, most Google apps have keyboard shortcuts. I've started using Google calendar and found the keyboard shortcuts for it as well. Very handy.

Google Calendar keyboard shortcuts

Add a comment
Category: tools Tags:

Speaking of keyboard navigation....

Did you know that you can navigate Google search results with your keyboard?

It's a Google Labs experiment so you'll have to enable it on any machine you want to try it.

To experience the glory of navigating search results with your keyboard, head on over to Google Experimental Search and click "Join" for the Keyboard Shortcuts experiment. Then it's simply a matter of pressing "J" to navigate down the search results and "K" to move up your search results on Google. Pressing "O" will then open up the link for you. There are a few others that you might like as well so give this experiment a whirl.

The keyboard shortcuts key will also show up on your search results page so that'll help you remember them. (Experienced vi users will of course recognize these keyboard shortcuts.)

Add a comment
Category: tools Tags:

Throw away that mouse

Mouseless browsing screenshot

I'm not a big fan of using the mouse. It pains me to reach for it to accomplish something. That's why I was really excited to find the Mouseless Browsing add-on for Firefox.

From the add-on's homepage:

Mouseless Browsing (MLB) is a Firefox-Extension which enables you to browse the internet with the keyboard. The basic principle is to add small boxes with unique ids behind every link and/or form element. You just have to type in the id and press enter (there is also an automatice mode available) to trigger the corresponding action i.e. following a link, pressing a button or selecting a textfield.

I could never get w3m working how I liked it so Mouseless Browsing really scratches an itch I have.

Add a comment
Category: tools Tags:

jQuery and Friendfeed experimentation

So, I created a little page that'll dump out the last 30 items from my Friendfeed feed.

jQuery and the Friendfeed API make it incredibly easy. It only took me about 15 minutes to get it working. The rest of the time was making it ugly with my crazy design skills.

It's over on my vanity site if you are curious to check it out.

Add a comment
Category: programming Tags:

Google Code Search to the rescue

UPDATE: Google Code Search was shutdown so this fun doesn't apply anymore.

Mmkay, this tip is probably a gazillion years late but Google Code Search is a great resource for a budding developer. Heck, I'm a relatively seasoned developer and I use it.

It allows you to search public source code using a variety of methods. You can search for an exact string or a regex. You can search certain files, certain packages and certain languages.

For instance, today I was curious how to use the Perl API for writing a Pidgin plugin as their documentation is a tad sparce. A quick search looking for Purple::Find::buddy and I found a whole bunch of examples. You can also use it for silly things, like looking for quotes from "Hitchiker's Guide To The Galaxy."

It's official, Google now owns me. sigh

Add a comment
Category: programming Tags:

Machine specific startup files in BASH

Here's a helpful tip if you use a couple of different machines and need specific things set up on a specific machine.

Just add the following to your .bashrc

## Read Generic RC                                                                            
for rcfile in "$HOME/.shell/"*.rc;
    if [ -r "$rcfile" ]; 

Thus, common things are stored in your .bashrc (like aliases, functions, etc.) and things you want on a specific machine are in their own directory.

Then, just put whatever machine specific files you want/need in ~/.shell and name them with .rc. For instance, I have ~/.shell/smurf.rc that sets up some smurf information.

> export FAVORITE_SMURF="Poppa Smurf"
> export SMURF_LOVER=$HOME/bin/blue_love

That way, if I ever need something that's specific to a machine, I just drop it in my .shell directory and away we go.

Add a comment
Category: shell Tags:

Cost of try/catch in JavaScript

I know that in Java, using a try/catch is fairly expensive vs. a if check. Since JavaScript has the same syntax for the most part, I wrote up a simple benchmarking script to test it out. On my box, it outputs:

if avg: 0.029
try avg: 1.372

Note, that you'll need the Firebug plugin for Firefox in order to run this.

var tryFunc = function () {
  try {
    document.getElementById("fake").innerHTML = "hi there";
  } catch (e) {
    // eat it!

var ifFunc = function() {
  var el = document.getElementById("fake");
  if (el) {
    el.innerHTML = "hi there";

function benchmark(name, func) {
  var repeats = 1000;
  var elapsed = 0;
  var startTime =0;
  var endTime = 0;
  for (var i=0; i< repeats; i++) {
    startTime = new Date().getTime();;
    endTime = new Date().getTime();
    elapsed += (endTime - startTime);
  console.log(name + " avg: " + (elapsed / repeats ) );

benchmark( "if", ifFunc );
benchmark( "try", tryFunc );
Add a comment
Category: programming Tags:

HOWTO: Invoke a shell script on a file on save with emacs

At my current job, we use a lot of Template Toolkit. Due to some design decisions (that I consider a tad strange), we have to run a shell script on the template files (e.g. files that end with “.tt”) after they are saved in order for them to be displayed on the dev site.

Since I started using emacs about two months ago, I've learned quite a bit. A new thing on the learning heap is the after-save-hook. Emacs to the rescue yet again.

Here's a emacs lisp function I wrote to automate the execution of the script when a template file is saved:

(defun ssm-cheetah-after-save-hook ()
  "After saving a tt file, run the language_update file"
  (if buffer-file-name
        (setq is-tt-file (numberp (string-match "\.tt$" buffer-file-name)))
        (if is-tt-file
              (setq cmd (concat (getenv "B") "/bin/YOURSCRIPTHERE --template="))
              (shell-command (concat cmd buffer-file-name))
              (message "Updated template with %s" buffer-file-name))))))
(add-hook 'after-save-hook 'ssm-cheetah-after-save-hook)

What it does, is first defines a function that checks to see if we have a file name, (which should probably always be true since we are saving now that I look at it). If we do, check to see if the name ends with “.tt.” If it does, pass the name of the file to the shell script and output a message to the user saying the template was updated. Finally, the function is added to the after save hook.

Add a comment
Category: editor Tags:

© Seth Mason 2014

Themed using aboutwilson

Powered by Pelican