Skip to content

Instantly share code, notes, and snippets.

Anthony Landis tony-landis

Block or report user

Report or block tony-landis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pdo-singleton-class.php
<?php
/**
* PDO SINGLETON CLASS
*
* @author Tony Landis
* @link http://www.tonylandis.com
* @license Use how you like it, just please don't remove or alter this PHPDoc
*/
class sdb
@tony-landis
tony-landis / s3_rackspace_migrate.py
Created Feb 1, 2012
Migrate from S3 to Rackspace Cloud Files
View s3_rackspace_migrate.py
#!/usr/bin/python
"""
S3 to Rackspace Cloud Files Migration
This script will copy the contents of a S3
bucket to to a Rackspace Cloud Files container.
Depends on the boto and python_cloudfiles python libraries.
@tony-landis
tony-landis / CsvToArray.py
Created Dec 5, 2008
Convert CSV string to fixed width text table
View CsvToArray.py
"""
Convert CSV string to fixed width text table. Supports multi-line rows, column width limits, and creates a header row automatically
@author Tony Landis
@link http://www.tonylandis.com
@license GPL
"""
from math import ceil
class CsvToTxt():
@tony-landis
tony-landis / couch-replicate-monitor.py
Created Oct 27, 2012
Simple script you can put in your crontab to monitor replication state of all docs in the _replicator couchdb database. Will send an email with the host name, doc name and state if state is not 'triggered'.
View couch-replicate-monitor.py
#!/usr/bin/python
"""
Simple script you can put in your
crontab to monitor replication state
of all docs in the _replicator
couchdb database.
Will send an email with the host name,
doc name and state if state is not 'triggered'.
View gist:411622
// some data used in the examples
Ext.namespace('Ext.exampledata');
Ext.exampledata.states = [
['AL', 'Alabama', 'The Heart of Dixie'],
['AK', 'Alaska', 'The Land of the Midnight Sun'],
['AZ', 'Arizona', 'The Grand Canyon State'],
['AR', 'Arkansas', 'The Natural State'],
['CA', 'California', 'The Golden State'],
['CO', 'Colorado', 'The Mountain State'],
View gist:122663
CREATE DATABASE `pylons_openid`;
USE pylons_openid;
CREATE TABLE `user` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(128) default NULL,
`password` varchar(128) default NULL,
`acl` varchar(16) NOT NULL,
`name` varchar(32) default NULL,
View __init__.py
from sqlalchemy.orm import *
from sqlalchemy import Table, Column, ForeignKey, Integer
from sqlalchemy.types import Integer, Unicode, String, DateTime
from pylons_openid.model import meta
def init_model(engine):
"""Call me before using any of the tables or classes in the model"""
meta.Session.configure(bind=engine)
meta.engine = engine
View gist:122671
import logging
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to
from pylons_openid.lib.base import BaseController, render
log = logging.getLogger(__name__)
from pylons_openid.lib.auth import *
class RootController(BaseController):
View gist:122674
import logging
from pylons import config, request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to, url_for
from pylons_openid.lib.base import BaseController, render
log = logging.getLogger(__name__)
import urllib2
import md5
import simplejson as json_
View gist:122675
<h1>
You are logged in
</h1>
<p>
<strong>Session:</strong>
${str(c.user)}
</p>
<ul>
<li>
<a href="/root/admin">
You can’t perform that action at this time.