This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aviglitch' | |
unless ARGV.size >= 2 | |
puts "Usage: ruby #{$0} INFILE PATTERN [FPS]" | |
puts " ruby #{$0} file.mp3 0010001000010011" | |
exit | |
end | |
infile, pattern, fps = ARGV | |
fps = 60 unless fps | |
cmd = "ffmpeg -i %s -sameq -r %d -vn tmp1.avi" % [infile, fps] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aviglitch' | |
unless ARGV.size >= 2 | |
puts "Usage: ruby #{$0} INFILE PATTERN [FPS]" | |
puts " ruby #{$0} file.mp3 0010001000010011" | |
exit | |
end | |
infile, pattern, fps = ARGV | |
fps = 60 unless fps | |
cmd = "ffmpeg -i %s -sameq -r %d -vn tmp1.avi" % [infile, fps] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tweet; | |
var twitter_id = ""; | |
var twitter_pw = ""; | |
var phase; | |
var setState = function(nextPhase) { | |
var s = {tweet: tweet, twitter_id: twitter_id, twitter_pw: twitter_pw, phase: nextPhase}; | |
phantom.state = JSON.stringify(s); | |
}; | |
if(!phantom.state.length) { | |
var i, args = Array.prototype.slice.apply(phantom.args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'ubygems' | |
require 'grope' | |
require 'RMagick' | |
class Grope::WSOWrapper | |
def undefined? | |
@wso.class.to_s == 'OSX::WebUndefined' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Redirect to the url in the server's clipboard | |
if defined? Rack then | |
Redirector = Rack::Builder.new { | |
use Rack::ContentLength | |
app = Proc.new { |env| | |
u = IO.popen('pbpaste', 'r+').read | |
[303, {'Location' => u, 'Content-Type' => 'text/plain'}, ['']] | |
} | |
run app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# make a human readable word-number-word style password. | |
# following wordlist is taken from http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt | |
l = %w( | |
acrobat africa alaska albert albino album | |
alcohol alex alpha amadeus amanda amazon | |
america analog animal antenna antonio apollo | |
april aroma artist aspirin athlete atlas | |
banana bandit banjo bikini bingo bonus | |
camera canada carbon casino catalog cinema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
christmas:~ ucnv$ sudo gem install mac-robot | |
WARNING: Improper use of the sudo command could lead to data loss | |
or the deletion of important system files. Please double-check your | |
typing when using sudo. Type "man sudo" for more information. | |
To proceed, enter your password, or type Ctrl-C to abort. | |
Password: | |
Fetching: mac-robot-0.2.1.gem (100%) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="https://youpy.jottit.com/%E5%8A%A0%E7%80%AC%E4%BA%AE">加瀬亮</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'fileutils' | |
require 'erb' | |
require 'rmagick' | |
require 'open-uri' | |
require 'openssl' | |
require 'base64' | |
require './jpg_encoder' # https://gist.github.com/ucnv/708485 | |
class XJPG < JPGEncoder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'zlib' | |
require 'chunky_png' | |
p = ChunkyPNG::Datastream.from_file(ARGV.first) | |
a = p.data_chunks.inject('') { |b, c| b + c.content } | |
d = Zlib::Inflate.new().inflate(a) | |
d.gsub!(/0/, '1') | |
e = Zlib::Deflate.deflate(d) | |
p.data_chunks = [ChunkyPNG::Chunk::ImageData.new('IDAT', e)] | |
p.save('./out.png') |