This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert a list of 10 colors (eg. generated by https://primer.style/prism/) | |
// to a Firefox theme manifest. | |
// | |
// name: The name of the theme. | |
// colors: An array of 10 colors. | |
// id: The ID of the theme. Format: "your-add-on-name@your-domain.com". | |
// version (optional): The version of the theme. Format: "<major>.<minor>". | |
// | |
// Docs: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Game rules: https://twitter.com/deathbybadger/status/1567425842526945280 | |
const resultCounter = { | |
whisked: 0, | |
burrowed: 0, | |
eaten: 0, | |
}; | |
const gameState = {}; | |
const roll = () => Math.floor(Math.random() * 6); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://evilmartians.com/chronicles/better-web-video-with-av1-codec | |
# Encode as H.264. Reduce quality by increasing the CRF value. If you're looking for an output that is roughly "visually lossless" but not technically lossless, use a -crf value of around 17 or 18. | |
ffmpeg -i <SOURCE> -map_metadata -1 -c:a libfdk_aac -c:v libx264 -crf 28 -preset veryslow -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.h264.mp4 | |
# Encode as AV1. Reduce quality by increasing the CP value. | |
ffmpeg -i <SOURCE> -map_metadata -1 -c:a libopus -c:v librav1e -qp 80 -tile-columns 2 -tile-rows 2 -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.av1.mp4 | |
# Encode as HEVC. Reduce quality by increasing the CRF value. | |
ffmpeg -i <SOURCE> -map_metadata -1 -c:a libfdk_aac -c:v libx265 -crf 28 -preset veryslow -pix_fmt yuv420p -movflags +faststart -tag:v hvc1 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.hevc.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Validate a Canadian Social Insurance Number (SIN) | |
* @param {num || str} sin A 9-digit Canadian SIN | |
* @return {bool} Validity of the input SIN | |
*/ | |
function validateSIN (sin) { | |
var check, even, tot; | |
if (typeof sin === 'number') { | |
sin = sin.toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES=(*.mp3) | |
for i in "${!FILES[@]}"; do | |
id3v2 -T "$((i + 1))/${#FILES[@]}" "${FILES[i]}" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for d in */; do | |
cd "$d" | |
say "$d" -o "00. Title.aiff" | |
lame -m m "00. Title.aiff" "00. Title.mp3" | |
rm "00. Title.aiff" | |
cd .. | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in {001..100}; do | |
say ${i##+(0)} -o "$i.aiff" | |
lame -m m "$i.aiff" "$i.mp3" | |
rm "$i.aiff" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ENABLE_IMAGE_ROTATIONS = true; | |
const ITERATIONS_PER_ROTATION = 10000000; | |
const MAX_GATES_TOTAL = 20; | |
const MAX_TREE_DEPTH = 6; | |
const rand = array => array[Math.floor(Math.random() * array.length)]; | |
const unique = (x, i, array) => array.indexOf(x) === i; | |
const limit = (name, f, lo, hi = lo) => (...args) => { | |
const { length: l } = args; | |
if (l < lo || l > hi) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p woff && for f in *.ttf; do sfnt2woff "$f"; woff2_compress "$f"; done && mv *.woff* woff | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES=($(ls -tUr *.{png,jpeg})) | |
for i in "${!FILES[@]}"; do | |
mv "${FILES[i]}" "$(printf "%02d.${FILES[i]##*.}" "$((i + 1))")" | |
done |