import uuid
uuid.uuid4().hex
'705e54562bca4991910e53958bf24729'
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 -*- | |
"""\ | |
Start RabbitMQ server: | |
$ sudo systemctl start rabbitmq.service | |
Start Celery worker: | |
$ celery worker -A tasks -l debug |
Note: I use Python 3, but most of these should work in Python 2 too.
Lambda functions are also known as anonymous functions and are typically
passed as arguments to other functions. Notable examples are the map()
,
reduce()
, filter()
built-in functions which require a function to be
passed as an argument.
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
## | |
# mpv.conf | |
# | |
hwdec=vaapi | |
#hwdec=vdpau | |
vo=opengl | |
#vo=wayland | |
#vo=opengl-hq | |
#vo=opengl-hq:deband=no |
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 curses | |
import sys | |
def curses_wrapper(func, *args, **kwds): | |
"""Wrapper decorator that initializes curses and calls another function, | |
restoring normal keyboard/screen behavior on error or exit. |
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 xml.etree.ElementTree as ET | |
xml = '''\ | |
<RECORDSET> | |
<RECORD ID="1"> | |
<FIELDNAME>ORIGINALSEVERITY</FIELDNAME><FIELDVALUE>0</FIELDVALUE> |
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 -*- | |
"""various date/time utilities | |
<datetime.datetime> parsing behavior | |
[year(-|/|.)month(-|/|.)day(_whitespace_)][[[hour]:minute]:second] | |
<datetime.timedelta> parsing behavior |
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 -*- | |
"""various date/time utilities | |
<datetime.datetime> parsing behavior | |
[year(-|/|.)month(-|/|.)day(_whitespace_)][[[hour]:minute]:second] | |
<datetime.timedelta> parsing behavior |
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 subprocess | |
from shutil import which # Python 3.3 | |
# Reset locale | |
os.environ.setdefault("LC_ALL", "C") |
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
#!/bin/bash | |
random_choice() { | |
choices=("$@") | |
echo ${choices[$(( $RANDOM % ${#choices[@]} ))]} | |
} | |
random_choice "$@" |
OlderNewer