Skip to content

Instantly share code, notes, and snippets.

@nick-jiang
nick-jiang / captcha.py
Last active May 1, 2024 19:03
Create simple captcha image using PIL.
#!/usr/bin/env python
# _*_ encoding: utf-8 _*_
import random
import string
from PIL import Image, ImageDraw, ImageFont, ImageFilter
CHARS = string.digits + string.letters
def create_captcha(loc='media/fonts', size=(120, 30), chars=CHARS, amount=6, img_type='GIF', mode='RGB',
@nick-jiang
nick-jiang / app.py
Last active August 29, 2015 14:05 — forked from ayang/app.py
Redis based simple session store
#!/usr/bin/env python
# _*_ encoding: utf-8 _*_
import time
from tornado.web import RequestHandler
from utils.session import RedisSessionStore