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 October 5, 2023 16:15
ffmpeg commands to extract AAC audio from an MP4, edit it, and replace it
ffprobe foo.mp4 # Make sure the audio stream is aac.
ffmpeg -i foo.mp4 -vn -acodec copy foo.aac
ffmpeg -i foo.aac -acodec pcm_s16le foo.wav
# Edit foo.wav with audacity, save to foo_edited.wav.
ffmpeg -i foo_edited.wav -acodec aac foo_edited.aac
ffmpeg -i foo.mp4 -codec copy -an foo_silent.mp4
ffmpeg -i foo_silent.mp4 -i foo_edited.aac -shortest -c:v copy -c:a aac foo_edited.mp4
# Reduce file size and remove sounds
ffmpeg -i foo.mp4 -vcodec libx264 -crf 28 -an foo_out.mp4
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 October 24, 2022 14:55
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
@hSATAC
hSATAC / 256color.pl
Created July 20, 2011 14:48
256color.pl
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $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 <jtl@molehill.org>
# $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++) {