This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import urllib | |
import time | |
import hmac | |
import random | |
import base64 | |
from hashlib import sha1 | |
import string | |
import pymongo | |
import urlparse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style type="text/css"> | |
/* Reset | |
--------------------------------------------------------------------------------------- */ | |
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, | |
del, dfn, font, img, ins, kbd, q, s, samp, small, strong, em, strike, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, | |
table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-weight: normal; font-style: normal; font-size: 100%; font-family: inherit; vertical-align: baseline; list-style-type: none;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Add permissions for proxy model. | |
This is needed because of the bug https://code.djangoproject.com/ticket/11154 | |
in Django (as of 1.6, it's not fixed). | |
When a permission is created for a proxy model, it actually creates if for it's | |
base model app_label (eg: for "article" instead of "about", for the About proxy | |
model). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
from BeautifulSoup import BeautifulSoup | |
from mechanize import Browser | |
import re | |
def getunicode(soup): | |
body='' | |
if isinstance(soup, unicode): | |
soup = soup.replace("'","'") | |
soup = soup.replace('"','"') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import load_iris | |
from sklearn import tree | |
from sklearn.externals.six import StringIO | |
import os | |
import pydot | |
import csv | |
import re | |
class LoadData(): | |
def __init__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CPCommonQuerySet(QuerySet, CPCommonMixin): | |
def _filter_or_exclude(self, negate, *args, **kwargs): | |
cust_lookups = [] | |
if kwargs.items(): | |
if kwargs.items()[0][0].endswith('__false'): | |
negate = True | |
cust_lookups = filter(lambda s: s[0].endswith('__false'), kwargs.items()) | |
elif kwargs.items()[0][0].endswith('__true'): | |
negate = False | |
cust_lookups = filter(lambda s: s[0].endswith('__true'), kwargs.items()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
AUTHOR - Vinay Chittora | |
This api is written under pygeocoder | |
Google Maps api-v3 | |
INSTALLATION | |
------------------------------------------------------ | |
$ pip install pygeocoder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.exceptions import PermissionDenied | |
from django.http import HttpResponse, HttpResponseRedirect | |
from pyExcelerator import * | |
from django.contrib.admin.util import lookup_field | |
from django.utils.html import strip_tags | |
from django.contrib import messages | |
def export_as_xls(modeladmin, request, queryset): | |
""" |