Skip to content

Instantly share code, notes, and snippets.

View charlesroper's full-sized avatar
🌱

Charles Roper charlesroper

🌱
View GitHub Profile
@charlesroper
charlesroper / Comparing Email to Other Energy Expenses.md
Last active May 16, 2025 22:59
Comparing Email to Other Energy Expenses.md

Comparing Email to Other Energy Expenses

3–5 kg CO₂e per year (email footprint) ≈

Activity CO₂e produced Notes
Boiling a full kettle ~60–100 times ~50–70 g each 3 000–5 000 g = ~70 kettles
Driving a petrol car ~15–25 miles ~0.2–0.3 kg CO₂e per mile UK average car
1–2 roast dinners ~2–3 kg each Meat-heavy meal (esp. lamb/beef)
@charlesroper
charlesroper / The Energy of an Email.md
Last active May 16, 2025 18:35
The Energy of an Email.md

The Energy of an Email

Produced by ChatGPT o3; 2025-05-16; thought for 1m28s – see Appendix

Question

Explore the veracity of this claim:

Based on the older figures, some people have estimated that their own emails will generate 1.6kg (3.5lb) CO2e in a single day. Berners-Lee himself also calculated that a typical business user creates 135kg (298lbs) CO2e from sending emails every year, which is the equivalent of driving 200 miles in a family car.

<!DOCTYPE html>
<html>
<head>
<style>
/* Define colour variables in the :root scope for easy reuse throughout the stylesheet */
:root {
/* Grouped blue colours */
--blue-brand-color: hsl(231, 53%, 14%); /* Brand's main dark blue colour */
--blue-brand-dark-color: hsl(231, 40%, 9%); /* Darker variant of the brand's blue */
@charlesroper
charlesroper / chelsea-academy.md
Created June 5, 2024 13:01
Chelsea academy products
Name Age Years left Market value (in €)
Levi Colwill 21 5 50,000,000
Reece James 24 4 40,000,000
Conor Gallagher 24 1 32,000,000
Armando Broja 22 4 22,000,000
Ian Maatsen 21 2 18,000,000
Lewis Hall 19 1 15,000,000
Trevoh Chalobah 24 4 13,000,000
@charlesroper
charlesroper / run_ssh_and_firefox.ps1
Created March 21, 2024 01:16
PowerShell script that starts an ssh SOCKS proxy then starts a browser. When the browser closes, it also closes the ssh proxy.
# Start the SSH command in the background
$sshProcess = Start-Process -FilePath "ssh" -ArgumentList "-v -D 1080 -N -C <SSH_SERVER>" -PassThru
# Wait for the SSH process to start
Start-Sleep -Seconds 2
# Start browser
Start-Process -FilePath "librewolf" -NoNewWindow
# Wait for browser to close
@charlesroper
charlesroper / Array.prototype.with().md
Last active April 27, 2023 10:39
Examples of Array.prototype.with()

Here are some more creative uses for the Array.prototype.with() method:

  • Creating a new array with a different value at a random index. This can be useful when you want to simulate a random change in an array.
const arr = [1, 2, 3, 4, 5];
const randomIndex = Math.floor(Math.random() * arr.length);
const randomValue = Math.floor(Math.random() * 10);
const withRandom = arr.with(randomIndex, randomValue);
console.log(withRandom); // e.g. [1, 2, 7, 4, 5]
# Import requests library
import requests
import time
import constants
# Define the collection ID and the access token
# collection_id = 33417911
collection_id = None
live_run = False
access_token = constants.RAINDROP_TOKEN
@charlesroper
charlesroper / cards.md
Last active April 19, 2023 15:44
Using Bing to write a card system in HTML and CSS

Results: https://sly-platinum-concrete.glitch.me/


Me: I am building a responsive website that has a series of cards. The cards are arranged in a grid 3 columns wide. Each card has an image, some text, and a button at the bottom. Each card should be of equal height regardless of how much content there is. The buttons at the bottom should stick to the bottom of the card. When the screen is narrow (like on a smartphone), the cards should rearrange themselves into a single column. Please write HTML and CSS to handle this. The CSS should be modern and use CSS Grid. Try and use techniques from https://every-layout.dev/ if you can.


Bing: Sure, I can help you with that. Here is a possible HTML and CSS code to create a responsive website with cards using CSS Grid. I have used some techniques from https://every-layout.dev/ such as the cluster and the stack components. You can modify the code to suit your needs.

@charlesroper
charlesroper / Power Automate joining and coalescing.md
Created April 6, 2023 12:19
Power Automate joining and coalescing.md

Power Automate joining and coalescing

A discussion with Bing AI (creative mode) 2023-04-06


ME

Using Power Automate.

@charlesroper
charlesroper / Improving heading readability with balanced wrapping.md
Last active March 20, 2023 13:25
Improving heading readability with balanced wrapping

Improving heading readability with balanced wrapping

I’ve been playing with new CSS declaration text-wrap: balance, part of the CSS Text Module Level 4 standard. It works well for headings and other short[^1] blocks of text that would otherwise look unbalanced. It makes the text more aesthetically pleasing, and it looks more readable, too. This is best described with an example.

Here’s an example as it looks now:

And here’s the same with text-wrap: balance turned on: