Skip to content

Instantly share code, notes, and snippets.

{"title": "title from file",
"properties": {"prop1": {"title": "sub property title in base.json"},
"prop2": {"$ref": "#/properties/prop1"},
"prop3": {"$ref": "other.json"},
"prop4": {"$ref": "other.json#/properties/prop1"},
"prop5": {"$ref": "other.json#/properties/prop2"}
}
}
@kindly
kindly / test.json
Last active November 3, 2021 10:34
{"title": "title from url"}
import jsonlines
import flatterer
from pathlib import Path
import subprocess
def flatten_iterator(statement_type):
with jsonlines.open('statements.2021-08-31T08 14 34Z.jsonl') as f:
for object in f:
if object["statementType"] == statement_type:
yield object
##############################################################################
#
# Simple Python program to benchmark several Python Excel writing modules.
#
# python bench_excel_writers.py [num_rows] [num_cols]
#
# Copyright 2013-2018, John McNamara, Charlie Clark
#
import os
import sys
@kindly
kindly / csv_to_schema.py
Created May 18, 2021 10:09
CSV to JSON Schema
import csv
import click
import json
import json_merge_patch
@click.command()
@click.argument("file")
@click.option("-s", "--schema")
def csv_to_schema(file, schema=None):
SELECT *, pg_size_pretty(total_bytes) AS total
, pg_size_pretty(index_bytes) AS index
, pg_size_pretty(toast_bytes) AS toast
, pg_size_pretty(table_bytes) AS table
FROM (
SELECT *, total_bytes-index_bytes-coalesce(toast_bytes,0) AS table_bytes FROM (
SELECT c.oid,nspname AS table_schema, relname AS table_name
, c.reltuples AS row_estimate
, pg_total_relation_size(c.oid) AS total_bytes
GB-GOV-1 does not use capital-spend at activity hierarchy 1
GB-GOV-1 does not use budget\|planned-disbursement at activity hierarchy 1
@kindly
kindly / gist:9c6105b9489e21fd7548086e98816853
Last active January 7, 2019 12:44
asana gmail integration
var asana_api_key = 'personal_access_token'
var gmail_address = '[email protected]'
var asana_project = '922286080685111'
var asana_tag = '930213334200619'
var labels = {
"HIGH": 0,
This file has been truncated, but you can view the full file.
{
"uri": "http://d.com",
"publisher": {
"name": "dolore",
"scheme": "officia in",
"uri": "http://ptkQI.com",
"uid": "et Ut"
},
"publishedDate": "5044-06-01T16:44:16.284Z",
"releases": [
import sys
from lxml import etree
root = etree.parse(sys.argv[1])
actual_results = {}
for num, result in enumerate(list(root.iter("result"))):
title = num