Skip to content

Instantly share code, notes, and snippets.

Anton Bobrov baverman

Block or report user

Report or block baverman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View xml2dict.py
# Simple xml to dict parser
#
# It's usable only for small documents due low performance
# comparing with lxml
from xml.etree import cElementTree as etree
from cStringIO import StringIO
def builder(ptag, attrib, pchild):
child = []
@baverman
baverman / tcolor.py
Last active Jan 4, 2016
xterm 256 color palette translation
View tcolor.py
#!/usr/bin/env python2
import sys
COLORS = [
('16', '000000'),
('17', '00005f'),
('18', '000087'),
('19', '0000af'),
('20', '0000d7'),
('21', '0000ff'),
@baverman
baverman / simple_notify.py
Last active Oct 22, 2019
Simple libnotify implementation using only plain dbus-send. Can close created notification.
View simple_notify.py
import sys
from subprocess import Popen, PIPE
def notify(title, body=None, timeout=-1, appname='simple-notify'):
cmd = [
'dbus-send',
'--type=method_call',
'--print-reply=literal',
'--dest=org.freedesktop.Notifications',
'/org/freedesktop/Notifications',
@baverman
baverman / nya.py
Created Oct 29, 2012
Next episodes downloader from http://www.nyaa.eu/
View nya.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import re
import sys
import os.path
from urllib2 import build_opener
from urllib import urlencode
from lxml import html
@baverman
baverman / vk-cli.py
Created Sep 17, 2012
Prints a downloadable url for VK video search
View vk-cli.py
#!/usr/bin/env python2
import sys
import re
from urllib2 import build_opener, HTTPCookieProcessor
from urllib import urlencode
from cookielib import CookieJar
from netrc import netrc
You can’t perform that action at this time.