Skip to content

Instantly share code, notes, and snippets.

View andrewgross's full-sized avatar

Andrew Gross andrewgross

View GitHub Profile
Multiple vulnerabilities have been discovered in the PHP language:
thoger at redhat dot com discovered that paths containing a NUL
character were improperly handled, thus allowing an attacker to
manipulate unexpected files on the server.
andrewgross / gist:8922636
Last active August 29, 2015 13:56 using requests.
import copy
import datetime
import itertools
import logging
import os
import re
import socket
import subprocess
import threading
import urllib2
def _parse_block_device_mappings(user_input):
Parse block device mappings per AWS CLI tools syntax (modified to add IOPS)
/dev/xvd[a-z]=[snapshot-id|ephemeral]:[size in GB]:[Delete on Term]:[IOPS]
- Leave inapplicable fields blank
- Delete on Termination defaults to True
andrewgross / gist:9261189
Created February 27, 2014 22:41
Suble AWS API Trolling
# Describe Launch Config formatting
andrewgross / gist:11183809
Created April 22, 2014 15:33
Whos the dumbest GoT character
This isn't even close. Catelyn Stark.
Did she make a single good decision during her lifespan? She chased away Jon Snow when another strong male would have been a huge asset. She went to pieces when Bran fell, and left the family in the hands of an inexperienced teenager. She convinced Ned to trust Littlefinger, which got him killed. She captured Tyrion, which started a war and made Sansa into a hostage. She didn't convince her teenaged son that marrying his new girlfriend was a horrible idea, which got all of them killed. She betrayed her own son.
This is a woman who claimed to care about her family more than anything, but managed to get almost the entire clan killed in under three years.
Cersei isn't a rocket scientist, and Viserys was an idiot, but he got himself killed before he could do much damage to anyone else. Joffrey wasn't stupid, he was batshit insane.
deploy_cookbook ()
if [ $# -ne $EXPECTED_ARGS ]; then
echo 'Usage: deploy_cookbook ${ENV} ${COOKBOOK}';

I was curious if there were any plans to update or modify the JSON query API in ES 2.0+?

While I find the API to very powerful, it is confusing to construct a valid request and requires special casing a lot of rules. I have some thoughts below on what I see as the current issues, and some suggestions to correct them. I don't intend for this to be a rant, just to provoke discussion. This is done purely from the point of view of constructing queries (not parsing them), and only for the JSON DSL query syntax for searching (not percolate or aggregators).

It is currently hard to construct small parts of a JSON query without knowing all of the elements involved. Looking at a simple query and a filtered query:

Simple Query:

andrewgross /
Last active August 29, 2015 14:07
import boto.ec2
ec2_conn = boto.ec2.connect_to_region('us-east-1')
def check_events():
statuses = ec2_conn.get_all_instance_status(filters={"event.description": "Scheduled reboot"})
for status in statuses:
for event in
print "{}: {}".format(, event.description)
<DescribeSecurityGroupsResponse xmlns="">
<groupDescription>Web Servers</groupDescription>
"DescribeSecurityGroupsResponse": {
"-xmlns": "",
"requestId": "59dbff89-35bd-4eac-99ed-be587EXAMPLE",
"securityGroupInfo": {
"item": [
"ownerId": "111122223333",
"groupId": "sg-1a2b3c4d",
"groupName": "WebServers",