Skip to content

Instantly share code, notes, and snippets.

View yko's full-sized avatar

Yaroslav Korshak yko

  • Plaid
  • Amsterdam, The Netherlands
View GitHub Profile
my $alpha = 0.1;
my $omega = 10;
my $t1 = 50;
my @x;
for my $t (0..$t1) {
push @x, exp(-$alpha*$t)*sin($omega*$t);
}
plot(\@x);
#use strict;
sub Vacancy_Menu {
################################################################################
### Выборка из таблиц по заданным параметрам
my $data=$dbh->prepare("SELECT * FROM ${pref}_rubrika ORDER BY stepshift ASC");
$data->execute();
if ($my{'c'} eq ''){
@yko
yko / t.pl
Created October 20, 2011 07:59
#!/usr/bin/perl
use strict;
use warnings;
use Util::YKO::GetTag;
my $html = <<END;
<html>
<body>
@yko
yko / t.pl
Created October 18, 2011 15:50
#!/usr/bin/env perl
use strict;
use warnings;
my %hash;
# Fill %hash with 20 random values 0 - 99
for (1 .. 20) {
my $rand = int(rand(100));
$hash{$rand} = $rand;
#!/usr/bin/env perl
use strict;
use warnings;
use DBI;
use Test::More tests => 1;
use utf8;
use Encode;
my $options = {mysql_enable_utf8 => 1};
#!/usr/bin/env perl
use DBI;
use Test::More tests => 3;
use strict;
use warnings;
my $options = {mysql_auto_reconnect => 1};
my $dbh = DBI->connect("dbi:mysql:", undef, undef, $options);
@yko
yko / s
Created August 24, 2011 10:46
#!/usr/bin/env perl
# Get all modules who depends on provided
use v5.10;
use strict;
use warnings;
use LWP::UserAgent;
use JSON;
#!/usr/bin/env perl
use strict;
use warnings;
use POSIX ":sys_wait_h";
use LWP::UserAgent;
my $url = 'http://google.com';
my $ua = LWP::UserAgent->new;
@yko
yko / ua.pl
Created August 22, 2011 15:32
#!/usr/bin/env perl
use Mojo::UserAgent;
my $size = shift || 5;
my $ua = Mojo::UserAgent->new;
my $counter;
for (1..$size) {
@yko
yko / t.pl
Created August 22, 2011 15:18
#!/usr/bin/env perl
use AnyEvent::HTTP;
my $size = shift || 5;
my $counter;
for (1..$size) {
run("http://google.com");
}