Skip to content

Instantly share code, notes, and snippets.

View sebbacon's full-sized avatar

Seb Bacon sebbacon

View GitHub Profile
@sebbacon
sebbacon / bob.json
Last active April 16, 2024 09:41
Click-to-edit force directed graph in d3
{"nodes":[{"name":"Myriel","group":1},{"name":"Napoleon","group":1},{"name":"Mlle.Baptistine","group":1},{"name":"Mme.Magloire","group":1},{"name":"CountessdeLo","group":1},{"name":"Geborand","group":1},{"name":"Champtercier","group":1},{"name":"Cravatte","group":1},{"name":"Count","group":1},{"name":"OldMan","group":1}],"links":[{"source":0,"target":1,"value":1},{"source":1,"target":2,"value":8},{"source":1,"target":3,"value":10},{"source":3,"target":4,"value":1},{"source":3,"target":5,"value":1},{"source":4,"target":6,"value":1},{"source":6,"target":7,"value":1},{"source":1,"target":4,"value":2},{"source":7,"target":8,"value":1},{"source":8,"target":9,"value":1},{"source":1,"target":9,"value":1},{"source":3,"target":9,"value":1}]}
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.09kB 0.0s done
#1 DONE 0.0s
#2 [internal] load metadata for docker.io/ebmdatalab/datalab-jupyter:python3.8.1-2328e31e7391a127fe7184dcce38d581a17b1fa5
#2 DONE 0.5s
#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s
This log output shows Chris running `python run.py` on Windows. It shows two issues.
1. A syntax error in jupyterlab
2. A config error (presumably due to deprecated config) for jupyterlab
```txt
(base) C:\Users\cwood\Documents\GitHub\rich_test_1>python run.py
Building docker image. This may take some time (particularly on the first run)...
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
@sebbacon
sebbacon / shotter.py
Created January 22, 2024 12:53
Use console-based javascript to parse a complicated DOM; and playwright to run it against specific URLs
import subprocess
from PIL import Image
# This is the complex parsing. It locates every single italic character in the text,
# and then adds a custom inline style to it
js = """document.querySelectorAll('*').forEach(element => {
const fontStyle = window.getComputedStyle(element).fontStyle;
if (fontStyle === 'italic') {
element.style.backgroundColor = 'lightgrey';
@sebbacon
sebbacon / gist:bee36e34e5aef06b8f0fbe7f310cd877
Created January 17, 2024 09:36
transcribe_bbc_interview.py
"""Hacky script to download audio from a BBC interview and transcribe, with OpenAI tools
"""
import subprocess
from optparse import OptionParser
# Define command line options
select s1.d, n1, n2, cast(n2 as decimal) / cast(n1 as decimal)
from
(
select d, count(*), n1 from (
select convert(varchar(7), admission_date, 23) d
from apcs_cost c
join apcs a
on c.apcs_ident = a.apcs_ident
) s
group by d
Data Set FileName Record Count Comments
National Waiting List TPP_NWL_ClockStops_20231124_0819.txt 195,596 This is a cumulative load eg we only send the latest weeks data to be appended.
National Waiting List TPP_NWL_Diagnostics_20231124_0819.txt 945,519 This is a cumulative load eg we only send the latest weeks data to be appended.
National Waiting List TPP_NWL_OpenPathways_20231124_0819.txt 6,599,819 This is a cumulative load eg we only send the latest weeks data to be appended.
Antiviral Data TPP_Antiviral_20231124_0823.txt 109,611 This is a full refresh of all data.
PHE Data TPP_PHE_Tests_Positive_20231124_0827.txt 6,132,4
@sebbacon
sebbacon / geopandas-legend-font-size.ipynb
Created April 26, 2018 06:52
setting matplotlib legend font size via geopandas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
-- Uploading file for patient_index_date
CREATE TABLE #tmp1_patient_index_date_file (
patient_id BIGINT,
patient_index_date DATE
)
GO
-- Query for patient_index_date
-- Query for dereg_date
SELECT * INTO #dereg_date FROM (
SELECT
t.Patient_id,
end_date AS value
FROM (
SELECT
Patient_ID AS patient_id,
MAX(EndDate) AS end_date
FROM