Skip to content

Instantly share code, notes, and snippets.

"""ajaxgoogle.py - Simple bindings to the AJAX Google Search API
(Just the JSON-over-HTTP bit of it, nothing to do with AJAX per se)
http://code.google.com/apis/ajaxsearch/documentation/reference.html#_intro_fonje
brendan o'connor - gist.github.com/28405 - anyall.org"""
try:
import json
except ImportError:
import simplejson as json
import urllib, urllib2
@mvaz
mvaz / .gitattributes
Created December 1, 2009 11:35 — forked from program247365/.gitattributes
git configuration files for xcode projects
*.pbxproj -crlf -diff -merge
@mvaz
mvaz / x.js
Created March 19, 2010 14:47 — forked from anonymous/x.js
/*var noun_type_train_station_start = {
name: "Train station",
label: "station",
default: "Stuttgart Hbf",
};*/
var noun_type_train_station = {
name: "Train station",
label: "station",
default: "Stuttgart Hbf",
@mvaz
mvaz / .htaccess
Created March 19, 2010 15:11 — forked from leebyron/.htaccess
Redirect links to dropbox
Options +FollowSymlinks
RewriteEngine on
# No intersticial for direct reference and self-reference
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://box.leebyron.com/.*$ [NC]
# Add a line item for every website you don't need an intersticial for
# I've added my own website, gmail and facebook
RewriteCond %{HTTP_REFERER} !^http(s)?://([^\.]*.)?leebyron.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://mail.google.com/.*$ [NC]
@mvaz
mvaz / utils.py
Created July 4, 2012 09:40 — forked from zachwill/utils.py
Flask JSONP decorator
"""
Taken from: https://gist.github.com/1094140
"""
from functools import wraps
from flask import request, current_app
def jsonp(func):
"""Wraps JSONified output for JSONP requests."""
from __future__ import division
from pylab import *
# Sampling rate
fs = 128 # Hz
# Time is from 0 to 1 seconds, but leave off the endpoint, so that 1.0 seconds is the first sample of the *next* chunk
length = 1 # second
N = fs * length
t = linspace(0, length, num = N, endpoint = False)
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@mvaz
mvaz / run.py
Created January 9, 2014 08:28 — forked from codeinthehole/run.py
from celery import chain
from django.core.management.base import BaseCommand
from . import tasks
class Command(BaseCommand):
def handle(self, *args, **kwargs):
from pylab import *
from scipy.stats import *
num_adults = 227e6
basic_income = 7.25*40*50
labor_force = 154e6
disabled_adults = 21e6
current_wealth_transfers = 3369e9
def jk_rowling(num_non_workers):