Skip to content

Instantly share code, notes, and snippets.

// Scraping Made Easy with jQuery and SelectorGadget
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga)
// by David Trejo
//
// Install node.js and npm:
// http://joyeur.com/2010/12/10/installing-node-and-npm/
// Then run
// npm install jsdom jquery http-agent
// node numresults.js
//
#!/bin/bash
# To run do: curl https://theurl.com/bootstrap.sh | bash && source ~/.profile
#
# Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
# This script must install the following requirements
# * apache2
# * mod_wsgi
# * mysql
# * pip
#!/bin/bash
# To run do:
# wget http://url.com/bootstrap.sh && chmod +x bootstrap.sh && ./bootstrap.sh && source ~/.profile
#
# Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
# This script will:
# * install/config apache2
# * install mod_wsgi
# * install/config nginx
#!/bin/bash
# To run do:
# wget https://gist.github.com/raw/850359/ea02e22f021b7ebf2f602811461677ab4a3f2a9e/bootstrap.sh && chmod +x bootstrap.sh && ./bootstrap.sh && source ~/.profile
#
# Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
# This script will:
# * install/config apache2
# * install mod_wsgi
# * install/config nginx
@jpadilla
jpadilla / gist:1175941
Created August 27, 2011 22:24 — forked from saikat/gist:1084146
Stripe sample checkout form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
@jpadilla
jpadilla / json-response.py
Created October 6, 2011 17:57 — forked from leah/json-response.py
JSONResponse classes
import re
import simplejson
from django.http import HttpResponse
from django.conf import settings
class JSONResponse(HttpResponse):
def __init__(self, request, data):
indent = 2 if settings.DEBUG else None
@jpadilla
jpadilla / cee_rob1.py
Created November 13, 2012 11:19
7 lines, no external requirements (7 lines, 28 words, 605 chars)
import urllib2
import lxml.etree as E
import time
print '\nGOVERNOR\nISLAND WIDE RESULTS\n'
while 1:
print '\n'.join(['%s\n'%E.fromstring(urllib2.urlopen('http://is.gd/wB6SJq').read()).find('date').text,'\n'.join(map(lambda e:'%s (%s) => %s (%s%%)'%e,[(o.find('name/es').text,o.find('pe/es').text,format(int(o.find('votes').text),',d'),str(float(o.find('votes').text)/sum([int(e.text)for e in E.fromstring(urllib2.urlopen('http://is.gd/wB6SJq').read()).findall('option/votes')])*100)[0:5])for o in E.fromstring(urllib2.urlopen('http://is.gd/wB6SJq').read()).findall('option')]))])
time.sleep(120)
"""
A simple script to copy a Basecamp classic todo list
over to Blimp as a goal with tasks
@author: Dave Jeffery
@requirements:
pip install git+git://github.com/nowherefarm/basecamp.git
pip install blimp
"""
# encoding=utf-8
import sys
import datetime
import email
import mimetypes
import os
import time
import gzip
import subprocess
@jpadilla
jpadilla / qurl.py
Created July 25, 2013 16:40 — forked from pricco/qurl.py
"""
qurl is a tag to append, remove or replace query string parameters from an url
https://gist.github.com/pricco/3714115
"""
import re
from django.template import Library, Node, TemplateSyntaxError
from urlparse import urlparse, parse_qsl, urlunparse
from django.utils.encoding import smart_str
from urllib import urlencode