code
stringlengths
1
1.72M
language
stringclasses
1 value
import cgi import urllib import time import random import urlparse import hmac import binascii VERSION = '1.0' # Hi Blaine! HTTP_METHOD = 'GET' SIGNATURE_METHOD = 'PLAINTEXT' # Generic exception class class OAuthError(RuntimeError): def __init__(self, message='OAuth error occured.'): self.m...
Python
#!/usr/bin/python # # Copyright (C) 2006 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
""" TLS Lite is a free python library that implements SSL v3, TLS v1, and TLS v1.1. TLS Lite supports non-traditional authentication methods such as SRP, shared keys, and cryptoIDs, in addition to X.509 certificates. TLS Lite is pure python, however it can access OpenSSL, cryptlib, pycrypto, and GMPY for faster crypt...
Python
"""Factory functions for asymmetric cryptography. @sort: generateRSAKey, parseXMLKey, parsePEMKey, parseAsPublicKey, parseAsPrivateKey """ from compat import * from RSAKey import RSAKey from Python_RSAKey import Python_RSAKey import cryptomath if cryptomath.m2cryptoLoaded: from OpenSSL_RSAKey import OpenSSL_RSAK...
Python
"""Abstract class for RSA.""" from cryptomath import * class RSAKey: """This is an abstract base class for RSA keys. Particular implementations of RSA keys, such as L{OpenSSL_RSAKey.OpenSSL_RSAKey}, L{Python_RSAKey.Python_RSAKey}, and L{PyCrypto_RSAKey.PyCrypto_RSAKey}, inherit from this. ...
Python
"""Classes for reading/writing binary data (such as TLS records).""" from compat import * class Writer: def __init__(self, length=0): #If length is zero, then this is just a "trial run" to determine length self.index = 0 self.bytes = createByteArrayZeros(length) def add(self, x, lengt...
Python
"""Class for parsing ASN.1""" from compat import * from codec import * #Takes a byte array which has a DER TLV field at its head class ASN1Parser: def __init__(self, bytes): p = Parser(bytes) p.get(1) #skip Type #Get Length self.length = self._getASN1Length(p) #Get Value ...
Python
"""cryptomath module This module has basic math/crypto code.""" import os import math import base64 import binascii import sha from compat import * # ************************************************************************** # Load Optional Modules # ****************************************************************...
Python
"""Helper functions for XML. This module has misc. helper functions for working with XML DOM nodes.""" import re from compat import * import os if os.name != "java": from xml.dom import minidom from xml.sax import saxutils def parseDocument(s): return minidom.parseString(s) else: from javax....
Python
"""Toolkit for crypto and other stuff.""" __all__ = ["AES", "ASN1Parser", "cipherfactory", "codec", "Cryptlib_AES", "Cryptlib_RC4", "Cryptlib_TripleDES", "cryptomath: cryptomath module", "dateFuncs", "hmac", "...
Python
"""Miscellaneous functions to mask Python version differences.""" import sys import os if sys.version_info < (2,2): raise AssertionError("Python 2.2 or later required") if sys.version_info < (2,3): def enumerate(collection): return zip(range(len(collection)), collection) class Set: def ...
Python
"""Pure-Python RSA implementation.""" from cryptomath import * import xmltools from ASN1Parser import ASN1Parser from RSAKey import * class Python_RSAKey(RSAKey): def __init__(self, n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0): if (n and not e) or (e and not n): raise AssertionError() ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2009 Alexey Malashin # # Licensed under GNU License # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expre...
Python
#!/usr/bin/env python # # Copyright (c) 2004, 2005 Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, th...
Python
#!/usr/bin/env python # # Copyright (c) 2004, 2005 Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, th...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- """ Админка """ __author__ = 'frozzzen@gmail.com (Alexey Malashin)' import logging from engine import settings from engine import pagegen from engine import backup from engine.data import news from engine.data import cites from engine.data import pages fro...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2006 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2006, 2007, 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2006, 2007, 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2006 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python import glob, os, sys, string as s # cc files from ocr-* folders are compiled into libocropus by default # extra directories for libocropus extradirs = """ """.split() # extra files which should not go to libocropus exclude = """ """.split() # optional files exclude = [] def print_header(): p...
Python
# -*- python -*- # vi: ft=python # Copyright 2008 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz # or its licensors, as applicable. # # You may not use this file except under the terms of the accompanying license. # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this f...
Python
#!/usr/bin/python import sys,os,re,string,os.path,glob if not os.path.isdir("ocroscript") and os.path.isdir("ocr-layout"): sys.stderr.write("must run this script from the top directory of ocropus") sys.exit(1) dirs = {} edges = [] files = glob.glob("*/*.h") + glob.glob("*/*.cc") for file in files: dir =...
Python
#!/usr/bin/python import os,sys,re,string,glob if len(glob.glob("*/*.a"))<10: sys.stderr.write("not enough libraries; you probably need to build ocropus first") sys.exit(255) sources = {} nsymbols = 0 for line in os.popen("nm -o -C */*.a","r").readlines(): line = line[:-1] fields = line.split(None,3...
Python
#!/usr/bin/python # Copyright 2008 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz # or its licensors, as applicable. # # You may not use this file except under the terms of the accompanying license. # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in co...
Python
#!/usr/bin/python import os,sys,re,string def die(s): sys.stderr.write(s) sys.exit(1) def run(s): sys.stderr.write("# "+s+"\n") return os.system(s) def tick(s): return os.popen(s,"r").read() file = sys.argv[-1] rest = sys.argv[1:-1] temp = "___temp___.cc" tempo = "___temp___.o" def clean(): ...
Python
#!/usr/bin/python # Copyright 2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz # or its licensors, as applicable. # # You may not use this file except under the terms of the accompanying license. # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in c...
Python
#!/usr/bin/python # Copyright 2007 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz # or its licensors, as applicable. # # You may not use this file except under the terms of the accompanying license. # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in c...
Python
#!/usr/bin/python import sys,os,re,string,os.path,glob if not os.path.exists("ocr-utils"): sys.stderr.write("must be run from top level of ocropus installation") sys.exit(1) sources = glob.glob("*/*.h") + glob.glob("*/*.cc") class UnionFind: def __init__(self): self.num_weights = {} self...
Python
#!/usr/bin/python import os,string,glob,sys,getopt,re script = sys.argv[0] assert os.path.exists(script) def uptodate(source=None,target=None): if not os.path.exists(target): return 0 return os.path.getmtime(source)<os.path.getmtime(target) def keywords(**keywords): return keywords extraction_params = keyw...
Python
#!/usr/bin/python # these are possible justifications; please stick to one of them STANDARD = "it's a textbook algorithm" APIDOCS = "it's based on a sample from the API documentation of the corresponding library" PERFORMANCE = "strict inlining is demonstrably necessary for performance" STABLE = "we don't expect to be...
Python
#!/usr/bin/python # extract lines from Google 1000 book sample import string,re,sys,os,shutil,glob import xml.sax as sax from PIL import Image usage = """ ... hocr image_pattern output_prefix Process Google 1000 books volumes and prepares line or word images for alignment using OCRopus. Run ocroscript align-... ...
Python
#!/usr/bin/python # -*- coding: iso-8859-1 -*- import string,re,sys,os,shutil,glob import xml.sax as sax from PIL import Image usage = """ ... hocr image_pattern output_prefix Arguments: xml_pattern: either a glob pattern that results in a list of xml files, or @filename for a file containing ...
Python
#!/usr/bin/python import os,sys,os.path,glob,re,string,random from pylab import * # FIXME # -- fix boxplot to use list-of-list representation (currently broken) stream = sys.stdin if len(sys.argv)>1: stream = open(sys.argv[1],"r") data = [] for line in stream.xreadlines(): f = line.split() if len(f)>0 and f[...
Python
#!/usr/bin/python import os,sys,os.path,glob,re,string,random ocropus = "../ocropus-cmd/ocropus" simp_re = re.compile(r'[^a-zA-Z0-9,.+=/*?!-]+') def die(s): sys.stderr.write("FATAL: %s\n"%s) sys.exit(1) def ensure(s): if not os.path.exists(s): die("%s: file not found" % s) ensure(ocropus) direct...
Python
#!/usr/bin/python import os,sys,os.path,glob,re,string,random # FIXME # -- better documentation # -- better command line error checking # -- use temporary file names instead of _truth, _ocr # -- more informative error messages # -- record machine, processing times # -- get rid of ./distance # -- output data into sqlit...
Python
#!/usr/bin/python import sys,os vars = {} results = [] for file in sys.argv[1:]: current = {} for line in open(file).readlines(): f = line.split() if len(f)>1 and f[0]=="pick": key,value = f[1].split("=") if len(value.split(":"))==2: m,s = value.split("...
Python
#!/usr/bin/python # -*- coding: iso-8859-1 -*- import urllib2, zlib, gzip, StringIO, Image, threading import sys, zipfile, os, os.path, re, tempfile, datetime, shutil import xml.dom.minidom as dom nThreads = 8 def getImages(siteRoot, siteName, dir=None): global logFile if dir == None: dir = tempfile....
Python
''' Created on 03.11.2009 @author: anamariastoica ''' from sna.crawler.crawler import CommunityCrawler import sna.db.dbaccess as dbaccess import sna.db.services as snaserv import urllib defAvatar = 'http://wire.wiscnet.net/wp-content/uploads/2009/04/delicious-60x60.png' class DeliciousCrawler(Community...
Python
''' Created on 03.11.2009 @author: anamariastoica ''' from sna.crawler.crawler import CommunityCrawler import sna.db.dbaccess as dbaccess import sna.db.services as snaserv import urllib import feedparser defAvatar = 'http://www.christmastree.org/youtube.jpg' class YouTubeCrawler(CommunityCrawler): ...
Python
''' Created on April 9, 2009 @author: anamariastoica ''' import sna.db.dbaccess as dbaccess import time import threading class CommunityCrawler(object): ''' Kind of an abstract class for Social Network Crawlers Gets resources and friends up to a certain level ''' def __init__(self, max_level=2):...
Python
''' Created on 03.11.2009 @author: anamariastoica ''' from sna.crawler.crawler import CommunityCrawler import sna.db.dbaccess as dbaccess import sna.db.services as snaserv import urllib defAvatar = 'http://press.slideshare.net/wp-content/uploads/2008/12/slideshare_550x150.png' class SlideShareCrawler(C...
Python
''' Created on 03.11.2009 @author: anamariastoica ''' from sna.crawler.crawler import CommunityCrawler import sna.db.dbaccess as dbaccess import sna.db.services as snaserv import urllib import urllib2 import re defAvatar = 'http://careernetwork.msu.edu/wp-content/themes/cspMSU_v4.1/_images/twitter-logo.png' class T...
Python
''' Created on 03.11.2009 @author: anamariastoica ''' from sna.crawler.crawler import CommunityCrawler import sna.db.dbaccess as dbaccess import sna.db.services as snaserv import urllib defAvatar = 'http://wire.wiscnet.net/wp-content/uploads/2009/04/flickr-logo.png' class FlickrCrawler(CommunityCrawler...
Python
''' Created on April 21, 2009 @author: anamariastoica ''' import urllib import urllib2 import hashlib import time import sna.etc.xml2dict as xml2dict class SlideShareAPI(object): def __init__(self, params): """ params dictionary must have at least api_key, and secret_key values """ ...
Python
""" Thunder Chen<nkchenz@gmail.com> 2007.9.1 """ try: import xml.etree.ElementTree as ET except: import cElementTree as ET # for 2.4 from object_dict import object_dict import re class XML2Dict(object): def __init__(self): pass def _parse_node(self, node): node_tree = object_dict() ...
Python
""" object_dict nkchenz@gmail.com 2007 Provided as-is; use at your own risk; no warranty; no promises; enjoy! """ class object_dict(dict): """object view of dict, you can >>> a = object_dict() >>> a.fish = 'fish' >>> a['fish'] 'fish' >>> a['water'] = 'water' >>> a.water 'water' >...
Python
''' Created on May 28, 2009 @author: anamariastoica ''' import ana.dbaccess as db from pysparse import spmatrix import numpy as np class FolkRank(object): ''' FolkRank algorithm ''' def __init__(self, urt=None, nu=0, nr=0, nt=0): ''' Initializes the adjacency matrix A, and number of...
Python
''' Created on April 9, 2009 @author: anamariastoica ''' from rdfalchemy.sparql.sesame2 import SesameGraph from rdflib import Namespace, Literal, URIRef, BNode from datetime import date import dbaccess_cfg as config import time import urllib import sna.db.services as snaserv import sys reload(sys) sys.setdefaultenco...
Python
# services DELICIOUS = 'delicious' FLICKR = 'flickr' SLIDESHARE = 'slideshare' TWITTER = 'twitter' YOUTUBE = 'youtube' services = [DELICIOUS, SLIDESHARE, TWITTER, YOUTUBE] # service URIs serviceUri = { DELICIOUS: 'http://delicious.com/', FLICKR: 'http://www.flickr.com/', SLIDESHARE: 'http://www.slideshare...
Python
rep = 'http://localhost:8080/openrdf-sesame/repositories/sna_study' TRIES = 3 WAIT = 3
Python
import sys from sna.db.dbaccess import User, Bookmark, Image, Document, Tweet, Video, \ Resource, Tag, db, UserResourceTag from sna.study import network from sna.db.services import DELICIOUS, FLICKR, SLIDESHARE, TWITTER, YOUTUBE DEFAULT = 'DEFAULT' RESOURCE_TYPES = { DELICIOUS: Bookmark(), FLICKR: Image(), ...
Python
import sys, time from sna.db.dbaccess import Resource from sna.crawler.deliciouscrawler import DeliciousCrawler from sna.crawler.flickrcrawler import FlickrCrawler from sna.crawler.slidesharecrawler import SlideShareCrawler from sna.crawler.twittercrawler import TwitterCrawler from sna.crawler.youtubecrawler import Y...
Python
#!/usr/bin/python # Copyright 2011 Google, Inc. All Rights Reserved. # simple script to walk source tree looking for third-party licenses # dumps resulting html page to stdout import os, re, mimetypes, sys # read source directories to scan from command line SOURCE = sys.argv[1:] # regex to find /* */ style commen...
Python
# script to perform the py2exe setup and then get innosetup to build the installer # optionally can increment the version number of the output setup from distutils.core import setup import py2exe import os import sys import subprocess def copy_plugins(pluginsdir, distdir, plugintype): dst = os.path.join(d...
Python
#!/usr/bin/python # minimalistic browser levering off of Python, PyQt and Webkit from PyQt4 import QtGui, QtCore, QtWebKit, QtNetwork import sqlite3 import os import sys import time import base64 import socket import sip # put here to make py2exe work better import subprocess def registerShortcuts(actions, defaultOwne...
Python
from distutils.core import setup import py2exe setup(windows=[ { "script":"foobrowser.pyw", "icon_resources":[(1, "foobrowser.ico")] } ])
Python
#!/usr/bin/python # minimalistic browser levering off of Python, PyQt and Webkit from PyQt4 import QtGui, QtCore, QtWebKit, QtNetwork import sqlite3 import os import sys import time import base64 import socket import sip # put here to make py2exe work better import subprocess def registerShortcuts(actions, defaultOwne...
Python
# This web app runs a contest for college football bowl games. # # Each bowl game has a name and two teams. We associate unique # 2-letter id's to each game, and 2-4 letter id's to each team. For # example: # # New Mexico Bowl (NM) -- Nevada (NEV) vs Arizona (ARIZ) # Russell Athletic Bowl (RA) -- Rutgers (RUTG) v...
Python
x = 'x = %s; print x %% repr(x)'; print x % repr(x)
Python
#!/usr/bin/python # # pills.py exact 100 > pills.html # pills.py rand 200 1000 > pills.html # # Common variables below: # n - Number of pills to start with # t - Total pills remaining (wholes + halves) # w - Whole pills remaining # # We track w & t when simulating or computing probabilities. # From state (w, t): ...
Python
#!/usr/bin/python import random h = 10 n = 20 x = [random.randrange(h) for _ in xrange(n)] w = [0] * n a, b = 0, n-1 aa, bb = x[0], x[-1] while a < b: if x[a] < x[b]: a += 1 aa = max(aa, x[a]) w[a] = aa - x[a] else: b -= 1 bb = max(bb, x[b]) w[b] = bb - x[b] for r in xrange(h-1, 0, -1): ...
Python
#!/usr/bin/python import random class Sample(object): def __init__(self, k): self._k = k self._n = 0 self._values = [] def Add(self, x): self._n += 1 if self._n <= self._k: self._values.append(x) else: i = random.randrange(self._n) if i < self._k: self._values[i]...
Python
import re from django import forms from django.utils.translation import gettext_lazy as _ from fontrender.settings import MIN_FONT_SIZE,MAX_FONT_SIZE,MIN_LEADING,MAX_LEADING TRACKING_CHOICE = ( (-1,'-100%'), (-0.75,'-75%'), (-0.5,'-50%'), (-0.25,'-25%'), (-0.1,'-10%'), (-0.05,'-5%'...
Python
from fontrender.converter.models import Font import cairo import pango import pangocairo class PyGTKRenderer(): def __init__(self,font,data, *args, **kwargs): self.font = font self.size = data['size'] # self.distance = float(data['distance']) self.text = data['message'] ...
Python
from django.db import models import fontfield import datetime class Tag(models.Model): name = models.CharField(max_length=30,blank=False) def __unicode__(self): return self.name class Category(models.Model): name = models.CharField(max_length=30,blank=False) slug = models.SlugFiel...
Python
""" This file demonstrates two different styles of tests (one doctest and one unittest). These will both pass when you run "manage.py test". Replace these with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): ...
Python
from django.db.models.fields.files import FileField, FieldFile from PIL import Image, ImageFont, ImageDraw import os def _add_preview(s): parts = s.split(".") parts[-1] = 'png' return ".".join(parts) class FontFieldFile(FieldFile): def _get_thumb_path(self): return _add_preview(self...
Python
from django.conf.urls.defaults import * urlpatterns = patterns('fontrender.converter.views', url(r'^$', 'converter', name='converter'), url(r'^(?P<slug_category>[-\w]+)/$', 'converter'), url(r'^(?P<slug_category>[-\w]+)/(?P<slug_font>[-\w]+)/$', 'converter'), )
Python
from BeautifulSoup import BeautifulSoup, NavigableString from soupselect import select from urllib2 import urlopen from fontrender.converter.models import Font from PIL import Image,ImageFont, ImageDraw import pygame import sys def p_properties(pTag): align = hscale = vscale = None for attr, value ...
Python
from django.contrib import admin from fontrender.converter.models import Tag, Category, Font class CategoryAdmin(admin.ModelAdmin): prepopulated_fields = {'slug': ('name',)} class FontAdmin(admin.ModelAdmin): filter_horizontal = ('tags',) search_fields = ('name',) list_filter = ('created',) ...
Python
from django.core.context_processors import csrf from django.http import HttpResponse from django.core.servers.basehttp import FileWrapper from django.shortcuts import render_to_response, get_object_or_404 from django.core.paginator import Paginator, InvalidPage, EmptyPage from fontrender.converter.models import ...
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha...
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha...
Python
from django.conf.urls.defaults import * from django.contrib.staticfiles.urls import staticfiles_urlpatterns # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: (r'^fontrender/', include('fontrender.converter.u...
Python
from django.utils.translation import gettext_lazy as _ # Django settings for dtic project. DEBUG = True TEMPLATE_DEBUG = DEBUG MIN_LEADING = 0 MAX_LEADING = 210 MIN_FONT_SIZE = 6 MAX_FONT_SIZE = 210 ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'd...
Python
''' Created on May 28, 2010 @author: ivan ''' import cgi from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import os from google.appengine.ext.webapp import template import pylast from configuration import FConfiguration from vk import Vkontakte from pylast import WSErr...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
''' Created on Feb 26, 2010 @author: ivan ''' import sys def debug(*args): print "DEBUG:", args def info(*args): print "INFO:", args def error(*args): print >> sys.stderr, args
Python
''' Created on May 28, 2010 @author: ivan ''' class Demo(): def __init__(self, name): self.name = name
Python
# -*- coding: utf-8 -*- ''' Created on Mar 17, 2010 @author: ivan ''' import urllib2 import urllib import re import time from string import replace from configuration import FConfiguration class Vkontakte: def __init__(self, email, password): self.email = email self.password = password s...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from demo import Demo class MainPage(webapp.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, webapp World!') demo ...
Python
# -*- coding: utf-8 -*- # # pylast - A Python interface to Last.fm (and other API compatible social networks) # Copyright (C) 2008-2009 Amr Hassan # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundati...
Python
# -*- coding: utf-8 -*- ''' Created on Feb 27, 2010 @author: ivan ''' class FConfiguration: def __init__(self): self.vk_login = "qax@bigmir.net" self.vk_password = "foobnix" self.lfm_login = "foobnix" self.lfm_password = "foobnix" self.API_KEY = "bc...
Python
import cgi from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext import db import os from google.appengine.ext.webapp import template class Greeting(db.Model): author = db.UserProperty() content = db.S...
Python
#!/usr/bin/env python import os, glob, shutil from distutils.core import setup from foobnix.util.configuration import VERSION, FOOBNIX_TMP, FOOBNIX_TMP_RADIO if not os.path.exists(FOOBNIX_TMP): os.mkdir(FOOBNIX_TMP) os.mkdir(FOOBNIX_TMP_RADIO) def capture(cmd): return os.popen(cmd).read().strip() def re...
Python
#!/usr/bin/env python ''' Created on Mar 10, 2010 @author: ivan ''' import pygst from foobnix.util import LOG pygst.require('0.10') import pygtk pygtk.require20() import gtk import gobject import gettext from foobnix.application.app_view import AppView from foobnix.application.app_controller import AppController imp...
Python