Skip to content

Instantly share code, notes, and snippets.

@brizzbane
brizzbane / gist:5d275c46122cfa53cb8c
Last active August 29, 2015 14:12
phantomjs/ghostdriver session test
from selenium import webdriver
proxylist = ['127.0.0.1','127.0.0.2']
a = {}
for proxy in proxylist:
a[proxy] = webdriver.PhantomJS(executable_path='C:\Python27\selenium\phantomjs.exe',service_args=['--proxy=' + proxy + ':3128', '--proxy-type=http'])
a[proxy].set_window_size(1120, 550)
a[proxy].get("http://whatismyipaddress.com")
a[proxy].save_screenshot(proxy + '.png') #will always end up displaying 127.0.0.1 in screenshot, while creating both 127.0.0.1.png, and 127.0.0.2.png
print a[proxy].current_url
@brizzbane
brizzbane / gist:276c7a54fe8e82cc516d
Created March 28, 2015 20:33
elasticsearch not indexing value
{
"socialnetwork:{
"properties":{
"found":{
"type":"boolean"
},
"member":{
"properties":{
"member_id":{
"type":"long"
from Celery import Celery
app = Celery('tasks', broker='amqp://guest@localhost//', backend='amqp')
app.conf.CELERY_RESULT_BACKEND = 'amqp'
app.conf.CELERYD_LOG_COLOR = True
from elasticsearch_dsl import DocType
class Account(DocType):
@brizzbane
brizzbane / gist:56dc3043d8ca0f0ec177
Last active August 29, 2015 14:26
serialization issue
__author__ = 'brizzbane'
from elasticsearch_dsl import DocType
from copy import deepcopy
from elasticsearch import Elasticsearch
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=['localhost'])
client = Elasticsearch()
class EmailDomain(DocType):
@brizzbane
brizzbane / gist:7369f539929b1fa239ef
Created August 3, 2015 20:21
serialization problems 2
__author__ = 'brizzbane'
from elasticsearch_dsl import DocType
from copy import deepcopy
from elasticsearch import Elasticsearch
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=['localhost'])
client = Elasticsearch()
class EmailDomain(DocType):
__author__ = 'brizzbane'
from elasticsearch_dsl import DocType
from copy import deepcopy
from elasticsearch import Elasticsearch
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=['localhost'])
client = Elasticsearch()
class EmailDomain(DocType):
__author__ = 'brizzbane'
#for some reason, 'hello world' is only displayed some of the time (i.e. doing python thisfile.py producer 5 times, 'hello world' may only be printed 3
import logging
from mtm.v2.core.log import configure_logging
configure_logging()
import sys
from kombu import Exchange, Queue
from kombu.mixins import ConsumerMixin
import logging
import time
import pyuv
import gruvi
import pycurl
from io import BytesIO
from gruvi.futures import Future
https://www.digitalocean.com/community/tutorials/how-to-install-go-on-debian-8
https://stackoverflow.com/questions/25216765/gobin-not-set-cannot-run-go-install
set -xg GOROOT /usr/local/go $GOROOT
set -xg GOPATH $HOME/Develop
set -xg PATH /usr/local/go/bin $GOPATH/bin $PATH
# RFC 2822 - style email validation for Python
# (c) 2012 Syrus Akbary <me@syrusakbary.com>
# Extended from (c) 2011 Noel Bush <noel@aitools.org>
# for support of mx and user check
# This code is made available to you under the GNU LGPL v3.
#
# This module provides a single method, valid_email_address(),
# which returns True or False to indicate whether a given address
# is valid according to the 'addr-spec' part of the specification
# given in RFC 2822. Ideally, we would like to find this