This file contains 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
#usage: zsr _m_ _n_ : sowest _n_ requests from gzipped log file _m_ | |
function zsr () { | |
zgrep ' (0 reqs/sec) ' $1| | |
awk '{ print $8 " - Mongrel:" $13", " $14 " DB:" $17", "$18 " " $22 }' | | |
sort -nr|head -n $2; | |
} | |
#usage: sr _m_ _n_ : sowest _n_ requests from log file _m_ | |
function sr () { | |
grep ' (0 reqs/sec) ' $1| |
This file contains 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
options = Hash[*"name_1=param_1&name_2=param_2".split(/&|=/)] |
This file contains 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
#detect duplicates across columns in really large tables | |
psql -d database -c 'select col_1, col_2, col_3 from table order by col_1, col_2, col_3'|tr -ds '|' ' '|awk '{print $1 " " $2 " " $3}'|uniq -d |
This file contains 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
--colour | |
--format progress | |
--loadby mtime | |
--reverse | |
--backtrace |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#define M 7 | |
#define m malloc | |
#define r rand | |
#define e exit | |
#define f free | |
#define g signal | |
#define t printf |
This file contains 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
%w(rake/clean rubygems colored).each { |f| require f } | |
INCLUDE = "include" | |
ERLC_FLAGS = "-I#{INCLUDE} +warn_unused_vars +warn_unused_import" | |
SRC = FileList['src/*.erl'] | |
TEST = FileList['test/*.erl'] | |
OBJ = SRC.pathmap("%{^src$,ebin}X.beam") | |
TESTS = TEST.pathmap("%{^test$,ebin}X.beam") | |
CLEAN.include("ebin/*.beam", "tests/*.beam", "erl_crash.dump") |
This file contains 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
module Enumerable | |
def exactly?(percentage, &block) | |
matching(percentage, &block) == percentage.to_f | |
end | |
def more?(percentage, &block) | |
matching(percentage, &block) >= percentage.to_f | |
end | |
def less?(percentage, &block) |
This file contains 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
ree:044 > 1800.seconds | |
=> 1800 seconds | |
ree:045 > 1800 | |
=> 1800 | |
ree:046 > 3 * 600.seconds | |
=> 1800 | |
ree:047 > 1800.seconds.class | |
=> Fixnum | |
ree:048 > 1800.seconds.ago | |
=> Mon, 11 Jul 2011 23:07:01 UTC +00:00 |
This file contains 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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains 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
class AttributeError < RuntimeError; end | |
def foo | |
return @foo if defined?(@foo) | |
raise AttributeError | |
end | |
foo | |
@foo = :foo |
OlderNewer