Skip to content

Instantly share code, notes, and snippets.

View pascaldimassimo's full-sized avatar

Pascal Dimassimo pascaldimassimo

  • Montreal
  • 23:48 (UTC -04:00)
View GitHub Profile
@davidcrawford
davidcrawford / unzip.py
Created October 1, 2013 06:16
Python UnzipStream — A file-like wrapper around a gzipped stream that uncompresses as it reads.
import os
import zlib
from StringIO import StringIO
ESTIMATED_COMPRESSION_FACTOR = 2
class UnzipStream(object):
'''
@TimSin
TimSin / gist:6156670
Created August 5, 2013 15:09
Setting elasticsearch index and mapping settings using the java API
XContentBuilder settings = // ...create settings JSON object
XContentBuilder mapping = // ...build mapping JSON object
CreateIndexRequestBuilder irb = client.admin().indices().prepareCreate(INDEX_NAME);
irb.setSettings(settings);
irb.execute().actionGet();
PutMappingResponse response = client.admin().indices()
.preparePutMapping(INDEX_NAME).setType(TYPE_NAME)
@statico
statico / gist:3172711
Created July 24, 2012 21:15
How to use a PS3 controller on Mac OS X 10.7 (Lion)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.