Skip to content

Instantly share code, notes, and snippets.

View francisbarton's full-sized avatar
🧝
Advent-of-Code-excited (my repo is on my Codeberg)

Fran Barton francisbarton

🧝
Advent-of-Code-excited (my repo is on my Codeberg)
View GitHub Profile
@matt-dray
matt-dray / bank.py
Last active August 19, 2025 00:45
Get the identity and date of the next bank holiday in England and Wales (with bunting if appropriate) from the command line with a standalone Python-script executable run by uv
#!/usr/bin/env -S uv run
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "datetime",
# "httpx",
# ]
# ///
@jonocarroll
jonocarroll / donut.R
Last active September 17, 2024 09:16
ts=0.07;ps=0.02;A=B=0;
while(1){ j=i=0;z=rep(0,1760);
b=rep(' ',1760); while(j < 6.28){
j=j+ts;i=0;while(i<6.28){i=i+ps;c=
sin(i);l=cos(i); d=cos(j);f=sin(j);
e=sin(A);g=cos(A );h=d+2;D=1/(c*h*e+
f*g+5);m=cos(B) ;n=sin(B);t=c*h*g-
f*e;x=as.integer (40+30*D*(l*h*m-t*n));
y=as.integer(12+ 15*D*(l*h*n+t*m));
o=as.integer(x+( 80*y));N=as.integer(
@wiesehahn
wiesehahn / render_pointcloud.R
Created September 10, 2023 12:14
Example how to render pointclouds in R with rayrender
##___________________________________________________
##
## Script name: render_pointcloud.R
##
## Purpose of script:
## render forest plot pointcloud with raytracing
##
## Author: Jens Wiesehahn
## Copyright (c) Jens Wiesehahn, 2023
## Email: [email protected]
@tomjemmett
tomjemmett / tj-dracula.omp.json
Last active July 23, 2025 13:45
my oh my posh theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"final_space": true,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
options(reactable.theme = reactable::reactableTheme(
color = "hsl(233, 9%, 87%)",
backgroundColor = "#002b36",
borderColor = "#eee8d5",
stripedColor = "#586e75",
highlightColor = "#6c71c4",
inputStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
selectStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
pageButtonHoverStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
pageButtonActiveStyle = list(backgroundColor = "hsl(233, 9%, 28%)")
unpack_double <- function(x) {
binary <- numToBits(x) # little-endian binary representation
structure(
list(
sign = binary[64], # 1-bit sign
exponent = binary[63:53], # 11-bit exponent
mantissa = binary[52:1] # 52-bit mantissa
),
class = "unpacked_double"
@ColinFay
ColinFay / fork-up-to-date
Last active October 9, 2020 15:59
Keep your fork up to date
# To do the first time
# git remote add upstream https://github.com/original-repo/goes-here.git
git fetch upstream
git rebase upstream/master
git push origin master --force
@MilesMcBain
MilesMcBain / anonymous.R
Created July 9, 2020 11:48
anonymous function examples
## apply a function to square a list of numbers
square <- function(x) {
x^2
}
lapply(list(1,2,3), square)
## save some code and declare 'square' anonymously - i.e. never assign it anywhere
## using the name 'square'
@olihawkins
olihawkins / coronavirus-api.R
Last active June 10, 2021 08:50
Download data on Coronavirus cases and deaths from the government dashboard API
# Functions for downloading data on Coronavirus cases in the UK by country,
# region, NHS region, and local authority from the government dashboard API.
#
# The developer guide is here:
#
# https://coronavirus.data.gov.uk/developers-guide
#
# The code below is based on the example code shown there.
#
# Run ...
@erdavis1
erdavis1 / allpubs.csv
Created May 5, 2019 19:03
Pubs of the British Isles
We can't make this file beautiful and searchable because it's too large.
ID,name,long,lat,region
1,'31 Market Place',-1.021284,53.429981,england
1,'The Commercial Hotel',-2.364444,53.752023,england
3,'The Park Inn ',-2.358299,53.747997,england
5,0 degrees North,-0.0309,53.560872,england
6,012 Bar And Grill,0.004034,51.544232,england
7,1 In 12 Club,-1.758029,53.794847,england
8,1 Step Social Limited,-1.633635044,54.81035995,england
9,1 Town Hall Square,-3.4474502,51.4620403,wales
10,100 Acre Catering Ltd,-1.838364,51.063689,england