Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# Based on https://gist.github.com/165171
require 'ubygems'
require 'rmagick'
require 'webrick'
require 'webrick/httpproxy'
handler = Proc.new do |req, res|
if req.host =~ /^cbk\d+\.google/ and res['content-type'] =~ /jpeg/
#!/bin/sh
rm out/*
./webpconv -quality 100 -output_dir out img/*
cd out
for f in *.webp; do cat $f | sed 's/a/b/' > x-$f; done
../webpconv -format PNG x-*
// ==UserScript==
// @name Delicious Skull
// @namespace http://aspietribe.com/
// @include http://www.delicious.com/*
// ==/UserScript==
document.getElementById('pagetitleContent').style.backgroundPosition = '0 -1900px';
require 'aviglitch'
unit = 3
step = 1
cmd = "ffmpeg -i %s -an -vcodec copy -r 30 tmp.avi" % ARGV.shift
system cmd
g = AviGlitch.open "tmp.avi"
g.glitch :keyframe do |x|
nil
require 'aviglitch'
require 'fileutils'
base = "resource.avi"
insert = "text.avi"
audio = "bgm.mp3"
#--------------
FileUtils.rm_r 'tmp' if File.exist? 'tmp'
FileUtils.mkdir 'tmp'
require 'aviglitch'
a = AviGlitch.open ARGV.shift
a.glitch :keyframe do |f|
nil
end
a.glitch :audioframe do |f|
f.gsub /\d/, "0"
end
a.output 'o.avi'
path = File::expand_path ARGV.shift
scpt = <<SCPT
tell application "Finder"
activate
select POSIX file "#{path}"
end tell
tell application "System Events"
tell process "Finder"
keystroke "y" using {command down, option down}
end tell
require 'echonest'
require 'aviglitch'
audio, *videos = ARGV
apikey = "YOUR-ECHONEST-API-KEY"
beat_threshold = 0.15
fps = 30
tmp = 'tmp.avi'
outfile = "out.mp4"
#!/usr/bin/env ruby
# Test script for yet another JPEG glitch technique.
# Rewrite YCbCr sampling factors in JPEG header.
# It's a version of http://gist.github.com/167060
require 'erb'
data = File.open(ARGV.first) {|f| f.read }
data.force_encoding Encoding::BINARY
sof0 = data.index "\xFF\xC0"
ns = data[sof0 + 9].unpack('C').first
# http://dl.dropbox.com/u/4316370/reversed_frames.mp4
require 'aviglitch'
a = AviGlitch.open ARGV.shift
# datamosh
a.glitch(:keyframe) do |f|
nil
end
# reverse
q = a.frames[-1, 1]