Skip to content

Instantly share code, notes, and snippets.

View zain's full-sized avatar
💭
Livin' the dream.

Zain Memon zain

💭
Livin' the dream.
View GitHub Profile
python -c"import os,glob; print os.path.join('.', 'path/to/file') in sum([[f[0] for f in [glob.glob(os.path.join(d[0], pattern)) for d in os.walk('.')] if f] for pattern in open('.gitignore', 'r+').read().split('\n')], [])"
@zain
zain / gist:4291724
Created December 15, 2012 06:29 — forked from anonymous/gist:4291721
import re
import string
# find the first quote in a string
quotere = re.compile(
r"""(?P<quote>"[^\"\\]*(?:\\"|[^"])*") # Quote, possibly containing encoded
# quotation mark
\s*(?P<rest>.*)$ """,
re.VERBOSE)
@login_required
def linked_in(request):
REDIRECT_URI = 'http://127.0.0.1:8000/linkedin'
if 'clear' in request.GET:
del request.session['linkedin']
print "clear."
elif not 'linkedin' in request.session:
request.session['person'] = request.GET.get('person')
request.session['linkedin'] = 'authing'
params = urllib.urlencode({
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=471953.26..471953.38 rows=50 width=77) (actual time=2523.902..2524.063 rows=50 loops=1)
-> Sort (cost=471953.26..472037.42 rows=33664 width=77) (actual time=2523.898..2523.952 rows=50 loops=1)
Sort Key: (max(date))
Sort Method: top-N heapsort Memory: 36kB
-> GroupAggregate (cost=461030.36..470834.96 rows=33664 width=77) (actual time=2230.769..2520.320 rows=1681 loops=1)
Filter: bool_or(is_inbox)
-> Sort (cost=461030.36..461616.85 rows=234595 width=77) (actual time=1158.555..1430.159 rows=215157 loops=1)
Sort Key: thread_id
omgmail=# \d mail_email
Table "public.mail_email"
Column | Type | Modifiers
---------------------+--------------------------+-----------
id | uuid | not null
account_id | integer | not null
last_update | timestamp with time zone | not null
uid | bigint |
gm_msg_id | bigint | not null
thread_id | bigint | not null
[
{
"emails": [
{
"bcc": [],
"cc": [],
"date": "2013-04-03T20:46:12",
"sender": {
"address": "[email protected]",
"name": "Gmail Team"
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'price');
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
# i added this test
def test_int_add_ovf_commutative(self):
ops = """
[i0, i1]
i2 = int_add_ovf(i0, i1)
i3 = int_add_ovf(i1, i0)
jump(i2, i3)
"""
expected = """
[i0, i1]
@zain
zain / gist:7191259
Last active December 26, 2015 17:59
{
"name":"Shopify",
"pricing_tiers":[
{
"price":"29",
"period":"month",
"features":{
"disabled":[
"Abandoned cart recovery",
"Professional reports",