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 common::sense; | |
use Net::DNS::DynDNS; | |
use LWP::Simple qw/get/; | |
my $file_ip = "result.dat"; | |
my $user = "user"; | |
my $passw = "paswword"; | |
my $domain = "domain.dyndns.org"; |
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
---------------------------------------------------------- | |
== Twiggy == | |
app.psgi: | |
my $app = sub { | |
return [ 200, ['Content-Type' => 'text/plain'], [ "Hello world\n"] ]; | |
}; | |
[sugar@host dir]$ twiggy --listen 127.0.0.1:8080 app.psgi |
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
for I in `perl -le 'print for @INC'`; do RES=`ls -l $I | grep AnyEvent`; if [[ $RES ]]; then echo $I; echo $RES; fi; done |
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; | |
local $, = " "; | |
my $registry = {1 => 1, 2 => 1, 3 => 1}; | |
my $num = [2,5]; | |
say "first" if @$registry{@$num}; | |
my $num = [5,2]; |
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 -le '$r = "Mojolicious"; for (@INC) {opendir $dh, $_; if (@a = grep {/$r/} readdir $dh) {print $_.":"; print for @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
sub format_time { | |
my $time = shift; | |
use integer; | |
my $formatted; | |
for my $unit (["д", 60*60*24], ["ч", 60*60], ["м", 60], ["с", 1]) { | |
my $res = $time / $unit->[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
#!/usr/bin/env perl | |
use common::sense; | |
use YAML::Tiny; | |
use Data::Dumper; | |
my $conf = YAML::Tiny->read("config.yml")->[0]; | |
my $template = 'alias ssh_<name>=\'expect -c "spawn ssh <user>@<host>;' . | |
'expect password: {send <passw>\r}; interact"\''; |
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 python | |
def get_primes7(n): | |
if n < 2: return [] | |
if n == 2: return [2] | |
# do only odd numbers starting at 3 | |
s = [] | |
for t in range(1, n/2): | |
s.append(t*2 + 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
# use integer; | |
sub get_primes7 { | |
my $n = shift; | |
if ($n < 2) { return (); } |
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
/** | |
* jQuery.fn.sortElements | |
* -------------- | |
* @author James Padolsey (http://james.padolsey.com) | |
* @version 0.11 | |
* @updated 18-MAR-2010 | |
* -------------- | |
* @param Function comparator: | |
* Exactly the same behaviour as [1,2,3].sort(comparator) | |
* |
OlderNewer