Skip to content

Instantly share code, notes, and snippets.

View pohmelie's full-sized avatar
🐗

Nikita Melentev pohmelie

🐗
  • Tbilisi, Georgia
View GitHub Profile
@pohmelie
pohmelie / rubattle-D2-online.md
Last active August 29, 2015 14:15
PG (rubattle.net) diablo II players online

PG (rubattle.net) diablo II players online

Grabs snapshots of rubattle.net 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.

Requirements

  • python3
  • requests
  • beautifulsoup4
  • pygal

Result

result

@pohmelie
pohmelie / aio.lua
Last active November 16, 2015 11:09
aio — primitive asyncio-like coroutines scheduler
local M = {}
M.tasks = {}
function M.yield(...)
return coroutine.yield({args=table.pack(...)})
end
@pohmelie
pohmelie / curry.py
Created November 9, 2018 16:32
Curry weird decorator
import functools
def curry(calls=1):
def decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
@pohmelie
pohmelie / output.txt
Created April 27, 2019 10:51
pysnooper gen coro example
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
pohmelie / app.spec
Last active May 7, 2019 16:14
pyinstaller extended spec with declarative hat
# -*- mode: python -*-
import configparser
import pathlib
import shutil
NAME = "app"
ONE_FILE = False
HIDDEN = [
"module_a",
@pohmelie
pohmelie / repack-deb.sh
Last active September 8, 2020 10:37
Repack deb file
#!/usr/bin/env bash
rm -rf tmp
dpkg-deb -R $1 tmp
read -p "Press [enter] when done"
mv $1 $1.original
dpkg-deb -Zgzip -b tmp $1
@pohmelie
pohmelie / docker-trimmer.service
Created September 21, 2020 15:10
Trim docker images for 1 week every sunday 00:00
[Unit]
Description=Prune containers and "old" images (older, than week)
[Service]
ExecStart=/bin/bash -c "docker container prune -f && docker image prune -a -f --filter until=168h"
@pohmelie
pohmelie / result.txt
Created April 5, 2017 12:15
aiozmq XPUB/XSUB example
xpub connection made
xsub connection made
xsub binding tcp://127.0.0.1:45098
pub connection made
xpub binding tcp://127.0.0.1:34462
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
pohmelie / readme.md
Last active October 30, 2022 03:26
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

    cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=~/.pyenv/versions/3.5.0/usr/local/ \
    -D INSTALL_C_EXAMPLES=OFF \
    -D BUILD_NEW_PYTHON_SUPPORT=ON \
    
@pohmelie
pohmelie / text-border.scm
Created December 6, 2022 01:06
«Text border» plugin for GIMP (put it to `~/.config/GIMP/{version}/scripts/`
(script-fu-register "script-fu-text-border"
"Text border..."
"Creates text border"
"Anon"
"Anon"
"2012"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer" 0
SF-COLOR "Color" '(0 0 0)