Skip to content

Instantly share code, notes, and snippets.

View zakhar's full-sized avatar

Zakhar Zibarov zakhar

  • Yandex
  • Saint-Petersberg, Russia
View GitHub Profile
sudo pvcreate /dev/sdc
vgextend vg0 /dev/sdc
lvcreate -n lv_cache --type cache-pool -l 100%FREE vg0 /dev/sdc
lvconvert --type cache --cachemode writeback --cachepool vg0/lv_cache vg0/lv_root
https://znoxx.me/2017/01/04/lvm-cache-na-ssd/
https://www.it-world24.ru/software/lvm-cache-prozrachnoe-keshirovanie-hdd-ispolzuya-ssd.html
# switch off cache
lvconvert --splitcache vg0/lv_root
@zakhar
zakhar / rolling_window.py
Created November 9, 2015 16:14
numpy rolling window
# from http://stackoverflow.com/a/6811241
def rolling_window(a, window):
shape = a.shape[:-1] + (a.shape[-1] - window + 1, window)
strides = a.strides + (a.strides[-1],)
return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from itertools import chain
AGGREGATES_DEPENDENCIES = {
"revenuePerUser": ["sumRevenue", "visits"],
"ctr": ["clicks", "shows"],
"cpc": ["budget", "clicks"],
"GoalsMetrics.cpa": ["budget", "sumGoalReachesAny"],

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@zakhar
zakhar / gtk.css
Created July 16, 2014 08:39
cat ~/.config/gtk-3.0/gtk.css
TerminalWindow .notebook {
padding: 0;
border-width: 0;
}
TerminalWindow,
TerminalWindow.background {
background-image: none;
background-color: #6e6e6e;
color: #000000;
@zakhar
zakhar / dijkstra.py
Created January 22, 2014 19:13
Dijkstra’s algorithm
# coding: utf-8
import collections
# http://habrahabr.ru/post/111361/
gr1 = {
1: {2: 10, 3: 30, 4: 50, 5: 10},
2: {},
3: {5: 10},
4: {3: 20, 2: 40},
@zakhar
zakhar / gist:8295150
Last active January 2, 2016 11:09
AES encryption
from Crypto.Cipher import AES
import base64
import os
# the block size for the cipher object; must be 16, 24, or 32 for AES
BLOCK_SIZE = 32
# the character used for padding--with a block cipher such as AES, the value
# you encrypt must be a multiple of BLOCK_SIZE in length. This character is
# used to ensure that your value is always a multiple of BLOCK_SIZE