This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bitly tech talk 4/22/2010 | |
On 4/22 we held a bit.ly tech talk on 'Command Line Fu', where we invited talented hackers to come share their best moves. Please correct my notes and add your fu here! | |
# @jehiah | |
# in place file regex replacement | |
perl -pi -e 's/this/that/g' filename_pattern | |
# print the last column of a file ($NF stands for 'Number of Fields' or more commonly Last Field). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (key, values, rereduce) { | |
// value -> [count, min, max, mean] | |
var i = 0 | |
, l = values.length | |
, min = values[i][2] // set min to the first max | |
, max = 0 | |
, weighted_sum_of_means = 0 | |
, count = 0 | |
, cur_count // just for clarity, feel free to remove later | |
, cur_min |