Skip to content

Instantly share code, notes, and snippets.

View libbkmz's full-sized avatar

Ilya libbkmz

View GitHub Profile
%%cython -a -f -c=-O3
# -c=-DCYTHON_TRACE=1
# -c=-std=c++11
# -c=-DCYTHON_TRACE=1
# -c=-DCYTHON_TRACE=1 -c=-g --link-args=-g
# %%cython -a -c=-DCYTHON_TRACE=1
# -c=-O3
# -c=-g --link-args=-g
# --cplus
#-c=-march=native -c=-mtune=native
quantile_list_big = [(1. - 0.1 ** x) + (0.1 ** (x + 1)) * y for x in xrange(1, 8+1) for y in xrange(1, 10)]
quantile_list_small = [(1. - 0.1 ** x) for x in xrange(1, 8+1)]
@libbkmz
libbkmz / CustomSurfView.java
Last active May 27, 2018 19:56
SurfaceView lockCanvas is very slow
package com.example.bkmz.surface_view_test;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
public class CustomSurfView extends SurfaceView implements SurfaceHolder.Callback {
@libbkmz
libbkmz / .inputrc
Last active July 27, 2018 15:28
Enable neat and tidy bash history usage
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward
# -*- coding: utf-8 -*-
"""
Demonstrates very basic use of ImageItem to display image data inside a ViewBox.
"""
## Add path to library (just for examples; you do not need this)
# import initExample
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
import numpy as np
import matplotlib.pyplot as plt
IMG_URL = "/tmp/img_res.jpg"
CM = plt.cm.gist_gray
def rgb2gray(img):
# массив весов для конвертации в grayscale, RGB
# W = np.array([0.2126, 0.7152, 0.0722])
W = np.array([0.299, 0.587, 0.114])
# W = np.array([0.333, 0.333, 0.333])
#!/usr/bin/python2
import sys
import os
WRAPPER = "/usr/bin/java"
args = sys.argv[1:]
args.insert(0, WRAPPER)
for i, arg in enumerate(args):
if arg.startswith("-Xmx"):
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib as mpl
# set tick width
mpl.rcParams['xtick.major.size'] = 10
mpl.rcParams['xtick.major.width'] = 4
mpl.rcParams['xtick.minor.size'] = 5
# -*- codin: utf-8 -*-
import fileinput
import re
tb_list = []
current_tb = ""
previous_tb = ""
new_line = ""
keys = {}
# -*- coding: utf-8 -*-
from copy import copy, deepcopy
from trie import Trie
from itertools import chain
STATE = [
u"", u"", u"т", u"", u"ч",
u"", u"м", u"а", u"е", u"у",
u"м", u"о", u"л", u"о", u"т",