Skip to content

Instantly share code, notes, and snippets.

View jahed's full-sized avatar

jahed.dev jahed

View GitHub Profile
@jahed
jahed / upgrade.sh
Last active November 24, 2021 22:15
Upgrade NPM Dependencies
#!/usr/bin/env bash
set -euo pipefail
echo "SETTING UP"
npm ci
npm install npm-check-updates
npm upgrade npm-check-updates
echo
echo "UPGRADING MINOR VERSIONS"
@jahed
jahed / sri.md
Last active September 13, 2020 16:54
Validating SRI Hashes

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 May 28, 2023 17:54
FFMPEG Tricks

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.

-ac is to set the number of audio channels (e.g. -ac 2 for stereo)

@jahed
jahed / live-query.md
Created June 30, 2020 15:32
Live Query JSON with fzf
@jahed
jahed / find-tips.md
Last active May 6, 2020 19:03
Batch image optimisation.

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 February 4, 2020 14:18
Downloads and extracts the correct chromedriver binary for the currently installed Chromium/Chrome version.
#!/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 / drive-problems.md
Last active June 21, 2020 20:11
All the problems with my Linux installation and how to fix it

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 January 24, 2021 00:12
ImageMagick Tricks

ImageMagick Tricks

Cutting Up Tiles

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

Autocrop Empty Space

@jahed
jahed / stub-react.js
Created September 28, 2018 15:36
Stub React
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);
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}