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 / my.cnf
Created May 13, 2012 14:42
replication master-master config
# master1
# SQL: grant replication slave on *.* to 'replication'@10.0.0.2 identified by 'replica_secret'
log_bin = /var/log/mysql/mysql-bin.log
binlog-do-db = dbrepl
server-id = 1
master-host = 10.0.0.2
master-user = replication
master-password = replica_secret
@olegwtf
olegwtf / group.sql
Created May 25, 2012 09:28
Select (group by)
select collection.uid, orgs.name,
group_concat(ifnull(attributes.name,"") separator "\0"),
group_concat(ifnull(collection.value,"") separator "\0"),
group_concat(ifnull(variants.value,"") separator "\0")
from collection
left join orgs on orgs.uid=collection.uid
left join variants on collection.variant=variants.id
left join attributes on collection.attr_id=attributes.id
where orgs.proj_id = ?
group by collection.uid
@olegwtf
olegwtf / sp-auth.cs
Created May 26, 2012 07:43
Microsoft Sharepoint Authentication
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ClientContext clientContext = new ClientContext("http://sitename");
CredentialCache cc = new CredentialCache();
cc.Add(new Uri("http://sitename"), "NTLM", new NetworkCredential("User", "Password"));
clientContext.Credentials = cc;
apt-get install googleearth-package
make-googleearth-package
apt-get install googleearth-package
make-googleearth-package
dpkg -i googleearth_6.0.3.2197+0.7.0-1_amd64.deb
@olegwtf
olegwtf / gist:3551687
Created August 31, 2012 11:29
The only real random cowsay
while true; do fortune | cowsay -f $(ls -d1 /usr/share/cowsay/cows/* | shuf | head -n1) "$([ $[$RANDOM%10] == 0 ] || echo "-"$(echo -e "b\nd\ng\np\ns\nt\nw\ny"|shuf|tail -n1))" && sleep 3; done
@olegwtf
olegwtf / gist:4225622
Last active October 13, 2015 16:47
Стихи
***Про тяготы переполнения однобайтовых переменных***
Олег работал над программою весь день
На C++ писал он эту поебень
Но позабыл напутствие олдфагов
Про signed char переполненья багу
Уволен был Олег 128 дней спустя
ГЛОНАССа спутник та программа в море увела
@olegwtf
olegwtf / gist:4259527
Created December 11, 2012 15:51 — forked from sharifulin/gist:335531
Nested layouts for the Mojolicious
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => 'index';
get '/ok' => 'index_ok';
use Test::More;
plan tests => 6;
use strict;
use QtCore4;
use QtGui4;
package Ui_MainWindow;
use strict;
use warnings;
use QtCore4;
use QtGui4;
@olegwtf
olegwtf / gist:7464791
Last active December 28, 2015 07:29
Mojolicious & IO::Async
use strict;
use v5.10;
BEGIN {
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
$ENV{MOJO_IOLOOP_DEBUG} = 1;
}
use Mojo::IOLoop;
use Mojo::UserAgent;
use Net::Async::HTTP;
use URI;