Skip to content

Instantly share code, notes, and snippets.

View DavidEGrayson's full-sized avatar

David Grayson DavidEGrayson

View GitHub Profile
@DavidEGrayson
DavidEGrayson / ffmpeg_commands.sh
Last active June 7, 2025 00:32
ffmpeg commands to extract AAC audio from an MP4, edit it, and replace it
# Reduce file size. Might need '-vcodec libx264' in some cases?
ffmpeg -i foo.mp4 -crf 28 foo_out.mp4
# Reduce file size, rescale to 1080p, and crop in time and space.
ffmpeg -i foo.mp4 -crf 28 -ss 00:00:25 -to 00:01:15 -vf "scale=1920:-1,crop=1920:800:0:1900" foo_out.mp4
# Reduce file size, crop a video in time and scale it to 1080p
ffmpeg -i foo.mp4 -crf 28 -ss 00:01:00 -to 00:00:10 -vf scale=1920:-1 output.mp4
ffprobe foo.mp4 # Make sure the audio stream is aac.
data UpdateSource = VersionSet{ versionExpr :: NExprLoc
, sources :: [UpdateSource]
}
| FetchGit{ args :: FetchGitArgs
, sources :: [UpdateSource]
}
-- This is the 'para' function from the 'recursion-schemes' package
-- I've made the type signature specific to NixExprLoc
para :: (NixExprLocF (NixExprLoc, a) -> a) -> NixExprLoc -> a
@DavidEGrayson
DavidEGrayson / README.md
Last active November 28, 2024 18:11
Getting started with midipix
@DavidEGrayson
DavidEGrayson / hex_inspect.rb
Last active August 29, 2015 13:58
Ruby snippet that lets you see the actual bytes in a string.
class String
def hex_inspect
'"' + each_byte.map { |b| '\x%02x' % b }.join + '"'
end
end
@BlakeGardner
BlakeGardner / install nano.sh
Last active June 22, 2025 04:31
Syntax highlighting in nano on Mac OS
# Last updated May, 2024 for Apple silicon Macs
# Install Homebrew if you don't already have it: https://brew.sh
# install nano from homebrew
brew install nano nanorc
# update your nanorc file
echo 'include "'"$(brew --cellar nano)"'/*/share/nano/*.nanorc"' >> ~/.nanorc
# close and re-open your terminal and you'll have syntax highlighting
@hSATAC
hSATAC / 256color.pl
Created July 20, 2011 14:48
256color.pl
#!/usr/bin/perl
# Author: Todd Larason <[email protected]>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
@bkerley
bkerley / ecc.rb
Created June 29, 2011 21:42
ruby ECDSA fun time
# derived from http://h2np.net/tips/wiki/index.php?RubyOpenSSLDigitalSignatureSample
require 'openssl'
require 'base64'
include OpenSSL
group_name = 'secp521r1'
message = '10000 fartbux sent to bryce from a can of beans'
key = PKey::EC.new(group_name)
key = key.generate_key
#!/usr/bin/perl
# Author: Todd Larason <[email protected]>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {