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
"""I suspect that there is a race condition in datetime module. | |
When I ran the following code in a multi-threading application: | |
datetime.datetime.strptime('20120509100335', "%Y%m%d%H%M%S") | |
I've noticed the following error in the log. | |
Traceback (most recent call last): | |
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 522, in __bootstrap_inner |
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
{% if is_paginated %} | |
<div class="pagination pagination-centered"> | |
<ul> | |
{% if page_obj.has_previous %} | |
<li><a href="?page={{ page_obj.previous_page_number }}{{ getvars }}{{ hashtag }}">← Prev</a></li> | |
{% else %} | |
<li class='disabled'><a>← Prev</a></li> | |
{% endif %} | |
{% for page in pages %} |
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 re | |
def camelcase_to_lowercase_with_underscores(name): | |
""" | |
>>> camelcase_to_lowercase_with_underscores('CamelCase') | |
'camel_case' | |
>>> camelcase_to_lowercase_with_underscores('CamelCamelCase') | |
'camel_camel_case' | |
>>> camelcase_to_lowercase_with_underscores('Camel2Camel2Case') |
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 optparse import OptionParser | |
import os | |
import sys | |
import csv | |
import hashlib | |
# workaround for error: | |
# Field larger than field limit | |
csv.field_size_limit(sys.maxsize) |
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 ubuntu:14.04 | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update && \ | |
apt-get install -y python python-dev python-pip git \ | |
libffi-dev libxml2-dev libxslt1-dev zlib1g-dev libssl-dev | |
RUN mkdir -p /var/log/supervisord /project |
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
# -*- coding: utf-8 -*- | |
"""Reentrant lock based on lock file. | |
Copyright (c) 2015 Alexander Chekunkov | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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
.card { | |
font-family: arial; | |
font-size: 20px; | |
text-align: center; | |
color: black; | |
background-color: white; | |
} | |
.synonyms { | |
font-size: 14px; |
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
# -*- coding: utf-8 -*- | |
"""Anki add-on which adds "Notes in CSV format" option of Export desc dialog. | |
Copyright (c) 2015 Alex Chekunkov | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 zlib | |
import boto | |
def decompress(key): | |
d = zlib.decompressobj(16 + zlib.MAX_WBITS) | |
for chunk in key: | |
yield d.decompress(chunk) | |
yield d.flush() |
OlderNewer