Skip to content

Instantly share code, notes, and snippets.

@wheresalice
wheresalice / spec.json
Created June 8, 2020 18:20
NHS England Covid Deaths
{
"config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},
"data": {"name": "data-9f7cabe0332f8f1e8f65ae37f185d2a2"},
"mark": "bar",
"encoding": {
"color": {"type": "nominal", "field": "Condition"},
"column": {"type": "nominal", "field": "Condition"},
"tooltip": {"type": "quantitative", "field": "sum"},
"x": {"type": "nominal", "field": "Age group"},
"y": {"type": "quantitative", "field": "sum"}
@wheresalice
wheresalice / spec.json
Created June 4, 2020 16:20
Vega-Lite spec from Thu Jun 04 2020
{
"config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},
"data": {"name": "data-5c0a45d3b39e712b784c4dcdb003ced6"},
"mark": "bar",
"encoding": {
"color": {"type": "nominal", "field": "Disability"},
"x": {"type": "nominal", "field": "Police Force"},
"y": {"type": "quantitative", "field": "count"}
},
"title": "CED Usage by Force",
@wheresalice
wheresalice / index.html
Created May 7, 2020 19:55
Code review needed - I think this will list instances of the NHS Covid-19 tracker that are in range
<html>
<head></head>
<body>
<button onclick="navigator.bluetooth.requestDevice({filters: [{services: ['c1f5983c-fa94-4ac8-8e2e-bb86d6de9b21']}]});">Click me to scan for NHS Covid-19 tracker apps nearby</button>
</body>
</html>
def states_to_geojson(states):
geojson = {}
geojson['type'] = 'FeatureCollection'
geojson['features'] = []
for state in states.states:
point = {}
point['type'] = 'Feature'
point['properties'] = {'icao': state.icao24, 'callsign': state.callsign, 'origin_country': state.origin_country,
'on_ground': state.on_ground, 'velocity': state.velocity, 'spi': state.spi}
point['geometry'] = {'type': 'Point', 'coordinates': [state.longitude, state.latitude]}
@wheresalice
wheresalice / Makefile
Last active September 30, 2019 04:37
Produce a CSV with Tiploc code, Longitude, and Latitude using Naptan data
.DEFAULT_GOAL := tiploc_locations.csv
naptan.zip:
wget -O naptan.zip naptan.app.dft.gov.uk/DataRequest/Naptan.ashx?format=csv
Stops.csv: naptan.zip
unzip -o naptan.zip
tiploc_locations.csv: Stops.csv
python run.py
@wheresalice
wheresalice / docker-compose.yml
Last active October 7, 2019 12:38
docker-compose file for running Confluent Platform locally
version: '2'
services:
zookeeper:
image: "confluentinc/cp-zookeeper:5.3.0"
hostname: zookeeper
ports:
- '32181:32181'
environment:
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
<settings>
<profiles>
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>confluent</id>
<url>https://packages.confluent.io/maven/</url>
</repository>
</repositories>
@wheresalice
wheresalice / openapi.yaml
Created June 10, 2019 15:53
OpenAPI spec for Confluent Schema Registry
openapi: 3.0.1
info:
title: Schema Registry
version: 5.2.1
description: Schema Registry provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving Avro schemas. It stores a versioned history of all schemas, provides multiple compatibility settings and allows evolution of schemas according to the configured compatibility settings and expanded Avro support. It provides serializers that plug into Apache Kafka® clients that handle schema storage and retrieval for Kafka messages that are sent in the Avro format.
externalDocs:
url: >-
https://docs.confluent.io/current/schema-registry/develop/api.html#schemaregistry-api
description: Confluent's API reference
paths:
@wheresalice
wheresalice / rest_proxy.yaml
Last active April 14, 2022 08:28
Swagger OpenAPI spec for Confluent REST Proxy
openapi: 3.0.1
info:
title: REST Proxy API
description: >-
The Confluent REST Proxy provides a RESTful interface to a Kafka cluster, making it easy to produce and consume messages, view the state of the cluster, and perform administrative actions without using the native Kafka protocol or clients.
<p>Some example use cases are</p>
<ul>
<li>Reporting data to Kafka from any frontend app built in any language not supported by official Confluent clients</li>
<li>Ingesting messages into a stream processing framework that doesn’t yet support Kafka</li>
<li>Scripting administrative actions</li>
@wheresalice
wheresalice / loc_generator.rb
Created May 9, 2019 10:19
Hacky ruby script to generate RFC 1876 DNS LOC records from RFC 7946 Geojson file
require 'json'
def degrees(point)
point.abs.to_i
end
def minutes(point)
(point.abs * 60).to_i % 60
end