Skip to content

Instantly share code, notes, and snippets.

@sebm
sebm / metronome.js
Last active September 23, 2020 07:02
Render a metronome mp3 in response to an HTTP request
// Google Cloud Source repos don't allow world-readable so this is the next best thing
// this is the code as of SHA b34717ce19fa9da940333402e7534c0e99f687a3
const synth = require("synth-js");
const MidiWriter = require("midi-writer-js");
const ffmpeg = require("fluent-ffmpeg");
const { Readable } = require("stream");
const concat = require("concat-stream");
const MEASURES = 100;
@sebm
sebm / how-im-learning-japanese.markdown
Last active August 14, 2020 18:47
How I'm Learning Japanese
@sebm
sebm / README.md
Last active November 22, 2018 18:00
How to rip VHS to mp4

Acknowledgements to this article for the ffmpeg commands.

  1. Install Ubuntu on a bootable partition - not a VM - a live CD / USB is ok.
  2. sudo apt install ffmpeg vlc v4l-utils. Don't be fooled, snaptools will not work.
  3. ffmpeg -f v4l2 -thread_queue_size 512 -i /dev/video1 -f alsa -thread_queue_size 512 -i hw:2,0 -t 00:00:30 -c:v h264 -c:a aac -pix_fmt yuv420p test.mp4
<html lang="en"><head>
</head>
<body translate="no">
<button onclick="hey()">Hey</button>
<br>
<button onclick="windoh()">Windoh</button>
🍟 \[\e[1;93m\]\w\[\e[0m\]\[\] \[\e[0m\]
@sebm
sebm / 001.cpp
Last active January 17, 2017 08:19
Solutions to Project Euler 001 in multiple languages, with performance stats
#include <iostream>
using namespace std;
int main() {
int running_sum = 0;
for (int i = 2; i < 1000; i++) {
if (i % 3 == 0 || i % 5 == 0) {
running_sum += i;
}
}

Keybase proof

I hereby claim:

  • I am sebm on github.
  • I am seb_m (https://keybase.io/seb_m) on keybase.
  • I have a public key whose fingerprint is C480 445D 7E8C C1CE 58F4 214C B6B4 3DD0 8888 1430

To claim this, I am signing this object:

@sebm
sebm / webgripes.md
Last active January 12, 2017 17:14
ongoing list of complaints about web browsers

safari (desktop)

  • keypress events don't have "key" set

safari (ios)

  • doesn't support audiorecorder

chrome

  • some elements can't be flex containers, like <fieldset> and <button>
  • (chromium / canary) devtools occasionally doesn't show where CSS rules are set, which is 80% of the point of using devtools
  • (chromium / canary) crashes a lot
@sebm
sebm / README
Last active November 20, 2016 04:26
I can't figure out nedb!
- clone this gist
- open index.html in browser
- observe an exception is thrown
git show --name-only | grep css | xargs postcss --use postcss-sorting -r --postcss-sorting.sort-order=alphabetical