Skip to content

Instantly share code, notes, and snippets.

@adngdb
adngdb / service.py
Created December 28, 2011 21:49
Generic Socorro Service
class Service(JsonWebServiceBase):
"""
Base class for new-style REST API services.
Provide methods for arguments parsing and implementation finding.
"""
def __init__(self, uri):
@adngdb
adngdb / config-in-deps.py
Created January 11, 2012 16:49
ConfigMan dependency solving
"""Example app to understand how ConfigMan can find all the configuration keys
an application needs. """
from configman import ConfigurationManager, Namespace, RequiredConfig
from configman.converters import class_converter
class A(RequiredConfig):
"""Example class that can execute an action an has some required config."""
required_config = Namespace()
@adngdb
adngdb / gist:4708381
Created February 4, 2013 18:05
elasticsearch challenge!
"""
elasticsearch challenge!
From this data set:
{
'name': 'Adrian',
'sex': 'male',
'age': 'young'
},
@adngdb
adngdb / DCL.py
Last active December 15, 2015 22:50
import base64
import libtorrent as lt
import os
import shutil
import thread
import time
import tkFont
import urllib2
from bs4 import BeautifulSoup
from Tkinter import *
@adngdb
adngdb / generate-master-list.py
Created May 20, 2014 15:55
Generate master list of fields for Super Search
import copy
import json
PARAM_TO_FIELD_MAPPING = {
# Processed crash keys.
'build_id': 'build',
'date': 'date_processed',
'platform': 'os_name',
'platform_version': 'os_version',
@adngdb
adngdb / dxva.py
Created February 25, 2015 14:12
Classify crashes running DXVA
import datetime
import os
import requests
def look_for_module(dump, module, count_mode=False):
count = 0
for thread in dump['threads']:
for frame in thread['frames']:
#! /usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""This app inserts a set of fake crash reports into elasticsearch, based
on date parameters.
This app can be invoked like this:
.../scripts/populate_elasticsearch_app.py --help
from socorro.external.es.supersearch import SuperSearch
def get_uuids(config):
api = SuperSearch(config=config)
params = {
'signature': '=my_sig', # signature is exactly "my_sig"
'_columns': ['uuid'],
'_results_number': 100,
'_results_offset': 0,
}
@adngdb
adngdb / config
Last active August 29, 2015 14:27
2015-08-19 20:26:33,215 INFO - middleware - - MainThread - resource.fs.dump_field: upload_file_minidump
2015-08-19 20:26:33,216 INFO - middleware - - MainThread - resource.fs.dump_file_suffix: .dump
2015-08-19 20:26:33,216 INFO - middleware - - MainThread - resource.fs.fs_root: ./crashes
2015-08-19 20:26:33,216 INFO - middleware - - MainThread - resource.fs.json_file_suffix: .json
2015-08-19 20:26:33,216 INFO - middleware - - MainThread - resource.fs.jsonz_file_suffix: .jsonz
2015-08-19 20:26:33,216 INFO - middleware - - MainThread - resource.fs.name_branch_base: name
2015-08-19 20:26:33,216 INFO - middleware - - MainThread - resource.fs.umask: 18
@adngdb
adngdb / oom_signatures.py
Created September 17, 2015 16:28
Signatures with less than 300M of available memory
import requests
def main():
url = 'https://crash-stats.mozilla.com/api/SuperSearch/'
params = {
'product': 'Firefox',
'_aggs.signature': [
'_histogram.available_physical_memory',
'_histogram.available_virtual_memory',