Skip to content

Instantly share code, notes, and snippets.


Nikita Melentev pohmelie

View GitHub Profile
pohmelie / app.spec
Last active May 7, 2019
pyinstaller extended spec with declarative hat
View app.spec
# -*- mode: python -*-
import configparser
import pathlib
import shutil
NAME = "app"
ONE_FILE = False
pohmelie / output.txt
Created Apr 27, 2019
pysnooper gen coro example
View output.txt
Starting var:.. x = 1
Starting var:.. y = 2
13:50:40.798043 call 29 def fib(n):
13:50:40.798187 line 11 z = x + y
New var:....... z = 3
13:50:40.798215 line 12 a = x - y
New var:....... a = -1
13:50:40.798250 line 13 b = a + z
New var:....... b = 2
13:50:40.798271 line 14 result = await the_42()
pohmelie / nginx-openresty reverse proxy ntlm
Last active Jul 24, 2020
nginx/openresty reverse proxy ntlm support
View nginx-openresty reverse proxy ntlm

nginx/openresty reverse proxy ntlm support


This code allows you to pass ntlm auth in nginx reverse proxy mode. The problem with plain nginx is that ntlm requires one tcp connection for multiple http requests. Even if browser respect this behaviour, nginx will create/took new connection for each request to ntlm-awared server.


Implement nginx-like stream proxy, but parse http to understand end of sequence (first request after ntlm auth). We need end of sequence, since browser can reuse opened tcp connection and send another request, which will be passed to ntlm-aware server and this is not you expect.


Put ntlm.lua to lualib path of openresty.


You need to install lua-http-parser into openresty lualib path with luarocks.


pohmelie /
Created Nov 9, 2018
Curry weird decorator
import functools
def curry(calls=1):
def decorator(f):
def wrapper(*args, **kwargs):
#!/usr/bin/env bash
rm -rf tmp
dpkg-deb -R $1 tmp
read -p "Press [enter] when done"
mv $1 $1.original
dpkg-deb -b tmp $1
pohmelie /
Created Apr 26, 2017
Build opencv for ubuntu 16.04 with pyenv
import pathlib
import sys
import sh
def clone_if_not_exists(name, url, **kwargs):
if not pathlib.Path(name).exists():
print("Cloning", url, "...")
sh.git.clone(url, name, depth=1, **kwargs)
pohmelie / result.txt
Created Apr 5, 2017
aiozmq XPUB/XSUB example
View result.txt
xpub connection made
xsub connection made
xsub binding tcp://
pub connection made
xpub binding tcp://
sub connection made
xpub message received [b'\x01test']
xpub writing [b'\x01test'] to xsub
xsub message received [b'test', b'0']
xsub writing [b'test', b'0'] to xpub
pohmelie /
Last active Apr 26, 2020
Install opencv3 for python 3.5.0 with pyenv on ubuntu 14.04

Install opencv3 for python 3.5.0 with pyenv on ubuntu 14.04

  • update cmake and install deps as this said.

  • run cmake

    -D CMAKE_INSTALL_PREFIX=~/.pyenv/versions/3.5.0/usr/local/ \
pohmelie / aio.lua
Last active Nov 16, 2015
aio — primitive asyncio-like coroutines scheduler
View aio.lua
local M = {}
M.tasks = {}
function M.yield(...)
return coroutine.yield({args=table.pack(...)})
pohmelie /
Last active Aug 29, 2015
PG ( diablo II players online

PG ( diablo II players online

Grabs snapshots of from «wayback machine» (thanks for API ;) and gets the online of Diablo II LOD server. Split results by UTC time of snapshot (don't forget UTC+4 cause moscow) by three groups. Build some nice graph to svg via pygal.


  • python3
  • requests
  • beautifulsoup4
  • pygal



You can’t perform that action at this time.