Skip to content

Instantly share code, notes, and snippets.

View AlexSnet's full-sized avatar
🥦

Alex Raeder AlexSnet

🥦
  • Russia, Moscow
View GitHub Profile
@AlexSnet
AlexSnet / bstruct.py
Last active August 29, 2015 14:01
Binary structures in python
import struct
from collections import namedtuple
from collections import OrderedDict
from _abcoll import *
import _abcoll
from _collections import deque, defaultdict
from operaator import itemgetter as _itemgetter, eq as _eq
from keyword import iskeyword as _iskeyword
@AlexSnet
AlexSnet / lame.py
Created October 7, 2014 07:12
Lame python bindings
#coding:utf-8
# from: http://z4none.me/2014/07/09/Python-%E4%B8%AD%E4%BD%BF%E7%94%A8-libmp3lame-%E8%BF%9B%E8%A1%8C-mp3-%E7%BC%96%E8%A7%A3%E7%A0%81/
import time
import ctypes
class LameEncoder():
def __init__(self, sample_rate, channel_count, bit_rate):
self.dll = ctypes.CDLL("libmp3lame.dll")
/**
* Renders a customized guild tabard using the HTML5 <canvas> element.
*
* @copyright 2010, Blizzard Entertainment, Inc
* @class GuildTabard
* @example
*
* var tabard = new GuildTabard('canvas-element', {
* 'ring': 'alliance',
* 'bg': [ 0, 2 ],
@AlexSnet
AlexSnet / example.py
Created September 8, 2017 14:38
Yandex.Maps Polyline encoder & decoder
base = 'NTA9AtcdVAMYiQIABuT-__pO___OP_7_ziv9_yGx__9dq_7_PwYBAMhNAADwFwEAN18AAOJb__8MtQAApLz___bfAAAkYwAAAFP__xNjAAA='
assert yandex_to_human_decoder(yandex_to_human_encoder(yandex_to_human_decoder(base))) == yandex_to_human_decoder(base)
assert yandex_to_human_encoder(yandex_to_human_decoder(base)).decode() == base
assert yandex_to_human_decoder(base) == [(37564469, 55844311),(37730637, 55771613),(37685319, 55656875),(37499925, 55636684),(37412722, 55703819),(37432634, 55775483),(37457009, 55733469),(37503357, 55716225),(37560691, 55741605),(37516403, 55766968)]