Skip to content

Instantly share code, notes, and snippets.

View direvius's full-sized avatar

Alexey Lavrenuke direvius

  • Yandex
  • Moscow, Russia
View GitHub Profile
@direvius
direvius / percentile.rb
Created August 20, 2012 15:05
percentile
#!/usr/bin/env ruby
def parse_line line
fields = line.split
return fields[1], fields[3]
end
def percentile(level, values)
return values.sort[values.length*level/100]
end
@direvius
direvius / light_post.pl
Created October 13, 2012 10:56
Post ammo generation for Yandex.Tank
#!/usr/bin/perl
my $data ="DATA_IN_POST";
my $req= "POST /updateShopStatus? HTTP/1.0\r\n".
"User-Agent: yandex-tank/1.1.1\r\n".
"Host: example.com\r\n".
"Content-Length:".length ($data)."\r\n".
"Connection: Close\r\n".
"\r\n".
$data."\r\n".
"\r\n";
@direvius
direvius / gen_ammo.rb
Created October 13, 2012 20:53
Generate ammo for Yandex.tank
#!/usr/bin/env ruby
# simple GET ammo generation, pass hostname as a first parameter and uris to STDIN
STDIN.each{|line|
request = <<-EOS
GET #{line.chomp} HTTP/1.0\r
Host: #{ARGV[0]}\r
Accept: */*\r
User-Agent: tank\r
Connection: close\r
@direvius
direvius / gist:3891992
Created October 15, 2012 11:16
This is a small sound example for the IBM PC
; This is a small sound example for the IBM PC
; It will play 12 notes of the octave starting at middle C.
;-----------------------------------------------------------------------------
; How to generate sound on the IBM PC :
;
; The 8255 (port 61H) bit 0 controls the 8253 timer
; bit 1 controls the speaker
;
; The output channel 2 from the 8253 timer will be ANDed with the
; speaker control bit in order to turn on/off the speaker.
# Скрипт предназначен для сравнения квантилей двух стрельб
# В результате его выполнения получаем график, по горизонтальной
# оси -- квантили первой стрельбы, по вертикальной -- на сколько
# (в процентах) от них отличаются соответствующие квантили второй
# стрельбы
# Загружаем данные из PHOUT:
data1 <- read.delim("./test1.phout", header=F)
data2 <- read.delim("./test2.phout", header=F)
@direvius
direvius / shooter.py
Created September 17, 2013 11:20
An example of a thrift shooter for yandex.tank
from Tank.Plugins.bfg import Sample
import logging
import time
import json
from MyService.Service import Service
import MyService.Service.ttypes as tt
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.protocol import TBinaryProtocol
direvius@direvius-ub:~/learn/leveldb$ ls
build node_modules program.coffee program.js
direvius@direvius-ub:~/learn/leveldb$ rm -rf ./node_modules/
direvius@direvius-ub:~/learn/leveldb$ npm install leveldown
npm http GET https://registry.npmjs.org/leveldown
npm http 304 https://registry.npmjs.org/leveldown
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/nan
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from xmlrpc.client import Fault
from xmlrpc.client import ServerProxy
from xmlrpc.client import Transport
import urllib.request as urllib2
import xml.etree.ElementTree as ET
class MyTransport(Transport):
#!/usr/bin/env python
import base64
import pickle
import urllib
import sys
class Stpd(object):
'''
@direvius
direvius / ammo.txt
Last active August 29, 2015 13:59 — forked from nordicdyno/ammo.txt
{"channel": "webpush_A", "subscribe": true, "pushes": 5, "ttl": 75}