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
from django.conf import settings | |
from django.http import HttpResponse, HttpResponseNotFound | |
import os | |
import re | |
import clevercss | |
def serve_css(request, path): | |
css_fname = os.path.join(settings.MEDIA_ROOT, path) | |
ccss_fname = os.path.join(settings.MEDIA_ROOT, re.compile('\.css$').sub('.ccss', path)) | |
css = ccss = None |
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
from django.conf import settings | |
from django.http import HttpResponseNotFound | |
from django.views.static import serve as django_serve | |
import os | |
def _do_rec_sync(local_root, remote_path, local_path, update): | |
if os.path.exists(local_path) and (os.path.isdir(local_path) or not update): | |
return | |
parent_local_path = os.path.normpath(os.path.join(local_path, '..')) |
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
import urllib | |
import urllib2 | |
import random | |
import decimal | |
UAGENTS = [ | |
'Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US)', | |
'Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)', | |
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7)', | |
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 4.0; InfoPath.3; MS-RTC LM 8; .NET4.0C; .NET4.0E)', |
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
def mod10(number): | |
digits = [] | |
even = False | |
for digit in reversed(number): | |
digit = ord(digit) - ord('0') | |
if even: | |
digit = digit * 2 | |
if digit >= 10: | |
digit = digit % 10 + digit / 10 | |
digits.append(digit) |
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
from datetime import date | |
class PESEL(object): | |
"""Parses PESEL number, checks validity and extracts gender + DOB data.""" | |
gender = None | |
birth_date = None | |
pesel = None | |
def __init__(self, pesel): | |
try: |
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/python | |
""" | |
Fetch and print current Monero mempool. | |
""" | |
from datetime import datetime | |
import json | |
import logging | |
import requests | |
class MemPool(object): |
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
[Unit] | |
Description=Reload wacom module (touchscreen) | |
After=suspend.target | |
[Service] | |
User=root | |
Type=oneshot | |
ExecStart=/usr/bin/rmmod wacom | |
ExecStop=/usr/bin/modprobe wacom | |
TimeoutSec=0 |
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
class Intok(object): | |
"""Encodes and decodes integers as short, easy to type tokens, using custom | |
alphabet. | |
The default alphabet consists of 29 digits and uppercase letters. It has | |
no vowels to eliminate accidental formation of words, and no glyphs that | |
could be confused (0 and O, I and 1). | |
""" | |
alphabet = 'BCDFGHJKLMNPQRSTVWXZ23456789' | |
case_sensitive = False |
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
import logging | |
from monero.daemon import Daemon | |
from monero.backends.jsonrpc import JSONRPCDaemon | |
import operator | |
import re | |
import sys | |
MY_DAEMON = '127.0.0.1:18081' | |
OTHER_DAEMONS = [ | |
'node.moneroworld.com:18089', |