Skip to content

Instantly share code, notes, and snippets.

View traut's full-sized avatar

Sergey Polzunov traut

View GitHub Profile
import uuid
# http://marshmallow.readthedocs.org/en/latest/
from marshmallow import Schema, fields
STATUS_TYPES = [
'ASYNCHRONOUS_POLL_ERROR', 'BAD_MESSAGE', 'DENIED',
'DESTINATION_COLLECTION_ERROR', 'FAILURE', 'INVALID_RESPONSE_PART',
'NETWORK_ERROR', 'NOT_FOUND', 'PENDING', 'POLLING_UNSUPPORTED',
'RETRY', 'SUCCESS', 'UNAUTHORIZED', 'UNSUPPORTED_MESSAGE',
@traut
traut / flow.py
Last active August 29, 2015 14:19
Files needed to reproduce Celery issue
from __future__ import print_function
import pprint
import time
from celery import group, chain, chord
import simple_tasks as t
workflow = chain(
@traut
traut / flow.py
Created April 22, 2015 16:52
Code needed to reproduce Celery Exchange issue
from __future__ import print_function
import pprint
import time
from celery import group, chain, chord
import simple_tasks as t
tasks = [
@traut
traut / flow.py
Created April 22, 2015 16:55
Code needed to reproduce Celery Exchange issue
from __future__ import print_function
import pprint
import time
from celery import group, chain, chord
import simple_tasks as t
tasks = [
#! /usr/bin/env python
data = '''
9235
9096 637
973 3269 7039
3399 3350 4788 7546
1739 8032 9427 976 2476
703 9642 4232 1890 704 6463
9601 1921 5655 1119 3115 5920 1808
it's escaping Solr query characters.
Example:
var s = solr.escape('it's 11:00 -- do you know where your children are?")
var query = "+title:" + s;
and this works fine:
> A search for "+description:it's 11\:00 \-\- do you know where your children" returned 0 documents.
var s = solr.escape('it's 11:00 -- do you know where your children are?")
var query = "+title:" + s;
and this works fine:
> A search for "+title:it's 11\:00 \-\- do you know where your children are\?" returned 0 documents.
1.
// before
http://localhost:8983/solr/select?facet.field[]=line1_ua&facet.field[]=line2_ua&facet.field[]=line3_ua&facet.field[]=line4_ua&facet=true&sort=with_picture+desc&fl=ean&facet_limit=20&q=%2Bstore_id:123+&facet_mincount=1&wt=json&rows=100
// after
http://localhost:8983/solr/select?facet.field=line1_ua&facet.field=line2_ua&facet.field=line3_ua&facet.field=line4_ua&facet=true&sort=with_picture+desc&fl=ean&facet_limit=20&q=%2Bstore_id:123+&facet_mincount=1&wt=json&rows=100
2.
// before
var compress = require('./lib/compress');
var sys = require('sys');
exports.gzip = function(request, response, result) {
var encoding = 'gzip';
if ((request.headers['accept-encoding'] || '').indexOf(encoding) >= 0) {
var contentType = result.headers["Content-Type"];
contentType = contentType && contentType.split("/")[0];
if (!result.headers['Content-Encoding'] && // skip if already encoded
result.status != 204 && // of if no body

Keybase proof

I hereby claim:

  • I am traut on github.
  • I am polzunov (https://keybase.io/polzunov) on keybase.
  • I have a public key whose fingerprint is 2F53 7696 D6CD 16F8 C8F4 B38E A8AB CDF2 8860 05CE

To claim this, I am signing this object: