Skip to content

Instantly share code, notes, and snippets.

View evilkost's full-sized avatar

Valentin Gologuzov evilkost

  • Czech Republic, Prague
View GitHub Profile
# require pandas 0.13+
import pandas as pd
def read_one(prefix, filename, alg):
return pd.read_csv(prefix + "Mona_Lisa.bmp.LS.csv", sep="\t", index_col=0, header=None, names=['Evals', 'Error'])
##### CSV format:
# separator: \t
# no header
from celery.contrib import rdb; rdb.set_trace()
from tornado.ioloop import IOLoop
class CallbackDispatcher(object):
def __init__(self, generator):
self.ioloop = IOLoop.instance()
self.g = generator
try:
self.call(self.g.next())
except StopIteration:
pass
import brukva
c = brukva.Client()
c.connect()
#c.select(9)
p = c.pipeline()
p.set('foo', 'bar')
p.get('foo')
def main_g(inp_iter, c):
while True:
count = [0,]
def inner_g():
while count[0] < c:
yield inp_iter.next()
count[0] += 1
else:
count[0] = 0
raise StopIteration()

Enable module:

vim /var/lib/pgsql/data/postgresql.conf

add at the end:

shared_preload_libraries = 'pg_stat_statements'
# Increase the max size of the query strings Postgres records
track_activity_query_size = 2048
docker images -q --filter "dangling=true" | xargs docker rmi
touch -h -d '-100 day' --time=mtime /etc/mock/*
class RedisLogHandler(Process):
"""
Single point to collect logs through redis pub/sub and write
them through standard python logging lib
"""
def __init__(self, opts):
Process.__init__(self, name="log_handler")
PGPASSWORD=coprpass psql -a -h localhost -U copr-fe coprdb -c "\copy (select api_login, api_token from public.user where username='kost2') to '/tmp/credentionals.csv' with csv "