Skip to content

Instantly share code, notes, and snippets.

View charlesroper's full-sized avatar
🌱

Charles Roper charlesroper

🌱
View GitHub Profile

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@charlesroper
charlesroper / cygstart
Created February 28, 2010 18:24
cygstart -?
$ cygstart -?
cygstart is part of cygutils version 1.4.2
cygstart was originally authored by Michael Schaap
Let Windows start a program or open a file or URL.
Usage: cygstart [OPTION]... FILE [ARGUMENTS]
Action options
@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

I'm doing a training course at work and promised I would list some of the books on progressive leadership I have found useful. Here they are in alphabetical order.

Creativity Inc. by Ed Catmull

I love Pixar movies. They have so very rarely fallen below the benchmark of excellent. Not only are they classic stories in their own right, they are also technical marvels. How does an organisation like Pixar maintain such a successful track record? How does it manage to be hugely commercially successful and critically acclaimed, too? Few studios can lay claim to staying so true to their art, especially when the stakes are so high, with the contemporary movies having typically having a budget in excess of $200 million. In this book, Ed Catmull explains how.

One of my favourite chapters, The Hungry Beast and the Ugly Baby, tells of how Pixar has to carefully balance the tension of feeding the "hungry beast" (that is, keeping the business going) with the need to generate and try new ideas, that enter the world a

@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:

@charlesroper
charlesroper / Palmyrene Right-Pointing Fleuron.svg
Created March 1, 2023 14:11
Palmyrene Right-Pointing Fleuron
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.