Skip to content

Instantly share code, notes, and snippets.

@espdev
espdev / megafon_calls_info.py
Last active January 31, 2016 11:51
The outgoing calls information for the "Megafon" mobile operator
# coding=utf-8
"""
The outgoing calls information for the "Megafon" mobile operator
"""
import xml.etree.ElementTree as ElementTree
import re
@espdev
espdev / Default (Windows).sublime-keymap
Created March 23, 2016 14:38
SublimeText 3 user keymap
[
{ "keys": ["ctrl+shift+/"], "command": "toggle_setting", "args": {"setting": "word_wrap"} },
{ "keys": ["ctrl+alt+left"], "command": "jump_back" },
{ "keys": ["ctrl+alt+right"], "command": "jump_forward" }
]
@espdev
espdev / Preferences.sublime-settings
Created March 23, 2016 14:39
SublimeText 3 user settings
{
"always_show_minimap_viewport": true,
"close_windows_when_empty": false,
"color_scheme": "Packages/Theme - Afterglow/Afterglow.tmTheme",
"dictionary": "Packages/Language - Russian/ru_RU.dic",
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": true,
"fallback_encoding": "Cyrillic (Windows 1251)",
"font_face": "Consolas",
@espdev
espdev / rects_overlapping.py
Created May 27, 2016 07:42
Rects overlapping
"""
Rects overlapping
A rect representation:
rect = [x1, y1, x2, y2]
"""
def range_overlap(a_min, a_max, b_min, b_max):
return not ((a_min > b_max) or (a_max < b_min))
@espdev
espdev / deviceInfo.cu
Created June 1, 2016 10:13 — forked from stevendborrelli/deviceInfo.cu
Get Information about CUDA cards on your system. Compile with: nvcc deviceInfo.cu -o deviceInfo
#include <cuda.h>
#include <stdio.h>
void cudasafe(int error, char* message, char* file, int line) {
if (error != cudaSuccess) {
fprintf(stderr, "CUDA Error: %s : %i. In %s line %d\n", message, error, file, line);
exit(-1);
}
}
@espdev
espdev / mpe-fm.ipynb
Last active August 18, 2016 21:21
Minimal Path Extraction via Fast Marching Method
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@espdev
espdev / remove_close_points.py
Last active September 21, 2016 18:46
Removig points that are close to each other
"""
Прореживание облака 2D-точек по минимальному расстоянию между точками
Реализация "в лоб" с использованием KD-Tree
"""
import numpy as np
import scipy.spatial as spatial
@espdev
espdev / cudnn.txt
Created July 8, 2016 09:42
Install cuDNN 4.0
$ tar -zxvf cudnn-7.0-linux-x64-v4.0-prod.solitairetheme8
$ cd cuda
$ sudo cp include/cudnn.h /usr/local/include
$ sudo cp lib64/libcudnn.* /usr/local/lib
@espdev
espdev / slide.py
Last active October 26, 2017 10:33
Sliding window over data from the sequence
import itertools
def slide(seq, n=2):
"""Returns a sliding window (of width n) over data from the sequence
s -> (s0, s1, ..., s[n-1]), (s1, s2, ..., sn), ...
"""
it = iter(seq)
result = tuple(itertools.islice(it, n))
if len(result) == n:
@espdev
espdev / plot_rectangular_parallelepiped.py
Last active September 27, 2019 12:25
Draw rectangular parallelepiped using the opposite vertices (diagonal)
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import matplotlib.pyplot as plt
# x y z
a = (1, 1, 1) # p1
b = (2, 2, 2) # p2
x, y, z = 0, 1, 2