Skip to content

Instantly share code, notes, and snippets.

View challenge.md

find the type of these expressions!
  expression
response["timed_out"]
response["hits"]
response["hits"]["total"]
response["hits"]["hits"]
response["hits"]["hits"][0]
response["hits"]["hits"][0]["_score"]
View health.json
{
"cluster_name": "elasticsearch",
"status": "yellow",
"timed_out": false,
"number_of_nodes": 1,
"number_of_data_nodes": 1,
"active_primary_shards": 5,
"active_shards": 5,
"relocating_shards": 0,
"initializing_shards": 0,
View common.py
'common, fun python functions that I seem to rewrite everywhere'
import itertools, sys
# stolen from itertools recipes
def chunk(iterable, batch_size, fillvalue=None):
'breaks up iterator into chunks of batch_size'
args = [iter(iterable)] * batch_size
return itertools.izip_longest(fillvalue=fillvalue, *args)
View keybase.md

Keybase proof

I hereby claim:

  • I am alexclare on github.
  • I am alexclare (https://keybase.io/alexclare) on keybase.
  • I have a public key whose fingerprint is 9E69 7FA4 8069 CACE 2E84 C381 A706 3F10 D905 E5D4

To claim this, I am signing this object:

@alexclare
alexclare / gist:3410169
Created Aug 21, 2012
Hacky IRCCloud ping script
View gist:3410169
import json, pycurl, subprocess, urllib, urllib2
def session_cookie(email, pw):
'''Small helper to grab the session ID if necessary.
You don't need to do this often; session IDs don't expire frequently.
'''
req = urllib2.Request(
url='https://irccloud.com/chat/login',
data=urllib.urlencode([('email', email), ('password', pw)]))
res = urllib2.urlopen(req)