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
# first way: in pre-processing | |
# before calling «parse_line($_)» from the «while» loop | |
if (/\.irpc\s+([\d\w.]+)\s*(.*)/) { | |
my ($id,$vals)=($1,$2); | |
my @vals = split //,$vals; | |
$_ = ".irp $id @vals"; | |
} | |
# second way: in «parse_line» |
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
#!/bin/bash | |
CONF=/etc/spamdyke/spamdyke.conf | |
graylist_dir=$(grep graylist-dir "$CONF");graylist_dir=${graylist_dir##*=} | |
graylist_max_secs=$(grep graylist-max-secs "$CONF");graylist_max_secs=${graylist_max_secs##*=} | |
find ${graylist_dir} -type f -mmin +$[ ${graylist_max_secs} / 60 ] -print0 | xargs -0 rm -f |
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
*.sw? |
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
#!/bin/bash | |
# this is *complicated* | |
# | |
# we want to be able to set an array to the value of another | |
# array. this is harder than it should be | |
# | |
# The call: | |
# _set_array foo 1 "2 3" "4 5 6" | |
# should execute: |
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 perl | |
use strict; | |
use warnings; | |
use 5.018; | |
package App { | |
use Moose; | |
has model1 => ( is => 'ro', isa => 'Model1', ); | |
has model2 => ( is => 'ro', isa => 'Model2', ); |
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
#!perl | |
use strict; | |
use warnings; | |
package ForceSessionSave { | |
use parent 'Plack::Middleware'; | |
sub call { | |
my ($self,$env) = @_; | |
my $res = $self->app->($env); |
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 perl | |
use strict; | |
use warnings; | |
use 5.020; | |
use autodie; | |
use Try::Tiny; | |
use File::Find::Rule; | |
use File::stat; | |
use Digest::MD5; |
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 perl | |
use strict; | |
use warnings; | |
use 5.018; | |
use open ':std',':locale'; | |
use LWP::Simple; | |
use URI::_punycode; | |
my $root_zone = get('https://www.internic.net/domain/root.zone'); | |
my @root_records = split /\n/,$root_zone; |
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 perl | |
use strict; | |
use warnings; | |
use Benchmark; | |
use List::Util; | |
my @keys = List::Util::shuffle( (1..500) x 1000, 600..800 ); | |
Benchmark::cmpthese(-5, { | |
with_test => 'my %h; for my $k (@keys) { $h{$k}=1 unless exists $h{$k} }', |
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
package PerlIO::via::Trace; | |
use strict; | |
use warnings; | |
use Fcntl; | |
use Devel::StackTrace; | |
my $log_fh; | |
sub _trace { | |
my $fh = shift; | |
local $@;local $!; |
OlderNewer