Skip to content

Instantly share code, notes, and snippets.

@sfoster
sfoster / read-chrome-sessions.py
Last active November 7, 2025 00:41 — forked from IntendedConsequence/read-chrome-sessions.py
Parse urls and titles from chrome browser sessions
import sys
import os
import csv
import json
import struct
import argparse
from io import BytesIO
from enum import Enum, EnumMeta
from urllib.parse import unquote
@sfoster
sfoster / thread-tests.scad
Created February 25, 2025 06:51
OpenSCAD thread test
include <../threads.scad>;
// threads library from: https://dkprojects.net/openscad-threads/
// probably updated since, as I downloaded this a while back
od = 30;
id = od - 1;
wall = 4;
$fn=64;
fillet=2;
lid_th=1;
@sfoster
sfoster / mozlz4json.py
Last active November 28, 2023 15:55
MozLz4a compression/decompression utility
#!/usr/bin/env python
#
# Based on mozlz4a.py, by Tilman Blumenbach, via https://gist.github.com/kaefer3000/73febe1eec898cd50ce4de1af79a332a
# Modified by Sam Foster to parse the decompressed input as JSON and output a pretty-printed JSON document
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
# This file format is in fact just plain LZ4 data with a custom header (magic number [8 bytes] and
# uncompressed file size [4 bytes, little endian]).
    • 1710062 Proton: Customize toolbar - light theme circle image is barely visible in ubuntu.
    • 1712957 Proton : Mac 10.14 - panels should have the correct border colour
    • 1714402 [meta] ui.prefersReducedMotion is ignored in some areas
    • 1721292 Menubar text always black, doesn't follow theme
    • 1724561 Places drop indicator's vertical positioning is inconsistent when dragging immediately before/after a separator
    • 1730371 Using the system theme and a high contrast theme on the OS gives unexpected results
    • 1733748 Urlbar border is misaligned with fractional gnome text scaling
    • [ ]
@sfoster
sfoster / slow-response.js
Created August 12, 2021 20:46
Server to throttle response to a .zip file request so you can easily work on downloads without filling up your disk
const express = require('express');
const cwd = process.cwd();
const path = require('path');
const docRoot = cwd;
const app = express();
const port = 3000;
const fs = require('fs');
const Throttle = require('stream-throttle').Throttle;
app.get('/*.zip', async function(request, response, next) {
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test login capture on form removal</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
@sfoster
sfoster / gist:9c9230cba4e4cff1eb88423cd9547e51
Created November 26, 2018 23:40
Some form autofill scratchpad code to enter some test addresses and credit card details
/*
* This is a JavaScript Scratchpad.
*
* Enter some JavaScript, then Right Click or choose from the Execute Menu:
* 1. Run to evaluate the selected text (Ctrl+R),
* 2. Inspect to bring up an Object Inspector on the result (Ctrl+I), or,
* 3. Display to insert the result in a comment after the selection. (Ctrl+L)
*/
const cardBobsVisa = {
@sfoster
sfoster / svg-animation-tooling.md
Last active July 5, 2018 20:40
SVG Animation Tooling / Firefox Photon Notes

Many of the new UI animations added in 57 used a "film strip" technique to get pre-rendered, 60fps animation that could run entirely on the compositor and off the main thread. These SVG files were typically a horizontal strip of frames, each frame offset on the x-axis by frame index * frame width. To play the animation, the CSS transform property is updated to translateX to a value that places the current frame at 0,0 in a cropped element. This technique is explained and illustrated here: http://msuja.ws/svg.html

There are many ways to create and optimize the output assets for these animations. The toolchain we used was a mix of existing tools and custom scripts and processes:

Asset preparation process

  • Adobe After Effects + BodyMovin
    • The framing and motion design was doine in After Effects, and exported using the BodyMovin plugin to a SVG-as-json format.
  • This page imports this json data, creates a SVG document and plays the animation in order to gen
<!DOCTYPE html>\n
<html>
<head>
<title>Example status client</title>
<style>
.led {
width: 40px;
height: 40px;
display: inline-block;
}
@sfoster
sfoster / inputs_outputs.md
Created April 8, 2016 00:30
SmartHome inputs/outputs

Inputs

  • Keyboard
  • Touch (capacitive touch, alternatives?)
  • Voice (offline, online)
  • OCR
  • Image Analysis (e.g. Kinnect, face recognition)
  • Sensor input (buttons, motion, temperature, light etc)
  • RFID/NFC <-- needs investigation & prototyping
  • Feeds & Events (e.g. news feeds, weather APIs etc)