Skip to content

Instantly share code, notes, and snippets.

View clemesha's full-sized avatar

Alex Clemesha clemesha

View GitHub Profile
#!/usr/bin/env python
import ImageDraw, Image, ImageFont
def flash_card_name(n, sname):
names = []
for i in range(n):
if i < 10:
names.append("%s00%d.png" % (sname, i))
elif i < 100:
names.append("%s0%d.png" % (sname, i))

Knoboo

A new knoboo that:
  • Uses Django
  • Uses twisted.web
  • Is a current Work in Progress, and is still broken/incomplete in several (fixable) places

Dependencies

Notes on implementing @interact

  • First eval with "@interact" creates a "interact cell"

Drag of Slider creates update of the "interact cell", here is the data for ``cell id6``

id 6
#!/usr/bin/python2.5
import xml.etree.ElementTree as ET
import sys
root = ET.Element("html")
head = ET.Element("head")
title = ET.Element("title")
title.text = " "
"""
When I run this script with:
twistd -ny logobservermemfail.py
On OSX, using Twisted 8.2.0, Python 2.5, i see this error:
Python(12631) malloc: *** mmap(size=1275076608) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
#!/usr/bin/python
"""
Connect to an IMAP4 server with Twisted.
---------------------------------------
Run like so:
$ python twisted_imap4_example.py
This example is slightly Gmail specific,
in that SSL is required, and the correct
server name and ports are set for Gmail.
Process: python [1278]
Path: /Users/agc/codenodepkgenv/bin/python
Identifier: python
Version: ??? (???)
Code Type: X86 (Native)
Parent Process: launchd [1]
Date/Time: 2009-06-12 14:51:47.450 -0700
OS Version: Mac OS X 10.5.7 (9J61)
Report Version: 6
import os
from whoosh import index
from whoosh import analysis
from whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT
from whoosh.filedb.filestore import FileStorage
SEARCH_INDEX = "search_index"
SEARCH_SCHEMA = Schema(
guid=ID(stored=True),
adduser --gecos GECOS --disabled-password some_user
"""
'How to do basic authentication on twisted web', from here:
http://twistedmatrix.com/pipermail/twisted-python/2009-August/020236.html
Original Copyright (c) 2008 Twisted Matrix Laboratories. See LICENSE for details.
Which I modified to use Twisted's Application framework.
USAGE
-----
1) Make htpasswd file: