Skip to content

Instantly share code, notes, and snippets.

View Lokua's full-sized avatar
🐐
 

Joshua Kleckner Lokua

🐐
 
View GitHub Profile
@Lokua
Lokua / wav2mp3.sh
Last active July 20, 2019 17:11
converts all wav files in cwd to highest quality lame mp3
#!/bin/bash
function wav2mp3() {
for filename in *.wav; do
echo wav2mp3: converting $filename
mp3_filename="${filename[@]/%wav/mp3}"
lame --preset insane "$filename" "$mp3_filename"
echo wav2mp3: finished converting $filename
echo
done
@Lokua
Lokua / recursively-remove-node-modules.sh
Last active September 3, 2019 03:56
recursively removes node_modules folders
#! /bin/bash
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
@Lokua
Lokua / package.json
Last active February 13, 2020 01:14
Barebones testing and test-runner for node >= 13
{
"scripts": {
"test": "node ./path-to/test-runner.mjs"
}
}
import { dirname } from 'path'
import { fileURLToPath } from 'url'
export const getDirname = (importMetaUrl) =>
dirname(fileURLToPath(importMetaUrl))
// use as `getDirname(import.meta.url)`
@Lokua
Lokua / mockLocation.js
Created April 26, 2021 19:05
Mock location in jsdom tests
export const mockLocation = value =>
Object.defineProperties(window, {
location: {
value,
writable: true,
},
})
export const mockPathname = pathname =>
mockLocation({

convert series of images to gif

fmpeg -f image2 -framerate 2 -i %2d.jpg out.gif

convert series of images to mp4 (suitable for instagram, quicktime)

ffmpeg -f image2 -framerate 2 -i %2d.jpg -pix_fmt yuv420p -crf 17 -vcodec libx264 out.mp4
const originalError = console.error
beforeAll(() => {
jest.spyOn(console, 'error').mockImplementation((...args) => {
if (
typeof args[0] === 'string' &&
args[0].includes('inside a test was not wrapped in act')
) {
return
}