Skip to content

Instantly share code, notes, and snippets.

View cheekybastard's full-sized avatar

cheekybastard

View GitHub Profile
Uniregistry, Corp. 9 ['COUNTRY', 'CHRISTMAS', 'PICS', 'PHOTO', 'GIFT', 'LINK', 'GUITARS', 'SEXY', 'TATTOO']
Afilias Limited 8 ['BLACK', 'MEET', '\xe7\xa7\xbb\xe5\x8a\xa8 (xn--6frz82g) \xe2\x80\x93 Chinese for "mobile"', 'BLUE', 'KIM', 'PINK', 'RED', 'SHIKSHA']
United TLD Holdco Ltd. 7 ['DEMOCRAT', 'SOCIAL', 'MODA', 'DANCE', 'IMMOBILIEN', 'KAUFEN', 'NINJA']
United TLD Holdco, Ltd. 7 ['ROCKS', 'CONSULTING', 'HAUS', 'PUB', 'ACTOR', 'REVIEWS', 'FUTBOL']
Top Level Domain Holdings Limited 6 ['VODKA', 'COOKING', 'RODEO', 'HORSE', 'FISHING', 'MIAMI']
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/test
curl -X PUT localhost:9200/test -d '
{
"settings" : {
"index" : {
"analysis" : {
import time
class PageCategoryFilter(object):
def __init__(self, config):
self.mode = config["mode"]
self.categories = config["categories"]
def filter(self, bid_request):
if self.mode == "whitelist":
@jonathanmorgan
jonathanmorgan / queryset_iterators.py
Created May 6, 2011 05:40 — forked from dbrgn/queryset_generators.py
queryset_generator and queryset_list_generator
'''
queryset_generator and queryset_list_generator based on:
https://gist.github.com/897894
'''
#===============================================================================
# imports (in alphabetical order by package, then by name)
#===============================================================================
# python standard libraries
@mlissner
mlissner / queryset_generators.py
Created March 10, 2012 04:13 — forked from dbrgn/queryset_generators.py
Adds a date-based queryset generator
from datetime import datetime
from datetime import timedelta
def queryset_generator(queryset, chunksize=1000):
"""
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in its
memory at the same time while django normally would load all rows in its
memory. Using the iterator() method only causes it to not preload all the
@dbrgn
dbrgn / queryset_generators.py
Created April 1, 2011 08:41
queryset_generator and queryset_list_generator
def queryset_generator(queryset, chunksize=1000):
"""
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in its
memory at the same time while django normally would load all rows in its
memory. Using the iterator() method only causes it to not preload all the
classes.
Note that the implementation of the generator does not support ordered query sets.
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
import selenium.webdriver.support.wait
selenium.webdriver.support.wait.POLL_FREQUENCY = 0.05
import re
import random
import collections
class AdwordsAutomater(object):
class Partner(models.Model):
"""
New partner class.
Note: 'name' and 'users' are dropped from Oscar's partner model.
"""
user = models.OneToOneField('auth.User')
def __unicode__(self):
return u'%s: %s' % (_('Fulfillment Partner'),
@mattweber
mattweber / README
Last active December 13, 2015 22:19
Using ElasticSearch To Find The Best Time To Ask Questions on StackOverflow
Use extractDocs.py to parse and index the StackOverflow posts.xml file into an existing index.
Usage: extractDocs.py [options] file
Options:
-h, --help show this help message and exit
-s SERVER, --server=SERVER
ElasticSearch Server
-i INDEX, --index=INDEX
Index name to use
{
"title": "Tweets Search",
"rows": [
{
"title": "Options",
"height": "50px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [