Skip to content

Instantly share code, notes, and snippets.

twitter_api_method users_lookup => (
description => 'Fetches user informations, given a list of comma-separated user_ids',
path => 'users/lookup',
method => 'GET',
params => [qw/user_id cached cache/],
required => [qw/user_id/],
returns => 'HashRef',
authenticate => 1
);
per ogni token dallo stream:
se il token è l'apertura di un tag, e il tag appartiene
all'insieme di quelli nei quali vuoi fare l'escape:
sono_dentro_ai_tag_incriminati = 1
stampo il token così com'è
se il token e` un pezzo di testo:
se sono_dentro_ai_tag_incriminati == 1
escape
stampo il risultato
import Data.Map as Map
type Inventory = [String]
data Direction = North
| South
| East
| West
| Up
| Down
sub parse_log_line {
my $log_line = shift;
my $monthname_numbers = {
Jan => "01", Feb => "02", Mar => "03", Apr => "04",
May => "05", Jun => "06", Jul => "07", Aug => "08",
Sep => "09", Oct => "10", Nov => "11", Dec => "12"
};
if ($log_line =~ /^(.*?) - - \[(.*)\] "(.*)" (\d+) \d+ "(.*)" "(.*)" hostname ".*?"/) {
use strict;
use warnings;
use feature qw/ say /;
my $timeout = 10; # seconds
my $maxlines = 10;
eval {
local $SIG{ ALRM } = sub {
#!/usr/bin/perl
use strict;
use warnings;
use feature qw/ say /;
use File::Tail;
my $filename = "test.txt";
my $maxlines = 10;
use strict;
use warnings;
use feature qw/ say /;
use constant MXM_HM_GROUP => 9604;
use Net::Hiveminder;
use DateTime;
my $next_week = DateTime->now->add( days => 7 );
use strict;
use warnings;
use feature qw/ say /;
use constant MXM_HM_GROUP => 9604;
use Net::Hiveminder;
use DateTime;
@larsen
larsen / gist:2336390
Created April 8, 2012 10:06
Excerpt from Cassandra's service description in Thrift
struct Column {
1: required binary name,
2: optional binary value,
3: optional i64 timestamp,
4: optional i32 ttl,
}
...
service Cassandra {
@larsen
larsen / gist:2336401
Created April 8, 2012 10:11
Thrift generated Perl code
package Cassandra::Column;
use base qw(Class::Accessor);
Cassandra::Column->mk_accessors( qw( name value timestamp ttl ) );