Skip to content

Instantly share code, notes, and snippets.

View jpmckinney's full-sized avatar

James McKinney jpmckinney

View GitHub Profile
.xbox .abxy,.xbox .arrows,.xbox .bumpers,.xbox .button,.xbox .dpad,.xbox .face,.xbox .quadrant,.xbox .stick,.xbox .sticks,.xbox .triggers{position:absolute}.controller.xbox{background:url(https://imgur.com/eWlI7VE.png);height:630px;width:750px}.xbox.white{background:url(https://imgur.com/dC9NkhO.png)}.xbox.disconnected{background:url(https://imgur.com/1i0fvvM.png)}.xbox.disconnected div{display:none}.xbox .triggers{width:427px;height:121px;left:160px;top:-8px}.xbox .trigger{width:88px;height:121px;background:url(https://imgur.com/yB8ABy5.png);opacity:0}.xbox .trigger.left{float:left;background-position:0 0}.xbox .trigger.right{float:right;left:8px;transform:rotateY(180deg)}.xbox .bumper{width:170px;height:61px;background:url(https://imgur.com/lr9lHUc.png);opacity:0}.xbox .bumpers{width:528px;height:61px;left:110px;top:113px}.xbox .back.pressed,.xbox .bumper.pressed,.xbox .face.pressed,.xbox .start.pressed{opacity:1}.xbox .back,.xbox .bumper.left{float:left}.xbox .bumper.right{float:right;-webkit-transform:rot
@jpmckinney
jpmckinney / extension.json
Last active July 7, 2023 05:34
lib-cove-ocds test fixture: Unresolvable JSON reference
{}
@jpmckinney
jpmckinney / extension.json
Created July 7, 2023 01:26
lib-cove-ocds test fixture: invalid metadata file
,
@jpmckinney
jpmckinney / release-schema.json
Last active July 7, 2023 01:26
lib-cove-ocds test fixture: no metadata file
{}
@jpmckinney
jpmckinney / fix_invalid_json.py
Last active May 10, 2021 18:53
Fixes errors in invalid JSON. Running time is (length of input) x (number of errors).
#!/usr/bin/env python
import json
import sys
def run(filename):
with open(filename) as f:
s = f.read()
# This code will re-read the file from the beginning after fixing each error, which is slow. A better solution
@jpmckinney
jpmckinney / flaticon_to_iso2.py
Last active December 2, 2021 00:11
Renames flags from Flaticon to use ISO 3166-1 alpha 2 codes.
import os
import sys
from hdx.location.country import Country
# https://www.flaticon.com/packs/rectangular-country-simple-flags?word=flags
FLAG_PATH = 'path/to/flaticon/folder'
excluded = {
# Non-ISO states with limited recognition
import json
import os
import re
import sys
from textwrap import dedent
tables_replacements = {
'```eval_rst': '',
'```': '',
}
@jpmckinney
jpmckinney / pelican_check_export.py
Last active April 26, 2021 16:54
Exports the descriptions of data quality checks from Pelican.
# Generates:
# https://docs.google.com/document/d/1l5SL1hUR9n8IDYVLSYsU85hdB3L_u2e3iD-txQPc0zU/edit
# https://docs.google.com/spreadsheets/d/1WPPOSf7xM9LR3VlTGx7wyzc8q_5xQ3HyMoB8eaEWHDM/edit#gid=0
# Gist: https://gist.github.com/jpmckinney/f3bdbb62620a9974ba1ff254392f6b6d
# GitHub: https://github.com/open-contracting/pelican/issues/63
# CRM: https://crm.open-contracting.org/issues/5908
import csv
import json
@jpmckinney
jpmckinney / README.md
Last active November 30, 2019 05:16
Compare differences after making changes to Sphinx

Written as part of open-contracting/standard_profile_template#33

curl -O https://gist.githubusercontent.com/jpmckinney/ba38d531e245c175e254ea3bc4218001/raw/bbb015f613ba936b3b42f25c576e833d196e5181/diff-reduce.py
python diff-reduce.py
diff -rq build t | grep Only | sort
diff -ru -x '*.js' -x '.buildinfo' -x '_sources' build t | less
{
"tender": {
"title": "Adquisición de Útiles de Oficina",
"id": "355477-adquisicion-utiles-oficina",
"procuringEntity": {
"id": "50",
"name": "Dirección Nacional de Contrataciones Públicas (DNCP)"
},
"procurementMethod": "open",
"procurementMethodDetails": "Licitación Pública Nacional",