Skip to content

Instantly share code, notes, and snippets.

View richjenks's full-sized avatar
🏍️

Rich Jenkins richjenks

🏍️
View GitHub Profile
@richjenks
richjenks / gist:03fc1b3a1c8e187229d077451b75b87c
Last active August 6, 2025 18:28
Optimise video for web
ffmpeg -i INPUT.WEBM \
-c:v libx264 -preset slow -crf 23 -profile:v high -level 4.1 \
-g 60 -keyint_min 60 \
-pix_fmt yuv420p -movflags +faststart \
-c:a aac -b:a 128k -ac 2 -ar 44100 \
-vsync cfr \
OUTPUT.MP4
@richjenks
richjenks / snow.js
Last active December 2, 2019 13:17
(function () {
var snowflakes = [],
moveAngle = 0,
animationInterval;
/**
* Generates a random number between the min and max (inclusive).
* @method getRandomNumber
* @param {Number} min
* @param {Number} max
@richjenks
richjenks / vue.config.js
Created November 29, 2019 14:56
Serve a Vue project in a subdirectory based on environment
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/dist/' : '/'
}
@richjenks
richjenks / wp-find-replace-sh
Created April 16, 2019 15:11
Find-and-replace in a WP database on Pantheon
terminus wp vzaar.test -- search-replace vzaar.com qavzr.com --dry-run
@richjenks
richjenks / README.md
Created April 12, 2019 11:41
Webpage Data to TSV

Webpage Data to TSV

Copy data from a webpage to your clipboard so it's ready to be pasted into a spreadsheet.

For example, say there are a list of links on a page and you want to get the ID, link text, and href.

All we're doing is iterating through each item, constructing a series of tab-separated value rows and copying it to the clipboard.

Make sure each item is separated with a tab and each row is terminated with a newline.

@richjenks
richjenks / ffmpeg-folder.bat
Created October 6, 2018 13:14
Convert an entire folder with ffmpeg
for %A IN (*.m4b) DO ffmpeg -i "%A" "%%A.mp4"
@richjenks
richjenks / check-cookie-exists.js
Created October 1, 2018 09:22
One-line check for whether a given cookie name exists
add_action('after_setup_theme', function () {
remove_action('init', 'portfolio_register');
});
@richjenks
richjenks / ffmpeg-gifv.sh
Last active March 21, 2025 11:39
Takes a video, removes the audio and compresses the sh!t out of it
ffmpeg -i input.mkv -an -preset veryslow -c:v h264 output.mp4
@richjenks
richjenks / ffprobe-video-audio-codec.sh
Created March 25, 2018 16:25
Get the video/audio codec of the first stream in a video file
# Video
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 input.mp4
# Audio
ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 input.mp4