Skip to content

Instantly share code, notes, and snippets.

@alfetopito
alfetopito / gist:2225687
Created March 28, 2012 12:07
Celery eventlet tryout
import eventlet
import tasks
#from json import dump, load
from django.conf import settings
from glob import glob
json = eventlet.import_patched('json')
eventlet.monkey_patch()
poll = eventlet.GreenPool()
@alfetopito
alfetopito / gist:2286575
Created April 2, 2012 19:30
Celery eventlet tryout 2
import eventlet
import tasks
json = eventlet.import_patched('json')
from eventlet.queue import LightQueue
from time import sleep
eventlet.monkey_patch()
def processTask(cfgFile):
print ("Processing stuff here")
@alfetopito
alfetopito / gist:3170803
Created July 24, 2012 15:48
ElasticSearch Mappings and Analyzer
# Mappings
curl -XGET 'http://localhost:9200/tokens,keywords/_mapping?pretty=true'
{
"keywords" : {
"pt_BR" : {
"properties" : {
"keyword" : {
"type" : "string",
"boost" : 10.0,
"analyzer" : "keyword",
curl -XGET 'http://localhost:9200/keywords/pt_BR/_search?pretty=true' -d '
{
"query": {
"fuzzy": {
"keyword": {
"value": "hoteis sao paulo",
"prefix_length": 0,
"min_similarity": 0.6
}
}
curl -XGET 'http://localhost:9200/keywords/pt_BR/_search?pretty=true' -d '
{
"query": {
"fuzzy": {
"keyword": {
"value": "cartões bradesco",
"prefix_length": 0,
"min_similarity": 0.6
}
}
# using fuzzy_like_this_field query
curl -XGET 'http://localhost:9200/tokens/pt_BR/_search?pretty=true' -d '
{
"query": {
"fuzzy_like_this_field": {
"pt_BR.keyword": {
"like_text": "cartões bradesco",
"prefix_length": 1,
"min_similarity": 0.7
}
@alfetopito
alfetopito / DNS Vivo SP
Created November 27, 2014 22:50
DNS Vivo SP
primary dns 200.204.0.10
secondary dns 200.204.0.138
Wordlist ver 0.732 - EXPECT INCOMPATIBLE CHANGES;
acrobat africa alaska albert albino album
alcohol alex alpha amadeus amanda amazon
america analog animal antenna antonio apollo
april aroma artist aspirin athlete atlas
banana bandit banjo bikini bingo bonus
camera canada carbon casino catalog cinema
citizen cobra comet compact complex context
credit critic crystal culture david delta
dialog diploma doctor domino dragon drama
+ parse_args git-receive-pack ''\''myapp'\'''
+ for arg in '"$@"'
+ case "$arg" in
+ for arg in '"$@"'
+ case "$arg" in
+ return 0
+ for arg in '"$@"'
+ [[ git-receive-pack =~ ^--.* ]]
+ for arg in '"$@"'
+ [[ 'myapp' =~ ^--.* ]]
+ parse_args git-receive-pack ''\''myapp'\'''
+ for arg in '"$@"'
+ case "$arg" in
+ for arg in '"$@"'
+ case "$arg" in
+ return 0
+ for arg in '"$@"'
+ [[ git-receive-pack =~ ^--.* ]]
+ for arg in '"$@"'
+ [[ 'myapp' =~ ^--.* ]]