Skip to content

Instantly share code, notes, and snippets.

The aim

I want to support light and dark modes in my project.

I also want to have an 'inverted' mode, where I show a section of content in the opposite mode to the main site.

Set up

It's possible to use color-scheme: light dark; to enable the light and dark theme in my document, and then light-dark() to switch colours based on the active scheme:

@symroe
symroe / CircleCI-context-audit.py
Created January 5, 2023 10:23
Dumps all the context keys to a TSV on STDOUT
"""
Use:
Pass CIRCLECI_TOKEN and CIRCLECI_ORG_ID in as environment vars.
CIRCLECI_TOKEN is a personal access token from https://app.circleci.com/settings/user/tokens
CIRCLECI_ORG_ID is the Organisation ID from your CircleCI Organization Settings
Run the file and it'll output a TSV for you.
URL Name Ballot
https://candidates.democracyclub.org.uk/person/94007 Aamir Haroon local.sutton.sutton-north.2022-05-05
https://candidates.democracyclub.org.uk/person/95079 Aarti Joshi local.camden.belsize.2022-05-05
https://candidates.democracyclub.org.uk/person/91889 Abdul Bari local.birmingham.sparkbrook-balsall-heath-east.2022-05-05
https://candidates.democracyclub.org.uk/person/41823 Abdul Khalique local.birmingham.newtown.2022-05-05
https://candidates.democracyclub.org.uk/person/46266 Abdul Latif local.merton.merton-park.2022-05-05
https://candidates.democracyclub.org.uk/person/91581 Abid Khan local.birmingham.moseley.2022-05-05
https://candidates.democracyclub.org.uk/person/86441 Abu Kalam Azad Sarker local.ealing.northolt-west-end.2022-05-05
https://candidates.democracyclub.org.uk/person/38095 Ada Emeka Echedom local.barking-and-dagenham.abbey.2022-05-05
https://candidates.democracyclub.org.uk/person/10007 Adam Andrew Higgs local.birmingham.highters-heath.2022-05-05
doncaster.gov.uk/services/the-council-democracy/local-elections-2021
http://committeedmz.dartford.gov.uk/mgElectionAreaResults.aspx?ID=295&RPID=43255493
http://councillors.liverpool.gov.uk/mgElectionElectionAreaResults.aspx?Page=all&EID=55
http://democracy.stockport.gov.uk/mgElectionElectionAreaResults.aspx?Page=all&EID=53
http://moderngov.staffordshire.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=405&RPID=112608223
http://moderngov.staffordshire.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=406&RPID=112608223
http://moderngov.staffordshire.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=408&RPID=112608223
http://moderngov.staffordshire.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=409&RPID=112608223
http://moderngov.staffordshire.gov.uk/mgElectionAreaResults.aspx?XXR=0&ID=410&RPID=112608223
http://moderngov.staffordshire.gov.uk/mgElectionElectionAreaResults.aspx?Page=all&EID=31
import random
prefixes = {
"Saws",
"Woodset",
"Cocker",
"Stubbing",
"Hubbers",
"Westle",
"Bar",
DC_ID GSS BBC Name BBC Party DC Name DC Party
parl.wakefield.2019-12-12 E14001009 Imran Ahmad-Khan Conservative Imran Nasir Ahmad-Khan Conservative and Unionist Party
parl.wakefield.2019-12-12 E14001009 Mary Creagh Labour Mary Creagh Labour Party
parl.wakefield.2019-12-12 E14001009 Ryan Kett The Yorkshire Party Ryan Kett Yorkshire Party
parl.wakefield.2019-12-12 E14001009 Jamie Needle Liberal Democrat Jamie Needle Liberal Democrats
parl.wakefield.2019-12-12 E14001009 Stephen Whyte Independent Stephen Whyte Independent
parl.wakefield.2019-12-12 E14001009 Peter Wiltshire The Brexit Party Peter David Wiltshire The Brexit Party
parl.rutland-and-melton.2019-12-12 E14000909 Alicia Kearns Conservative Alicia Kearns Conservative and Unionist Party
parl.rutland-and-melton.2019-12-12 E14000909 Marietta King UK Independence Party Marletta King UK Independence Party (UKIP)
parl.rutland-and-melton.2019-12-12 E14000909 Alastair McQuillan Green Alastair McQuillan Green Party
EC_ID YNR_ID
PP428 party:428
PP264 party:264
PP263 party:263
PP429 party:429
PP719 party:719
PP307 party:307
PP2533 party:2533
PP210 party:210
PP2119 party:2119
YNR ID Name Twitter Wikidata ID Ballot elected
765 John Whittingdale JWhittingdale Q264684 parl.maldon.2017-06-08
6049 Peter Grant PeterGrantMP Q19882721 parl.glenrothes.2017-06-08
2567 Diane Abbott HackneyAbbott Q153454 parl.hackney-north-and-stoke-newington.2017-06-08
919 David Crausby DavidCrausby Q291441 parl.bolton-north-east.2017-06-08
34491 Neil O'Brien NeilDotObrien Q6989101 parl.harborough.2017-06-08
191 Derek Thomas DerekThomasUK Q20177497 parl.st-ives.2017-06-08
2625 John Stevenson JohnStevensonMP Q341538 parl.carlisle.2017-06-08
5921 Alan Brown AlanBrownSNP Q4706257 parl.kilmarnock-and-loudoun.2017-06-08
4499 Christine Jardine cajardineMP Q30164696 parl.edinburgh-west.2017-06-08
import requests
import csv
import sys
populaton_url = "https://petitionmap.unboxedconsulting.com/json/mps/population_ons.json"
req = requests.get(populaton_url)
POULATION_BY_GSS = req.json()
<!DOCTYPE html>
<html>
<head>
<style>
.box {
width:50%;
}
.box:nth-child(even) {
float:right;