Skip to content

Instantly share code, notes, and snippets.

View RobinKnipe's full-sized avatar

Robin RobinKnipe

View GitHub Profile
@RobinKnipe
RobinKnipe / auto-theme-switch.md
Last active February 13, 2024 10:20
Colour temp theme switcher

Colour temp theme switcher

A simple utility that listens for changes to the desired colour temperature and changes the light/dark mode OS theme accordingly.

auto-theme.webm

Installation

Use the install.sh script directly, or look at the contents to inspire a manual alternative...

@RobinKnipe
RobinKnipe / gbp2eur.js
Last active May 8, 2023 22:33
Take a CSV file of date and GBP, and add the GBP=>EUR rate and converted EUR amount.
const { createReadStream, createWriteStream } = require('fs');
const { pipeline } = require('stream');
const csv = require('csv-parser');
const exchangeRatesUrl = 'https://api.exchangerate.host';
async function getExchangeRate(date) {
const response = await fetch(`${exchangeRatesUrl}/convert?from=GBP&to=EUR&date=${date}`);
const { result } = await response.json();
return result;
@RobinKnipe
RobinKnipe / pick-recursive.js
Last active November 7, 2022 11:58
Strip request/response and Sympol fields from a SuperAgent-style request/response object.
const strip = obj => Object
.fromEntries(
Object
.entries(obj)
.filter(([k]) => !/^(?:_|[Rr]e[sq]|.*Symbol).*$/.test(k))
.map(([k, v]) => [k, v instanceof Object ? strip(v) : v])
)
@RobinKnipe
RobinKnipe / README.md
Last active May 9, 2023 07:06
Repeat until error

Repeat until error

A simple "Ronseal" function, that repeats a specified command until it fails with an error - i.e. returns a non-zero return code.

Usage

I like to create an alias for the function (in ~/.bash_aliases, or simmilar), i.e.

source rue.sh