Skip to content

Instantly share code, notes, and snippets.

View fitsum's full-sized avatar
💭
npx fitsum

ፍፁም fitsum

💭
npx fitsum
View GitHub Profile
@fitsum
fitsum / recorder.cjs
Created February 11, 2025 21:08 — forked from peterc/recorder.cjs
Record an HTML file to a MP4 video
// Open a supplied HTML file and record whatever's going on to an MP4.
//
// Usage: node recorder.cjs <path_to_html_file>
// Dependencies: npm install puppeteer fluent-ffmpeg
// (and yes, you need ffmpeg installed)
//
// It expects a <canvas> element to be on the page as it waits for
// that to load in first, but you can edit the code below if you
// don't want that.
//
@fitsum
fitsum / git-log-short.txt
Created December 8, 2024 21:17
minimal git log with hash, author, date, message
git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
@fitsum
fitsum / leaflet-darkmode.md
Created August 21, 2024 22:04 — forked from BrendonKoz/leaflet-darkmode.md
Automatic Dark Mode for Leaflet.js
// Leaflet JS - note the *className* attribute
// [...]

L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    className: 'map-tiles'
}).addTo(map);

// [...]
@fitsum
fitsum / trinket-pro-arduino-cli-sample.md
Last active March 3, 2024 05:16
sample cli command for compiling and uploading to trinket pro with required args|props|...

commands

  • arduino-cli compile --fqbn adafruit:avr:protrinket5 [project name]
  • arduino-cli upload -P usbtinyisp --fqbn adafruit:avr:protrinket5 [project name]

pre-reqs

  • arduino-cli core install adafruit:avr
  • (linux) arduino-cli core install arduino:avr
  • (linux, maybe) install udev rules for trinket pro + restart udev
@fitsum
fitsum / stream-pdf-from-nodejs.js
Created January 25, 2024 10:42 — forked from InsilicoSoft/stream-pdf-from-nodejs.js
Stream local pdf file from nodejs (restify) server to client
server.get('/downloadPdf/:fileData', function (req, res) {
// config
var fileData = Buffer.from(req.params.fileData, 'base64');
var menuData = JSON.parse(fileData.toString());
var userName = menuData.userName;
var menuName = slug(menuData.menuName);
var fileName = userName + "-" + menuName + PDF_EXT;
var filePath = PDF_PATH + fileName;
// process headers
@fitsum
fitsum / speak-english.js
Last active April 26, 2024 05:18
speaks english voices in given browsers
speakEnglish = () => { voices = speechSynthesis.getVoices(); voices.filter(voice => voice.lang === "en-US" ).forEach(voice => {
const utterance = new SpeechSynthesisUtterance("What's poppin, bitches?")
utterance.voice = voice;
// default volume !== 1
utterance.volume = 1;
speechSynthesis.speak(utterance);
// next line causes function not to fire on first invocation 🤷🏾‍♂️
utterance.addEventListener('start',()=>{console.log('voice name:', voice.name)})
}) }
speakEnglish()
@fitsum
fitsum / remove-youtube-likes.js
Last active April 26, 2024 05:19
removing likes from youtube clips until YT baffles the effort
// https://www.youtube.com/playlist?list=LL
let currentLike = 1,
// should allow time for menu open and click
removeDelay = 150,
// should be double remove delay
countDelay = removeDelay*2,
// get current total from stats section
totalLikes = parseInt(document.querySelector('#stats yt-formatted-string').textContent);
const countLikes = setInterval(()=>{
/*** The new CSS Reset - version 1.2.0 (last updated 23.7.2021) ***/
/* Remove all the styles of the "User-Agent-Stylesheet", except for the 'display' property */
*:where(:not(iframe, canvas, img, svg, video):not(svg *)) {
all: unset;
display: revert;
}
/* Preferred box-sizing value */
*,
@fitsum
fitsum / same-as-eval.js
Last active April 26, 2024 05:20
no more eval() I guess ...
(() => {return Function(`"use strict";return (${__f__})`)();}).call(null)()
// would normally do `eval(__f__)` where __f__ might be a stringified function
// name in an array
@fitsum
fitsum / three.html
Created December 27, 2020 21:55 — forked from nasser/three.html
a three.js boilerplate scene in a single 30 line self-contained html file
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/reset.min.css">
<script type="module">
import * as THREE from "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js"
import { OrbitControls } from "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/controls/OrbitControls.js"
var scene = new THREE.Scene()
var camera = new THREE.PerspectiveCamera(75)
camera.position.z = 4