Skip to content

Instantly share code, notes, and snippets.

View charlesroper's full-sized avatar
🌱

Charles Roper charlesroper

🌱
View GitHub Profile
@charlesroper
charlesroper / eza-completion.ps1
Last active July 20, 2025 09:57
Native tab-completion for eza on PowerShell 7+
<#
eza-completion.ps1
──────────────────
Native tab-completion for eza on PowerShell 7+
Drop this file in your $PROFILE directory and source it:
. (Join-Path (Split-Path $PROFILE -Parent) "eza-completion.ps1")
Make sure the following PSReadLine options are set:
@charlesroper
charlesroper / Summary of Andy Masley’s AI articles.md
Created May 17, 2025 00:19
Summary of Andy Masley’s AI articles.md
@charlesroper
charlesroper / How much bandwidth and CO₂e does an adblocker save.md
Last active May 16, 2025 23:32
How much bandwidth and CO2e does an adblocker save.md

How much bandwidth and CO₂e does an adblocker save?

ChatGPT o4-mini-high; 2025-05-17

On average, studies show that a heavyweight ad- and tracker-blocker like uBlock Origin saves around a third of the data you’d otherwise download – and in concrete terms:

  • Bandwidth saved per page load
    In a diverse set of real-world tests on hundreds of popular sites, the average bandwidth saving from ad- and tracker-blocking was 899 KB (with a median of just under 500 KB and a 95th-percentile of 2.76 MB) (Brave). This corresponds to roughly 25–34 % less data transferred compared with no blocker (arXiv).
  • CO₂e saved per page load
@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