Skip to content

Instantly share code, notes, and snippets.

View direvius's full-sized avatar

Alexey Lavrenuke direvius

  • Yandex
  • Moscow, Russia
View GitHub Profile
#!/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}
@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 / 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.
package main
import (
"crypto/tls"
"fmt"
"github.com/amahi/spdy"
"io"
"log"
"net/http"
_ "time"
$ go run ./fail.go
[SPDY DEBUG] 2015/10/13 19:38:39 Session server started
[SPDY DEBUG] 2015/10/13 19:38:39 Stream #1 flow manager started
[SPDY DEBUG] 2015/10/13 19:38:39 Sending SYN_STREAM:
Frame: SYN_STREAM, Stream #1, Flags: FIN
Headers:
:method: GET
:path: /doodles/nusrat-fateh-ali-khans-67th-birthday
:version: HTTP/1.1
:host: www.google.com:443
// reproduce amahi/spdy sending SYN_STREAM for stream#3 before stream#1
package main
import (
"crypto/tls"
"fmt"
"github.com/amahi/spdy"
"io"
"log"
# Скрипт предназначен для сравнения квантилей двух стрельб
# В результате его выполнения получаем график, по горизонтальной
# оси -- квантили первой стрельбы, по вертикальной -- на сколько
# (в процентах) от них отличаются соответствующие квантили второй
# стрельбы
# Загружаем данные из PHOUT:
data1 <- read.delim("./test1.phout", header=F)
data2 <- read.delim("./test2.phout", header=F)
(pprof) list HostClient.*do
Total: 6.13mins
ROUTINE ======================== github.com/valyala/fasthttp.(*HostClient).do in /home/direvius/.gvm/pkgsets/go1.5.2/global/src/github.com/valyala/fasthttp/client.go
200ms 1.60mins (flat, cum) 26.08% of Total
. . 795:func (c *HostClient) do(req *Request, resp *Response, newConn bool) (bool, error) {
. . 796: if req == nil {
. . 797: panic("BUG: req cannot be nil")
. . 798: }
. . 799:
20ms 140ms 800: atomic.StoreUint32(&c.lastUseTime, uint32(time.Now().Unix()-startTimeUnix))