Corrects the filenames and metadata of music files.
You want your music files named:
ALBUM/TRACK-NUMBER - ARTIST - TRACK-TITLE.EXT
import decimal | |
class FixedPoint(decimal.Decimal): | |
def to_fixed_point(self, whole_bits, fraction_bits, signed=False): | |
# returns bytes aligned to the last fraction bit | |
total = round(self * (1 << fraction_bits)) | |
num_bytes = (whole_bits + fraction_bits) / 8 | |
if num_bytes % 1: |
#!env python3 | |
import argparse | |
import datetime | |
import enum | |
import math | |
import os.path | |
import shlex | |
import shutil | |
import subprocess |
#!/bin/bash | |
# | |
# Usage: watch-and-revert.sh filename | |
# | |
BACKUP="$(dirname $1)/.backup-$(basename $1)" | |
function cleanup { | |
rm $BACKUP | |
} | |
trap cleanup EXIT | |
cat $1 > $BACKUP |
from tastypie.resources import ModelResource as BaseModelResource | |
class ReadOnlyFieldsAfterAddMeta(BaseModelResource.__metaclass__): | |
def __new__(cls, name, bases, attrs): | |
new_class = super(ReadOnlyFieldsAfterAddMeta, cls).__new__(cls, name, bases, attrs) | |
read_only_fields_after_add = getattr(new_class._meta, 'read_only_after_add', ()) | |
for field_name in read_only_fields_after_add: |
>>> class MetaMeta(object): | |
... def __init__(self): | |
... print ('metameta') | |
... | |
>>> class Meta(MetaMeta): | |
... def __init__(self): | |
... print ('meta1') | |
... | |
>>> class Meta2(MetaMeta): | |
... def __init__(self): |
I hereby claim:
To claim this, I am signing this object:
This is based on the outdated, official Cacti configuration for ADSL Line and modified for Draytek Vigor support.
Changes from the original include:
.zip
file by clicking the button to the left labelled "Download Gist"import fractions | |
import re | |
def parse_media_query(media_query): | |
class Grouping(object): | |
def __init__(self, parent, *args): | |
self.parent = parent |
""" | |
Take an HTML document and replace all CSS with inline styles, accounting | |
for all precedence rules. Requires cssutils, cssselect and lxml.Does not | |
work with pseudo-elements, @font-face, @page and CSS variables as these | |
cannot be represented by inline CSS. | |
Usage:: | |
inline_css(html_string, page_url, medium) | |