Monday, December 16, 2013

1.25x playback speed for YouTube

Ever since taking my first Coursera course, I've been addicted to 1.25x video playback.  I just found out how to do that for YouTube with the HTML5 player.  Here's a bookmarklet that does it:

javascript:(function(){document.getElementsByTagName("video")[0].playbackRate = 1.25}());

http://productforums.google.com/forum/#!topic/youtube/kLfAgJ1VNn0

Wednesday, July 18, 2012

Tuesday, July 17, 2012

Perforce: integrate a changelist

Given a changelist number (e.g. 123), just do:

> p4 integrate main/...@=123 release/...

Monday, March 26, 2012

Display function definition in bash

declare -f 'your-function'

h/t http://www.beaconhill.com/blog/?p=29

Thursday, September 10, 2009

Set the Host header in httpclient

It's not enough to call GetMethod#setHeader("Host", "foo.com") -- httpclient will override it with the actual host from the URL you're getting. Instead, use http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpMethodParams.html#setVirtualHost%28java.lang.String%29

Thursday, September 25, 2008

Pipe stderr to another process

In bash, suppose you want to save stdout to a file, but you want to pipe stderr to another process.
Here's how:

> myprocess 2>&1 > file.out | error_processor

This way of doing things in bash has always confused me, because it seems like you're putting stderr into stdout, then saving stdout in file.out. But it's backwards. Similarly, if you do

> myprocess > file.out 2>&1

you save both stderr and stdout to file.out. Counterintuitive!