Skip to content

Instantly share code, notes, and snippets.

View jmpinit's full-sized avatar

Owen Trueblood jmpinit

View GitHub Profile
@jmpinit
jmpinit / index.html
Last active November 6, 2023 01:38 — forked from bellbind/index.html
[chrome][android] BarcodeDetector example
<!doctype html>
<html>
<head>
<script type="module">
// WICG Shape Detection API
// - https://wicg.github.io/shape-detection-api/
try {
const start = document.getElementById("start");
const video = document.getElementById("video");
const result = document.getElementById("result");
@jmpinit
jmpinit / save-pdf.js
Last active February 13, 2021 22:32 — forked from glenhallworthreadify/How to save a webpage as PDF file using Puppeteer.js
Save a PDF using Puppeteer given a URL. Run with first argument set to the URL to save as PDF.
const fs = require('fs');
const path = require('path');
const url = require('url');
const puppeteer = require('puppeteer');
class Webpage {
static async generatePDF(url, filename) {
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
await page.goto(url);
@jmpinit
jmpinit / bookmarklet.txt
Created September 26, 2018 14:09 — forked from kana/bookmarklet.txt
A bookmarklet to investigate an XPath expression of a clicked element.
javascript:(function(){var dialog=document.createElement("div");var setUpDialog=function(){dialog.style.position="fixed";dialog.style.bottom="0";dialog.style.left="10%";dialog.style.width="80%";dialog.style.color="#333";dialog.style.background="#efe";dialog.style.border="thin solid #9a9";dialog.style.margin="0 0 0.5em";dialog.style.padding="0.5em 1em";dialog.style.fontFamily="monospace";document.getElementsByTagName("body")[0].appendChild(dialog)};var notify=function(message){dialog.textContent=message};var loadJavaScript=function(uri){var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",uri);document.getElementsByTagName("body")[0].appendChild(script)};var isJQueryLoaded=function(){return window.jQuery!==undefined};var waitLoadingJQuery=function(continuation){var tryCount=0;var step=function(){if(isJQueryLoaded())continuation();else{tryCount++;setTimeout(step,tryCount*100);notify("Loading"+(new Array(tryCount+1)).join("."))}};step()};var getXPath
@jmpinit
jmpinit / timelapse.md
Created February 28, 2018 18:48 — forked from porjo/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

@jmpinit
jmpinit / BezierWithPots_Arduino.ino
Last active January 10, 2018 17:06 — forked from jeffnoko/BezierWithPots_Arduino
Use pots to set a bezier curve in Processing and draw on xy machine
#include <AccelStepper.h>
#include <MultiStepper.h>
#include <Servo.h>
const int BUTTON_START = 24;
MultiStepper steppers;
AccelStepper stepper1(1, 2, 3);
AccelStepper stepper2(1, 10, 11);
@jmpinit
jmpinit / drawLines.cpp
Last active December 30, 2017 02:05 — forked from jeffnoko/gist:8754a0e611c3d67a18fea872dd19a8ea
Draw lines controlling direction with rotary encoder.
#include<AccelStepper.h>
#include <MultiStepper.h>
#include <Servo.h>
#include <Rotary.h>
#include <Wire.h>
Servo servo1;