This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
r"""Parse space-separated key=value pairs. | |
Format from http://ru.stackoverflow.com/a/635295/23044 | |
>>> from pprint import pprint | |
>>> pprint(parse(r'a=1 b="2" c=3.123 d=[1, 2, 3] e={"Ke\n":["h=4"],"Key2":{" ":1}}')) | |
{'a': 1, | |
'b': '2', | |
'c': 3.123, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.cache* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/.cachedir/ | |
/sites.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""beep the pc speaker in the console. | |
Enable pc speaker: | |
$ sudo modprobe pcspkr | |
From https://github.com/hilbix/kdmktone | |
See also http://www.tldp.org/LDP/lpg/node83.html | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Get TAI-UTC difference in seconds for a given time using tzdata. | |
i.e., find the number of seconds that must be added to UTC to compute | |
TAI for any timestamp at or after the given time[1]. | |
>>> from datetime import datetime | |
>>> import leapseconds | |
>>> leapseconds.dTAI_UTC_from_utc(datetime(2005, 1, 1)) | |
datetime.timedelta(0, 32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so | |
# Distribution / packaging | |
.Python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
r"""Support for IEEE 754 half-precision binary floating-point format: binary16. | |
>>> [binary16(f) for f in [0.006534, -.1232]] == [b'\xb0\x1e', b'\xe2\xaf'] | |
True | |
""" | |
from __future__ import division | |
import struct | |
from math import copysign, frexp, isinf, isnan, trunc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Play a media (audio/video) file using GStreamer. | |
To install Gstreamer and its Python bindings on Ubuntu, run: | |
$ sudo apt-get install python-gi python3-gi \ | |
gstreamer1.0-tools \ | |
gir1.2-gstreamer-1.0 \ | |
gir1.2-gst-plugins-base-1.0 \ | |
gstreamer1.0-plugins-good \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import posixpath | |
try: | |
from urlparse import urlsplit | |
from urllib import unquote | |
except ImportError: # Python 3 | |
from urllib.parse import urlsplit, unquote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Print info in json format about OS process specified by its pid. | |
Usage: procinfo PID | |
To install: | |
$ sudo apt-get install python-psutil # install dependencies | |
# https://pypi.python.org/pypi?:action=display&name=psutil#downloads |