Skip to content

Instantly share code, notes, and snippets.

View realdecisions's full-sized avatar
🏠
Working from home

Evgeniy Vansevich realdecisions

🏠
Working from home
View GitHub Profile
@realdecisions
realdecisions / README
Last active August 29, 2015 14:11 — forked from brutuscat/README
0 - Read http://blog.databigbang.com/running-your-own-anonymous-rotating-proxies/
1 - Install monit, haproxy, tor and delegated.
2 - Setup your environment in the setup.rb file
3 - Just run > ruby setup.rb
4 - ...........
5 - PROFIT! > http://www.southparkstudios.com/clips/151040/the-underpants-business
#!/usr/bin/env perl
use FindBin;use lib "$FindBin::Bin/../blib/lib";
use AnyEvent::HTTP::Server;
use EV;
use Cache::Memcached::Fast;
use JSON::XS;
use Data::Dumper;
my $_JSON = JSON::XS->new->utf8;
use Plack::Builder;
use Plack::Request;
use Cache::Memcached::Fast;
use JSON::XS;
my $_JSON = JSON::XS->new->utf8;
my $mem = Cache::Memcached::Fast->new({servers=>[qw/127.0.0.1:11211/]});
$mem->set('counter:1',0);
$mem->disconnect_all;
builder {
@realdecisions
realdecisions / gist:87b1e77a3a4f85bf5cc5
Created September 25, 2015 15:51
Perl uniq array
#!perl
use Benchmark qw/cmpthese/;
use strict;
my @array = ( 'a', 'a', 'a', 'b', 'c', 'd', 'e', 'g', 'e', 'e', 'g', 'c' );
sub uniq_v1 {
my %tmp;
my @new_array = grep {
@realdecisions
realdecisions / ImportMe.pm
Created December 29, 2015 19:04
Mouse import.
package ImportMe;
use Mouse;
my @imports;
sub import{
my $class = shift;
my %args = @_;
my $cb = sub {
my $self = shift;
@realdecisions
realdecisions / global_hook.pm
Last active January 26, 2016 21:26
Perl implementation of hooks for fork aka AFTER_FORK.
package fork::global_hook;
use strict;
use B;
use Devel::Gladiator;
use constant {
BLESSED => 0x00100000
};
package fork::child_cb;
use strict;
my @CHILD_CB;
BEGIN {
*CORE::GLOBAL::fork = sub() {
my $ret = CORE::fork;
if ( defined($ret) && $ret == 0 ) {
@realdecisions
realdecisions / global_hook.pm
Last active May 13, 2016 15:55
fork::global_hook => Inline::С impl.
package fork::global_hook;
use strict;
use Inline C => <<EOF;
void find_and_call(){
SV* sva;
GV* method;
HV* stash;
char* name;
uint cnt = 0;
#!perl
my $lol = bless { string => "test_string" };
$lol->{cycle}{reference}[0] = $lol;
my $lol1 = bless [];
$lol1->[0]{yet}{another}{cycle}{reference} = $lol1;
use strict;
require Devel::Gladiator;
@realdecisions
realdecisions / MultiChannel.pm
Created September 23, 2016 10:09
Coro::Channel multiplexer
package Coro::MultiChannel;
#perl Coro::Channel multiplexer
use Coro;
use parent qw/Coro::Channel/;
sub CORO(){3}
sub new {
bless $_[0]->SUPER::new($_[1]);