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
$handle = sub { | |
my $ref = shift; | |
my $sender = $ref->{'user'}->{'id'}; | |
my $sender = $ref->{'user'}->{'screen_name'}; | |
my $text = &descape($ref->{'text'}); | |
`echo "$sender $text" | /home/pblair/bin/twitter-notify >/dev/null 2>&1`; | |
print &standardtweet( $ref ); | |
return 1; | |
}; |
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
#!/bin/bash | |
read line | |
SENDER=$(echo $line | awk '{print $1}') | |
if [ ! -f "/tmp/twit-profile/${SENDER}.jpg" ]; then | |
URL="http://twitter.com/users/${SENDER}.xml" | |
PROFILE_URL=$(wget -O - $URL 2>/dev/null | grep profile_image_url | perl -lane 'print $1 if /profile_image_url\>(\S+?)\<\/profile_image_url/' -) | |
echo "Profile url: $PROFILE_URL" |
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
#!/usr/bin/perl | |
use strict; | |
use Gearman::Worker; | |
use HTTP::Request; | |
use HTTP::Response; | |
use LWP::UserAgent; | |
use Data::Dumper; |
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
#!/usr/bin/perl | |
use Gearman::Client; | |
use Data::Dumper; | |
my $client = Gearman::Client->new; | |
$client->job_servers( '127.0.0.1' ); | |
my $taskset = $client->new_task_set; |
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
#!/usr/bin/perl -w | |
use strict; | |
use Date::Parse; | |
use Getopt::Long; | |
my $goback = "15m"; | |
my $initial = undef; | |
# Options | |
my ( $reverse, $length, $searchterm, $help ) = ( 0, $goback, '.*', 0 ); |
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
#!/usr/bin/perl | |
use strict; | |
use lib ( "." ); | |
use Policy::Memcache; | |
use Data::Dumper; | |
my $mc = Policy::Memcache->new; | |
my $ip = shift; | |
my $cmd = shift || 'get'; | |
chomp( $ip ); |
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
" Strip down to just the IP address in the highlighted region | |
function! ExtractIP() | |
'<,'>perldo $_ = $1 if /((?:\d+\.){3}\d+)/; | |
endfun | |
vmap :call ExtractIP() | |
function! SortUniq() | |
'<,'>sort | |
'<,'>g/^\(.*\)$\n\1$/d | |
endfun |
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
#!/usr/bin/perl | |
use strict; | |
use IO::Socket; | |
use Term::ANSIColor; | |
sub get_file( $ ){ | |
my ($filename) = @_; | |
open FD, "<$filename" || die( "Cannot open $filename: $!\n" ); | |
my $text = do { local $/; <FD>; }; |
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
// Compile with: $ g++ epoll.cc -o epoll1 -lboost_thread | |
#include <iostream> | |
#include <netinet/in.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/epoll.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <unistd.h> |
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
[prod.b]pblair@b009:/mail/log/log01/smtprelay/20110518$ cat ~/stats.pl | |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use lib("/home/pblair/lib"); | |
use Statistics::Descriptive; | |
my $stat = Statistics::Descriptive::Full->new(); |