Skip to content

Instantly share code, notes, and snippets.

View c-harding's full-sized avatar

Charlie Harding c-harding

View GitHub Profile
/**
* Try to survive by not falling off
**/
enum Side {
UP = "UP",
RIGHT = "RIGHT",
DOWN = "DOWN",
LEFT = "LEFT",
}
@c-harding
c-harding / _EC2 for hosting multiple sites.md
Last active December 14, 2023 14:43
EC2 for hosting multiple sites

EC2 for hosting multiple sites

This configuration can be used for hosting multiple sites on a single server, using docker and docker-compose for each site. Each site needs a unique port, and will be served on a unique domain. For SSL, use Cloudflare as a proxy.

Use EC2 to create a new instance. The image should be Amazon Linux 2 on ARM, running on a t4g.nano/t4g.micro/t4g.small. n.b. t4g.small is free for 750h/mo until the end of 2023. These cost $0.0042, $0.0084 and $0.0168 per hour respectively, or $3.066, $6.132 and $12.264 per month respectively.

@c-harding
c-harding / _STV.md
Last active April 26, 2022 12:33
STV

STV

This started out as a Google Sheets function for Single Transferable Vote, but now offers an index.html for usage locally. Open the relevant Google Sheet, copy the input values into the text field. There is also a save button to keep a track of past votes locally.

@c-harding
c-harding / YTD Strava Stats
Last active May 8, 2024 17:34
Strava stats this year
Hiking 594.1 km 4d 20h ██████████████████▋
Running 318.6 km 1d 7h █████
Skiing 446.2 km 1d 2h ████▏
@c-harding
c-harding / _Axiomatic.md
Last active May 13, 2018 11:12
Axiomatic Tree Proof Formatting

Axiomatic tree proofs

This gist shows an example of how you can use HTML and CSS to lay out trees used for axiomatic proofs of correctness for your code. The example used here is the While language, as defined in the Nielson and Nielson book Semantics with Applications.

@c-harding
c-harding / Max_Flow_Skeleton.md
Last active December 4, 2017 08:40
Max Flow Skeleton, Tidied

Overview

A large number of car drivers regularly want to travel from the Hawthorns bus stop (the corner of St Michael’s Park and Woodland Road – call it 's') to the "Scotsman and his Pack" pub (the corner of St Michael’s Hill and Horfield Road - call it 't') - as shown in the map on the view.html page. Complete the following 3 tasks by implementing a number of algorithms in JavaScript function found in the controller.html file. This should be fairly straightforward, even if you have little experience of JavaScript (see the help sections at the end of this document for some tips).