Skip to content

Instantly share code, notes, and snippets.

@goldenboy
goldenboy / pyminifier.py
Created February 14, 2012 11:09
Python Minifier:** Reduces the size of (minifies) Python code for use on embedded platforms.
## {{{ http://code.activestate.com/recipes/576704/ (r16)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pyminifier.py
#
# Copyright 2009 Dan McDougall <[email protected]>
#
# 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
@goldenboy
goldenboy / routes.py
Created February 10, 2012 15:03 — forked from gilsondev/routes.py
Exemplo usado na vídeo aula de rotas
#!/usr/bin/python
# -*- coding: utf-8 -*-
# default_application, default_controller, default_function
# are used when the respective element is missing from the
# (possibly rewritten) incoming URL
#
default_application = 'clientes' # ordinarily set in base routes.py
default_controller = 'clientes' # ordinarily set in app-specific routes.py
default_function = 'novo' # ordinarily set in app-specific routes.py
@goldenboy
goldenboy / install-web2py-pythonanywhere.sh
Created January 30, 2012 07:12
Bash script to install web2py on pythonanywhere.com (web2py.pythonanywhere.com)
cd ~
wget -O web2py_src.zip http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
echo "
PATH = '/home/"`whoami`"/web2py'
import os
import sys
sys.stdout = sys.stderr
os.chdir(PATH)
if not './' in sys.path[:1]: sys.path.insert(0,'./')
@goldenboy
goldenboy / web2py-pythonanywhere-wsgi.py
Created January 30, 2012 07:07
1 Minute install WEB2PY on PythonAnywhere
# source: web2py.pythonanywhere.com
# ---------------------------------
# web2py IDE and Hosting on PythonAnywhere.com
# 1 Minute install
#
# '/home/web2py' is my home dir and 'web2py' my username
# 'unzip web2py_src.zip' on home and I get
# path='/home/web2py/web2py'
# Now in path is 'web2py.py' and other source '.py' files
# EDIT file 'var/www/wsgi.py'
@goldenboy
goldenboy / microformats.py
Created December 8, 2011 20:57 — forked from k0001/microformats.py
Python microformats parser that supports hCard, hCalendar, hResume and rel-tag and provides an extensible model for other microformats.
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
Model for microformat properties and parsers. A microformat parser can
parse an HTML element into a dictionary of properties, whose keys are
strings and whose values are strings or other dictionary of properties.
As an example, the main program of this script parses an hResume from
given URL.
@goldenboy
goldenboy / google_hosts
Created December 3, 2011 10:06 — forked from agate/google_hosts
Hosts for google apps in China
203.208.46.166 www.google.com
203.208.46.166 www.google.com.hk
203.208.46.166 encrypted.google.com
203.208.46.166 encrypted.google.com.hk
203.208.46.166 mail.google.com
203.208.46.166 webcache.googleusercontent.com
203.208.46.166 plus.google.com
203.208.46.166 talkgadget.google.com
203.208.46.166 picasaweb.google.com
203.208.46.166 feedproxy.google.com
@goldenboy
goldenboy / configuration.yml
Created December 3, 2011 10:05 — forked from masom/configuration.yml
Email setup for google apps
production:
email_delivery:
delivery_method: :async_smtp
smtp_settings:
tls: true
enable_starttls_auto: true
address: "smtp.gmail.com"
port: '587'
domain: "smtp.gmail.com"
authentication: :plain
@goldenboy
goldenboy / gist:1426741
Created December 3, 2011 10:04 — forked from ion1/gist:344284
DNS records for Google Apps
@ MX 10 aspmx.l.google.com.
MX 20 alt1.aspmx.l.google.com.
MX 20 alt2.aspmx.l.google.com.
MX 30 aspmx2.googlemail.com.
MX 30 aspmx3.googlemail.com.
MX 30 aspmx4.googlemail.com.
MX 30 aspmx5.googlemail.com.
TXT "v=spf1 include:aspmx.googlemail.com ~all"
;
_xmpp-server._tcp SRV 5 0 5269 xmpp-server.l.google.com.
@goldenboy
goldenboy / google_login
Created December 3, 2011 10:03 — forked from dugger/google_login
Google Apps Login Link
<a href="https://www.myhaikuclass.com/do/openid/google?openid_identifier=your_google_domain.com" target='_blank'>
Sign In with your Google Apps Account
</a>
@goldenboy
goldenboy / rename_google_apps.py
Created December 3, 2011 09:58 — forked from colinramsay/rename_google_apps.py
Change the username of one or more Google Apps users in your domain
import gdata.apps.service
service = gdata.apps.service.AppsService(email="admin@mydomain", domain="mydomain.com", password="password")
service.ProgrammaticLogin()
names = {'from':'to'}
for current, change_to in names.iteritems():
user_entry = service.RetrieveUser(current)