Skip to content

Instantly share code, notes, and snippets.

View nezda's full-sized avatar
🤠
That’s good now double it again.

Luke Nezda nezda

🤠
That’s good now double it again.
View GitHub Profile
@nezda
nezda / unsqlalchemy.py
Last active December 2, 2022 16:23
expand sqla parameters from logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) back into sql
import sys
def main():
# assumes only command line arg is logging from
# logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
# for 1 query.
# assumes last line is dict of params
with open(sys.argv[1], 'r') as my_file:
lines = my_file.readlines()
@nezda
nezda / new_100mb_throttle_macduff_stats.json
Created September 26, 2016 14:31
"lex-macduff-2016-09-21t17:54:15.305481" this was a more typically slow ; yes, somewhat less docs because of an input variation but I don't think that explains delta
{
"_shards" : {
"total" : 30,
"successful" : 30,
"failed" : 0
},
"_all" : {
"primaries" : {
"docs" : {
"count" : 20982332,
@nezda
nezda / 100mb_throttle_macduff_stats.json
Created September 26, 2016 14:29
how was this so fast!? see "lex-macduff-2016-09-17t15:02:04.986962" "all"
{
"_shards" : {
"total" : 30,
"successful" : 30,
"failed" : 0
},
"_all" : {
"primaries" : {
"docs" : {
"count" : 18808988,
from bias import bias_after_setup; bias_after_setup(celery.conf); from lexdb.model.motion import dump_motions_for_case; from bias.models import LexSession; from lexdb.model import * ; import logging; logging.basicConfig(level=logging.DEBUG); from bias.tasks.annotate import *;
from lexdb.model.patent import recalculate
case_id=7550; pnum='6245648'
c = LexSession.query(Case).filter(Case.id == case_id).one()
pc = LexSession.query(PatentCitation).filter(PatentCitation.case_id == case_id).filter(PatentCitation.patent_number == pnum).all()
p = LexSession.query(Patent).filter(Patent.number == pnum).one()
recalculate(c, p, pc)
import argparse
from first import first
from deus_lib.scripts import initialize_script
from bias.models import (
LexSession,
)
from lexdb.model import (
PatentCitation,
DocketEntry,
MultipleDocument,
@nezda
nezda / index_name_fields_loader_test.sh
Last active August 29, 2015 14:13
Demonstrate that `store`'d fields with `index_name` in their mapping loaded using `fields` are returned in `hits` objects keyed by their `index_name` (e.g., "name_string", not "name" in this example).
#!/bin/sh
# Overall purpose of index_name usage here is to work around bug https://github.com/elasticsearch/elasticsearch/issues/5851
echo "Remove old index..."
curl -XDELETE "http://localhost:9200/fml?pretty=true"
echo "Make index and add some data..."
curl -XPOST "http://localhost:9200/fml/"
@nezda
nezda / query_cache_test.sh
Last active August 29, 2015 14:11
Agg query_cache not working with date filter
#!/bin/sh
echo "Remove old index..."
curl -XDELETE "http://localhost:9200/fml?pretty=true"
echo "Make index and add some data - default mappings are fine"
curl -XPOST "http://localhost:9200/fml/widget/?pretty=true" -d '
{
"name": "uno",
"postDate" : "2009-11-15"
@nezda
nezda / filter_term_agg_test.sh
Created August 15, 2014 18:15
Troubles porting an elasticsearch Terms Facet to a Terms Aggregation
#!/bin/sh
# Remove old data
curl -XDELETE "http://localhost:9200/fml?pretty=true"
# Add some data - default mappings are fine
curl -XPOST "http://localhost:9200/fml/widget/?pretty=true" -d '
{
"name": "uno",
"tags": [