Skip to content

Instantly share code, notes, and snippets.

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'
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'
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
// ==UserScript==
// @name Delicious Skull
// @namespace http://aspietribe.com/
// @include http://www.delicious.com/*
// ==/UserScript==
document.getElementById('pagetitleContent').style.backgroundPosition = '0 -1900px';
#!/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-*
#!/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/
# This file is a kind of Ruby port of JPGEncoder.as
# <https://github.com/mikechambers/as3corelib/blob/master/src/com/adobe/images/JPGEncoder.as>
# Copyright (c) 2008, Adobe Systems Incorporated
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
require './jpg_encoder' # https://gist.github.com/708485
class XJPG < JPGEncoder
def process_DU *args
@zigzag_o = @zigzag_o || @zigzag
@zigzag = @zigzag_o.shuffle
super *args
end
end
require 'aviglitch'
a = AviGlitch.open ARGV.shift
keys = []
a.frames.each_with_index do |f, i|
keys << i if f.is_keyframe?
end
keys.each do |i|
fa = a.frames[i]
fb = a.frames[i+1]
// ==UserScript==
// @name Tokyo Kafun on Twitter
// @namespace http://userscripts.org/users/40991
// @include http://twitter.com/*
// ==/UserScript==
function i(d) {
var n = d ? new Date(d) : new Date();
var y = n.getFullYear().toString();
var m = ('0' + (n.getMonth()+1)).match(/\d{2}$/)[0];