Skip to content

Instantly share code, notes, and snippets.

@edelooff
edelooff / integrity_example.py
Created Jun 5, 2015
Catching and handling IntegrityError in SQLAlchemy
View integrity_example.py
import sys
import sqlalchemy as sa
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
base = declarative_base()
print 'SQLAlchemy version {}'.format(sa.__version__)
@edelooff
edelooff / tileable_hexagons.py
Created Oct 1, 2014
Drawing tileable hexagons with PIL + Aggdraw
View tileable_hexagons.py
"""Module for drawing of randomly colored, tileable hexagons."""
import math
import random
from PIL import Image
from aggdraw import Draw, Brush
class HexagonGenerator(object):
@edelooff
edelooff / gist:1d280ec2745248295dae
Created Jun 9, 2014
reST article to demonstrate pelican issue #1369
View gist:1d280ec2745248295dae

Automatic post summary causes weird line numbers in code-block

Date: 2014/06/09
tags:Pelican, reStructuredText

This article is a demonstration for Pelican issue #1369. The SUMMARY_MAX_LENGTH is set to 100 words, which means that index pages will list the first 100 words of this article. This includes a portion of the below code snippet, which configured to have its line numbers in a table.

You can’t perform that action at this time.