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 Mojo::JSON; | |
use Mojo::UserAgent; | |
has json => sub { Mojo::JSON->new }; | |
has ua => sub { Mojo::UserAgent->new }; | |
use constant DEBUG => $ENV{APPFOLLOW_ANALYTICS_DEBUG} || 1; | |
has is_debug => DEBUG; |
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
# all apps in html | |
$ mojo get "https://play.google.com/store/apps/developer?id=Яндекс&hl=ru" "a[class=title]" | |
# all apps title | |
$ mojo get "https://play.google.com/store/apps/developer?id=Яндекс&hl=ru" "a[class=title]" text | |
# all apps link | |
$ mojo get "https://play.google.com/store/apps/developer?id=Яндекс&hl=ru" "a[class=title]" attr href |
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 v5.12; | |
use List::Util 'sum'; | |
my $data = [ | |
map { | |
chomp; | |
my $res; @$res{qw(impr clicks ctr cost)} = grep { s/\s+//sg; s/,/./sg; s/%//sg; 1 } split /\t/; $res; | |
} | |
<DATA> | |
]; |
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
# ids | |
my @ids = $self->req->param('id'); | |
if (!@ids and my $ids = $self->req->param('ids')) { | |
@ids = $ids =~ /(\d+)/g; | |
} |
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 common::sense; | |
use lib qw(/tk/lib /tk/mojo/lib); | |
$ENV{MOJO_APP} ||= 'Proxy'; | |
use Mojo::Commands; Mojo::Commands->start; | |
package Proxy; | |
use common::sense; |
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 v5.12; | |
my $limit = 500; | |
my $re = qr{ dt=(\d{3,}) }x; | |
my $re2 = qr{\? p=([^&]+) & h=([^&]+) }x; | |
for (1..3_000_000) { | |
my $line = q(127.0.0.1 - - [15/May/2013:21:35:24 +0000] "GET /hc/cdn-bench.gif?p=http&h=host.example.org&dt=235 HTTP/1.1" 200 43 "http://example.org/blah/?q=Kiev&sort=price.asc&utm_source=yandex&utm_medium=cpc&utm_campaign=s_gen_city_cis_ua_kiev_1565_alldevices_georus&from=earch.no&_openstat=zzz" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1106.241 YaBrowser/1.5.1106.241 Safari/537.4" "0.002" "ostrovok.ru" "1368653724.588" "lucky:92" us:1.1.1.1:80 us_t:0.001); |
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 v5.12; | |
my $line = q(127.0.0.1 - - [15/May/2013:21:35:24 +0000] "GET /hc/cdn-bench.gif?p=http&h=host.example.org&dt=235 HTTP/1.1" 200 43 "http://example.org/blah/?q=Kiev&sort=price.asc&utm_source=yandex&utm_medium=cpc&utm_campaign=s_gen_city_cis_ua_kiev_1565_alldevices_georus&from=earch.no&_openstat=zzz" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1106.241 YaBrowser/1.5.1106.241 Safari/537.4" "0.002" "ostrovok.ru" "1368653724.588" "lucky:92" us:1.1.1.1:80 us_t:0.001); | |
my $re = qr{\? p=([^&]+) & h=([^&]+) & dt=(\d+) }x; | |
for (1..3_000_000) { | |
my @r = $line =~ /$re/; | |
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 v5.12; | |
use Encode; | |
use Text::CSV; | |
use Data::Dumper; | |
my $dir = '/Users/sharifulin/Downloads/refb814'; | |
while (<$dir/*.csv>) { |
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 | |
LOGFILE=basisjs.log | |
( | |
echo -n; echo '---'; echo `date` | |
time mojo get http://basisjs.com title text | |
) 1>> $LOGFILE 2>> $LOGFILE |
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 v5.12; | |
use ojo; | |
say g( | |
'http://ostrovok.ru', | |
{'User-Agent' => 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)'} | |
) | |
->dom | |
->at('a.mobile-banner')->{href} | |
; |
NewerOlder