Skip to content

Instantly share code, notes, and snippets.

View elephantum's full-sized avatar

Andrey Tatarinov elephantum

View GitHub Profile
import numpy as np
# make memmap file and fill it with some random data
# create a memmap file
fp = np.memmap('data.memmap', dtype='float32', mode='w+', shape=(100000, 40000))
for chunk in range(100):
# fill the memmap file with some random data
fp[chunk*1000:(chunk+1)*1000] = np.random.rand(1000, 40000)
function GdDocument(name) {
this.name = name;
this.sources = [];
}
function GdProcess(inputs, outputs) {
this.inputs = inputs;
this.outputs = outputs;
for (var i in this.outputs) {
@elephantum
elephantum / .env
Last active January 26, 2021 07:56
Dask data loss with `.set_index`
#VERSION=2020.12.0
VERSION=2021.1.1
res <- data.frame(session=NA, dt=NA)
for(event_str in unique(summary$event)) {
event_name <- gsub(pattern=' ', replacement='.', x=event_str, )
tmp <- summary[ summary$event == event_str, c('session', 'dt', 'count')]
names(tmp)[3] <- event_name
res <- merge(x=res, y=tmp, by=c('session', 'dt'), all=TRUE)
}
def prepare_data(data):
data['service'] = None
data['service'][data['upstream_addr'] == '-'] = 'static'
data['service'][data['upstream_addr'] == '127.0.0.1:4091'] = 'backend'
data['service'][data['upstream_addr'] == '127.0.0.1:4092'] = 'screenshot'
data['service'][data['upstream_addr'] == '127.0.0.1:9000'] = 'frontend'
data['request_time_xx'] = '-'
data['request_time_xx'][data['request_time'].between(0, 0.5)] = '0-500ms'
data['request_time_xx'][data['request_time'].between(0.5, 1)] = '500ms-1s'
import sys
import csv
r = csv.reader(sys.stdin)
data = list(r)
for line in data[1:]: line[-1] += '\n\n http://jira.ent3.ru/issues/%s' % (line[0],)
w = csv.writer(sys.stdout)
w.writerows(data)
public class EastActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText username = (EditText)findViewById(R.id.clientid);
final EditText password = (EditText)findViewById(R.id.passwordid);
final Button button = (Button)findViewById(R.id.ok);
final TextView txtResult = (TextView)findViewById(R.id.content);

Inspired by http://clubs.ya.ru/podpiski/replies.xml?item_no=2

Список постов

get_posts({group_id,md5,url,tag_id}, nav, items_per_page, read_status)

Из group_id, md5, url, tag_id должен быть указан только один. Параметры nav, items_per_page, read_status - необязательные

Содержимое поста

a = '1.2.3'
b = '1.3.4'
def cmp(a, b):
for (i,j) in zip(a.split('.'), b.split('.')):
if int(i) < int(j):
return False
elif int(i) > int(j):
return True
import time
import tornado.ioloop
import tornado.httpclient
import logging
logging.basicConfig(level=logging.DEBUG)
io_loop = tornado.ioloop.IOLoop.instance()
interrupts_count = 0