Skip to content

Instantly share code, notes, and snippets.

View olegwtf's full-sized avatar

Oleg olegwtf

  • reg.ru
  • Russia, Novosibirsk
View GitHub Profile
@olegwtf
olegwtf / gist:1188372
Created September 2, 2011 10:54
test firebird + qt
#include <QDebug>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QString>
#include <QSqlError>
#include <QVariant>
int main()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");
@olegwtf
olegwtf / gist:1199818
Created September 7, 2011 05:18
missing right curly or square bracket
use autodie;
use Fcntl qw(SEEK_SET);
use strict;
use warnings;
my ($in1, $in2, $ot) = @ARGV;
die "usage: $0 input1 input2 output"
unless defined $in1 && defined $in2 && defined $ot;
open IN1, '<:urf8', $in1;
@olegwtf
olegwtf / gist:1369465
Created November 16, 2011 06:49
Export variable from the class
<?php
class Ax {
public $super;
function __construct() {
$this->super = "super";
$GLOBALS['super'] = &$this->super;
}
@olegwtf
olegwtf / xlslib-example.cpp
Created November 20, 2011 15:53
Creating xls with xlslib
#include <xlslib.h>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <ctime>
using namespace xlslib_core;
using namespace std;
@olegwtf
olegwtf / coro-lwp-issue.pl
Created November 22, 2011 16:28
Coro::LWP issue
BEGIN {
$ENV{PERL_ANYEVENT_MAX_OUTSTANDING_DNS} = 30;
}
use strict;
use Coro::LWP;
use Coro;
use LWP;
my @coros;
for (1..30) {
@olegwtf
olegwtf / pchange.pl
Created December 6, 2011 15:21
I:S:S:W runtime proxy changing test
BEGIN {
$ENV{SOCKS_DEBUG} = 1;
}
use IO::Socket::Socks::Wrapper (
Net::FTP => {
ProxyAddr => 'localhost',
ProxyPort => 1080,
SocksVersion => 5
},
Net::FTP::dataconn => {
@olegwtf
olegwtf / lambda-http.pl
Created January 12, 2012 17:37
IO::Lambda::HTTP
use strict;
use URI;
use HTTP::Request;
use IO::Lambda qw(:all);
use IO::Lambda::HTTP qw(http_request);
sub request($) {
my $url = URI->new($_[0]);
my $req = HTTP::Request->new(GET => $url, [Host => $url->host]);
$req->protocol('HTTP/1.1');
@olegwtf
olegwtf / a-g-p-warns.pl
Created January 24, 2012 01:43
Any Warnings?
use strict;
use warnings;
use AnyEvent::Google::PageRank 'rank_get';
my $cv = AE::cv;
rank_get 'http://www.google.ru', sub {
print shift, "\n";
$cv->send;
};
$cv->recv;
@olegwtf
olegwtf / won.pl
Created January 24, 2012 12:21
works or not
use Data::Dumper;
use strict;
$a = ['google.ru', on_prepare => sub {}, timeout => 10, sub{}];
print Dumper _extract_known_params($a);
print Dumper ($a), "-------\n";
$a = ['google.ru', timeout => 10, on_prepare => sub {}, sub{}];
print Dumper _extract_known_params($a);
print Dumper ($a), "-------\n";
@olegwtf
olegwtf / private-or-no.cpp
Created January 26, 2012 17:34
Encapsulation
#include <iostream>
class Ax {
public:
Ax(int a);
bool compare(const Ax &other);
private:
int m_a;
};