Skip to content

Instantly share code, notes, and snippets.

Avatar

Jahed jahed

View GitHub Profile
@jahed
jahed / sri.md
Last active Sep 13, 2020
Validating SRI Hashes
View sri.md

Validating SRI Hashes

In case the browser starts complaining about invalid SRI hashes.

curl -s <URL> | openssl dgst -sha256 -binary | openssl enc -base64
@jahed
jahed / ffmpeg-tricks.md
Last active Apr 22, 2021
FFMPEG Tricks
View ffmpeg-tricks.md

FFMPEG Tricks

Merging Multiple Audio Tracks

Useful for gamerips where music is split into multiple tracks for dynamic mixes and need to be merged together for a true track.

amerge is more flexible than amix so prefer using amerge.

@jahed
jahed / live-query.md
Created Jun 30, 2020
Live Query JSON with fzf
View live-query.md
@jahed
jahed / find-tips.md
Last active May 6, 2020
Batch image optimisation.
View find-tips.md

Add -mtime -2 to limit files by last modified time. -2 to means "in the last 2*24 hours from now".

@jahed
jahed / downloadChromeWebDriver.sh
Created Feb 4, 2020
Downloads and extracts the correct chromedriver binary for the currently installed Chromium/Chrome version.
View downloadChromeWebDriver.sh
#!/usr/bin/env bash
set -xeuo pipefail
function get_major_version () {
echo "${1}" | grep -Po '[^0-9]+\K(\d+)' | head -n1
}
function get_version () {
echo "${1}" | grep -Po '[^0-9]+\K([0-9.]+)' | head -n1
}
@jahed
jahed / bsnes-fedora.md
Last active Dec 29, 2019
BSNES on Fedora 31
View bsnes-fedora.md

BSNES on Fedora 31

Download BSNES

Download BSNES binary here: https://byuu.org/bsnes

Install Dependencies

Run BSNES from a terminal and see if it complains about missing files. You can install some of them using:

@jahed
jahed / drive-problems.md
Last active Jun 21, 2020
All the problems with my Linux installation and how to fix it
View drive-problems.md

NTFS drives are read-only

Caused by Windows' Fast Boot and affects all NTFS drives. Disable it in Windows settings and restart.

Temporary Fix:

sudo ntfsfix /dev/sdc1
@jahed
jahed / imagemagick-tricks.md
Last active Jan 24, 2021
ImageMagick Tricks
View imagemagick-tricks.md

ImageMagick Tricks

Cutting Up Tiles

convert image.png -crop 128x128 +repage +adjoin tile-%d.png

Autocrop Empty Space

View stub-react.js
function ensureNodes(children) {
if (Array.isArray(children[0])) {
return ensureNodes(children[0])
}
return children
.filter(child => !!child)
.map(child => {
if (typeof child === 'string') {
return document.createTextNode(child);
View Google Drive CSV Export
https://docs.google.com/spreadsheets/d/%s/export?gid=0&single=true&format=csv
https://docs.google.com/spreadsheets/d/{key}/gviz/tq?tqx=out:csv&sheet={sheet_name}