Skip to content

Instantly share code, notes, and snippets.

import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { connectRouter, push, routerMiddleware } from 'connected-react-router';
import { createBrowserHistory } from 'history';
const history = createBrowserHistory({});
const createRootReducer = (browserHistory) => combineReducers({
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-11 13:36
from __future__ import unicode_literals
from django.db import migrations
from pontoon.base.models import TranslatedResource
def calculate_all_stats(apps, schema_editor):
# My version:
my_list = [
'hello',
'world',
+ 'what is up?',
]
# vs:
my_list = [
'hello',
SELECT COUNT(id)
FROM base_translation
WHERE approved = FALSE
AND fuzzy = FALSE
AND date < (
SELECT GREATEST(bt.date, bt.approved_date)
FROM base_translation bt
WHERE bt.approved = TRUE
AND bt.entity_id = base_translation.entity_id
AND bt.locale_id = base_translation.locale_id
@adngdb
adngdb / create_es_index.py
Created July 19, 2017 17:06
Create Elasticsearch index and print mapping
import json
from configman import Namespace
from configman.converters import class_converter
from socorro.app import generic_app
from socorro.external.es.super_search_fields import (
SuperSearchFields
)
@adngdb
adngdb / install.sh
Created September 15, 2016 02:52
A shell script to install a local Socorro dev environment
# Script config
WORKSPACE=~/mozilla/workspace
GITHUB_USER=adngdb
# Secrets
DATABASE_PASSWORD=
BOTO_SECRET_ACCESS_KEY=
BOTO_ACCESS_KEY=
# Requirements
@adngdb
adngdb / processed_crash_schema.json
Last active June 6, 2016 15:56
Socorro's Processed Crash Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "schema of a processed crash from Socorro",
"definitions": {
"frames": {
"type": "object",
"properties": {
"frame": {
"type": "integer",
import datetime
import elasticsearch
from elasticsearch import helpers
from socorrolib.lib.datetimeutil import utc_now
def dl_es_data(es_index, es_doctype, date):
"""Return all documents of an index.
import datetime
import requests
import time
def measure_supersearch(base_url):
today = datetime.datetime.utcnow().date()
two_months_ago = today - datetime.timedelta(weeks=8)
urls = (
release beta aurora nightly
---------- --------- ------- -------- ---------
2014-12-25 69952943 1738103 66862 45328
2014-12-26 79407038 2012413 75219 48960
2014-12-27 74701774 1957618 68368 47283
2014-12-28 73474760 1755038 67833 47795
2014-12-29 94104371 2334070 88696 54151
2014-12-30 90880260 2315405 87093 54051
2014-12-31 76797584 2135065 75351 48533
2015-01-01 69296349 1822021 65846 46986