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/perl | |
use strict; | |
use warnings; | |
use Benchmark; | |
my %h = map { $_ => $_ } 1 .. 10; | |
my %subs = ( |
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/perl | |
use strict; | |
use warnings; | |
use Carp; | |
use List::Util qw/first/; | |
use Benchmark; | |
sub benchmark { |
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/perl | |
use strict; | |
use warnings; | |
use Benchmark; | |
my $r; | |
my @a = qw/ aaa bbb aaa bbb aaa /; | |
my @b = qw/ fff fff fff fff fff /; |
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/perl | |
use strict; | |
use warnings; | |
sub bsearch { | |
my $item = shift; | |
my @a = @_; | |
my $offset = 0; |
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 | |
SCP=/usr/bin/scp | |
declare -a hosts=( | |
host1 | |
host2 | |
host3 | |
) |
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/perl | |
use strict; | |
use warnings; | |
my $filename = shift; | |
if (my ($target, $path) = $filename =~ /((?:[^@]+@)?[^:]+):(.*)/) { | |
open my $fh, "-|", "ssh", $target, "cat", $path or die "$!"; | |
while (<$fh>) { |
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/perl | |
use strict; | |
use warnings; | |
@ARGV = map { | |
/((?:[^@]+@)?[^:]+):(.*)/ ? "ssh $1 cat $2 |" : $_ | |
} @ARGV; | |
while (<>) { |
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
use strict; | |
use warnings; | |
use Benchmark; | |
my $s = "aaaa 192.168.0.1 sdf"; | |
my %subs = ( | |
norm => sub { | |
return scalar $s =~ /(a)(a)(a)(a)/; |
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
### Keybase proof | |
I hereby claim: | |
* I am cowens on github. | |
* I am cowens (https://keybase.io/cowens) on keybase. | |
* I have a public key whose fingerprint is 55A3 0C7F 506A F8C1 667B 94B9 E39B D92B 39CB 08BA | |
To claim this, I am signing this object: |
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
mkdir ram | |
sudo mount -t tmpfs -osize=4k tmpfs ram | |
perl -le 'open $f, ">", "ram/f"; $i = 0; while (print $f "x") { $i++ }; print "ran out of room after $i bytes"' |