Skip to content

Instantly share code, notes, and snippets.

@ellcom
ellcom / gist:ea0053be9a872a1dc96754b222ce670b
Created September 4, 2026 08:24
Install cloudflared on raspberry pi zero
# done locally for speed, need go installed i.e. brew install go
git clone https://github.com/cloudflare/cloudflared.git
cd cloudflared
COMMIT=$(git rev-parse --short HEAD)
VERSION=$(git describe --tags --abbrev=0)
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build \
-ldflags "-X main.Version=$VERSION -X main.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ) -X main.GitCommit=$COMMIT" \
-o cloudflared ./cmd/cloudflaredVERSION=$(git describe --tags --abbrev=0)VERSION=$(git describe --tags --abbrev=0)
@ellcom
ellcom / Epson_TM-L90_Password_Finder.php
Last active September 16, 2026 21:39
Epson TM-L90 password finder
/*
* Sometimes the default password doesn't work, this is because people have moved the UB-04 card from one printer to another.
* when this happens, the printer retains the serial number from the old printer or sometimes the motherboard is replaced in
* the TM-L90. Either way the password wont work and you are not going to be able to config the network.
* This script starts at X2NJ00 0001 and works upto 9999. You might be able to start at 1000? but this should give you the serial
* number the printer wants as the default password.
* Hopefully this saves someones sanity.
*/
<?php
$login = 'epson';
@ellcom
ellcom / weather_codes.php
Created July 26, 2026 20:37
Met office significant weather codes php dictionary
<?php
// Met office significant weather codes
// https://datahub.metoffice.gov.uk/definition-of-codes
// Convert Met Office weather codes
$weather = [
"NA" => "Not available",
4 => "Not used",
-1 => "Trace rain",
0 => "Clear night",
@ellcom
ellcom / passmark-normalization.R
Created June 8, 2026 13:32
passmark linear transformation normalization
calculate_normalised_score <- function(passmark, score) {
normalised_score <- 50
if (score > passmark) {
normalised_score <- 50 + 50 * (
(score - passmark) / (100 - passmark)
)
@ellcom
ellcom / retina-canvas.js
Last active June 8, 2026 13:34
Retina Canvas Invisible Upscaling
(function(prototype) {
prototype.getContext = (function(_parent) {
return function(contextType, contextAttributes) {
var context = _parent.call(this, contextType, contextAttributes)
if (contextType != '2d') {
return context
}
if (this.hasAttribute('data-scaled')) {
return context
@ellcom
ellcom / remove_*@1x*.sh
Created September 4, 2014 10:40
Remove @1x from file names in a directory
#!/bin/sh
for f in *@1x.png; do
echo "$f"
echo "${f%@1x.*}.png"
mv "$f" "${f%@1x.*}.png"
done
@ellcom
ellcom / AppleScript.Spotify.PlayPause.scpt
Created August 2, 2014 17:02
Tell spotify to play/pause using AppleScript
using terms from application "Spotify"
if player state of application "Spotify" is paused then
tell application "Spotify" to play
else
tell application "Spotify" to pause
end if
end using terms from