Skip to content

Instantly share code, notes, and snippets.

import csv
import sys
def ballot_type(row):
if row["AVDescription"] == "Postal" and row["AVType"].startswith("Permanent"):
return "Perm Postal"
elif row["AVDescription"] == "Postal" and row["AVType"].startswith("Temporary"):
return "Postal"
elif row["AVDescription"] == "Proxy" and row["AVType"].startswith("Permanent"):
@cnorthwood
cnorthwood / TS011-2021-1-filtered-2023-01-06T14 11 27Z.csv
Created January 7, 2023 12:09
trans_deprivation_correlation.py
We can't make this file beautiful and searchable because it's too large.
Middle Layer Super Output Areas Code,Middle Layer Super Output Areas,Household deprivation (6 categories) Code,Household deprivation (6 categories),Observation
E02000001,City of London 001,-8,Does not apply,0
E02000001,City of London 001,1,Household is not deprived in any dimension,2937
E02000001,City of London 001,2,Household is deprived in one dimension,1547
E02000001,City of London 001,3,Household is deprived in two dimensions,347
E02000001,City of London 001,4,Household is deprived in three dimensions,75
E02000001,City of London 001,5,Household is deprived in four dimensions,8
E02000002,Barking and Dagenham 001,-8,Does not apply,0
E02000002,Barking and Dagenham 001,1,Household is not deprived in any dimension,954
E02000002,Barking and Dagenham 001,2,Household is deprived in one dimension,1085
@cnorthwood
cnorthwood / server.ts
Created February 17, 2022 21:50
using cluster module for multiple CPUs
import cluster from "cluster";
import { cpus } from "os";
import app from "./app";
const numWorkers = cpus().length;
if (cluster.isPrimary) {
for (let i = 0; i < numWorkers; i++) {
cluster.fork();
@cnorthwood
cnorthwood / convert.py
Created August 12, 2021 12:46
Converting Slack export to CSV
#!/usr/bin/env python3
from collections import namedtuple
import csv
from datetime import datetime
from itertools import chain
import json
import os.path
import pathlib
import re
import crypto from "crypto";
const TOKEN_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
function encode(bytes: Buffer) {
let encodedString = "";
const mainCount = Math.floor(bytes.length / 5) * 5;
let i = 0;
for (; i < mainCount; ) {
const byte1 = bytes[i++];
@cnorthwood
cnorthwood / objection.md
Created August 4, 2019 22:01
Central Retail Park objection

Dear Sir/Madam,

I am objecting to the Central Retail Park planning permission on the basis of the following two reasons: incompatability with the council's policy "Climate Emergency" (Wednesday 10th July 2019, Item 5), and that the modelling provided in the application is based on faulty assumptions.

At the council meeting of Wednesday 10th July 2019, the council passed a "Climate Emergency" motion which includes the following resolutions:

"Become carbon neutral by the earliest possible date" "Make climate breakdown and the environment, an integral part of activity throughout the Council, including all decision making, ensuring key decisions take into account the impact on achieving the zero-carbon target and including an environmental impact assessment in all relevant committee reports"

The application does not demonstrate the second action, as the modelling undertaken only takes into account transport impact, not environmental impact. Before the application should be considered further, an environme

walk:
- 1.3.6.1.2.1.168
- 1.3.6.1.2.1.2
- 1.3.6.1.2.1.31.1.1
- 1.3.6.1.2.1.4.24
- 1.3.6.1.2.1.48
- 1.3.6.1.2.1.85
- 1.3.6.1.3.61
- 1.3.6.1.4.1.9.9.117
- 1.3.6.1.4.1.9.9.131

Summary

The web is the most important platform for software development today, and more and more organisations are embracing this. They demand quicker turn around to be able to respond to changes, and are bringing software development closer to the rest of their business. The ability to respond quickly and make changes without long waits can now make-or-break an organisation, and this has led to the rise of the "full-stack" developer: one who feels comfortable working on code at the system, database, API, middleware or user interface level, depending on the task in hand. The full-stack developer is more than just a programmer. They do more than simply write code, they develop solutions to problems (often expressing those solutions in code), but also have to understand the problem in the first place. Working as part of a team, they need to be able to deal with the big picture and the little details.

This book is aimed at recent graduates, new and junior developers, as well as those retraining from being sp

@cnorthwood
cnorthwood / metrolink.py
Created June 14, 2017 12:03
Metrolink scraper
describe('Federation NOMA', () => {
it('has ambition', () => {
expect(federation.creativeWorkspace).toBe('great');
expect(federation.buildings.length).toBeGreaterThan(1);
expect(federation.people.filter((person) => person.cares)).toBeNonEmpty();
expect(federation.wifiSpeedMbps).toEqual(1024);
});
it('can have my people too', () => {