Skip to content

Instantly share code, notes, and snippets.

@Bjwebb
Bjwebb / badfile.json
Last active May 6, 2020
Generate 340MB of invalid OCDS data by repeating a single bad release
View badfile.json
{
"uri": "tmXf6cC4QU+lwO3O73T-ZvUX4qo2GMJ0Sd",
"publisher": {
"name": "ducimus recusandae"
},
"publishedDate": "4440-04-11T01:58:02.871Z",
"releases": [
{
"ocid": "et et tempora eos est",
"id": "facere",
View gh_branch_protection_info.py
import os
import json
import requests
repos = requests.get('https://api.github.com/orgs/OpenDataServices/repos?per_page=200').json()
for repo in repos:
protection = requests.get(
"https://api.github.com/repos/OpenDataServices/{}/branches/master/protection".format(repo["name"]),
headers={"Authorization": "token {}".format(os.environ["GH_TOKEN"])},
View records_invalid_releases_less_fuzzing.json
{
"uri": "http://example.org/invalid_record.json",
"version": "1.1",
"publishedDate": "2019-09-18T17:56:21.078Z",
"publisher": {
"name": "A Publisher Name"
},
"records": [
{
"ocid": "EXAMPLE-0",
@Bjwebb
Bjwebb / schema_properties.py
Last active Feb 15, 2019
List the schema level properties used in a JSON schema
View schema_properties.py
import os
import json
import jsonref
# From libcove/lib/common.py
class CustomJsonrefLoader(jsonref.JsonLoader):
'''This ref loader is only for use with the jsonref library
and NOT jsonschema.'''
def get_remote_json(self, uri, **kwargs):
View decimal_percentage.xml
<?xml version='1.0' encoding='UTF-8'?>
<!--This is example XML for the IATI activity standard. No reference to actual data, real organisations or development cooperation models is intended.-->
<!--iati-activities starts-->
<iati-activities generated-datetime="2014-09-10T07:15:37Z" version="2.03" linked-data-default="http://data.example.org/">
<!--iati-activity starts-->
<iati-activity xml:lang="en" default-currency="USD" last-updated-datetime="2014-09-10T07:15:37Z" humanitarian="1" linked-data-uri="http://data.example.org/123456789" hierarchy="1" budget-not-provided="1">
<!--iati-identifier starts-->
View iati_organisation_cove_template.csv
@last-updated-datetime @default-currency organisation-identifier name/narrative reporting-org/@ref reporting-org/@type reporting-org/@secondary-reporter reporting-org/narrative total-budget/0/@status total-budget/0/period-start/@iso-date total-budget/0/period-end/@iso-date total-budget/0/value total-budget/0/value/@currency total-budget/0/value/@value-date total-budget/0/budget-line/0/@ref total-budget/0/budget-line/0/value total-budget/0/budget-line/0/value/@currency total-budget/0/budget-line/0/value/@value-date total-budget/0/budget-line/0/narrative recipient-org-budget/0/@status recipient-org-budget/0/recipient-org/@ref recipient-org-budget/0/recipient-org/narrative recipient-org-budget/0/period-start/@iso-date recipient-org-budget/0/period-end/@iso-date recipient-org-budget/0/value recipient-org-budget/0/value/@currency recipient-org-budget/0/value/@value-date recipient-org-budget/0/budget-line/0/@ref recipient-org-budget/0/budget-line/0/value recipient-org-budget/0/budget-line/0/value/@currency recipien
View 1_spreadsheet.csv
@last-updated-datetime @default-currency @humanitarian @hierarchy @linked-data-uri @budget-not-provided iati-identifier reporting-org/@ref reporting-org/@type reporting-org/@secondary-reporter reporting-org/narrative title/narrative description/0/@type description/0/narrative participating-org/0/@ref participating-org/0/@type participating-org/0/@role participating-org/0/@activity-id participating-org/0/@crs-channel-code participating-org/0/narrative other-identifier/0/@ref other-identifier/0/@type other-identifier/0/owner-org/@ref other-identifier/0/owner-org/narrative activity-status/@code activity-date/0/@type activity-date/0/@iso-date activity-date/0/narrative contact-info/0/@type contact-info/0/organisation/narrative contact-info/0/department/narrative contact-info/0/person-name/narrative contact-info/0/job-title/narrative contact-info/0/telephone contact-info/0/email contact-info/0/website contact-info/0/mailing-address/0/narrative activity-scope/@code recipient-country/0/@code recipient-country/0/@perc
View 1_spreadsheet.csv
@last-updated-datetime @xml:lang @default-currency @humanitarian @hierarchy @linked-data-uri @budget-not-provided iati-identifier reporting-org/@ref reporting-org/@type reporting-org/@secondary-reporter reporting-org/narrative/0 reporting-org/narrative/0/@xml:lang title/narrative/0 title/narrative/0/@xml:lang description/0/@type description/0/narrative/0 description/0/narrative/0/@xml:lang participating-org/0/@ref participating-org/0/@type participating-org/0/@role participating-org/0/@activity-id participating-org/0/@crs-channel-code participating-org/0/narrative/0 participating-org/0/narrative/0/@xml:lang other-identifier/0/@ref other-identifier/0/@type other-identifier/0/owner-org/@ref other-identifier/0/owner-org/narrative/0 other-identifier/0/owner-org/narrative/0/@xml:lang activity-status/@code activity-date/0/@type activity-date/0/@iso-date activity-date/0/narrative/0 activity-date/0/narrative/0/@xml:lang contact-info/0/@type contact-info/0/organisation/narrative/0 contact-info/0/organisation/narrative
View its-rules.xml
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0"
xmlns:svg="http://www.w3.org/2000/svg">
<its:translateRule selector="//svg:*" translate="no"/>
<its:translateRule selector="//svg:text | //svg:tspan | //svg:textArea |
//svg:title | //svg:desc | //svg:metadata |
//svg:flowPara"
translate="yes"/>
</its:rules>
View empty_header.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
test
You can’t perform that action at this time.