Skip to content

Instantly share code, notes, and snippets.

def rifftree io, depth = 0, len = 0
offset = io.pos
while id = io.read(4) do
if len > 0 && io.pos >= offset + len
io.pos -= 4
break
end
size = io.read(4).unpack('V').first
out = depth > 0 ? ' ' * depth + id : id
#!/usr/bin/env ruby
require 'docopt'
doc = <<DOCOPT
Usage:
#{File.basename __FILE__} <dpi> <px> [--verbose]
Options:
-v --verbose Show numbers after the decimal point.
-h --help Show this screen.

グリッチに関するノート

ヒュー S. マローン/ダニエル・テムキン

データベンディング、データモッシング、イメージハッキング、そしてグリッチアート、様々な名称で呼ばれる一連の手法を定義し、また理論化しようと、一年以上にわたり作家たちと断続的な議論を繰り返し以下の文章は生まれた。これらの「ノート」は完全でもないし結論的なものでもなく、復習し議論し批評し解釈を拡大させていくための、ゆるやかに描かれた一群の図を提供するものである。


@ucnv
ucnv / sabotage.md
Last active December 5, 2019 07:55

サボタージュ!グリッチ政治学の手引き

カート・クロニンガー/ニック・ブリッツ

1 コンピュータは間違いを犯さない、人々が犯すのだ。同じ変数で、同じ入力なら、コンピュータは常に同じ出力を表示する。しかしながら、しばしばプログラマーが手を滑らせ、ループを閉じるのをわすれたり、不意にメモリリークを残したりする。しばしばユーザーは想定されていないやり方でファイルを開くし、ファイル転送が終わらないうちにUSBを引き抜いたりする。それがまったくありきたりな、しかし想定外の出力結果を導く。私達はそれをコンピュータのせいにし、その瞬間のことをグリッチと呼ぶ。

2 おそらく、グリッチとはシステム障害のことだと思われているだろう。我々の目的にかなった実際的な見方によれば、その障害がシステムの輪郭をはっきりと暴く、そのやり方にこそ価値がある。無数の違った失敗の仕方があり、それぞれが新しい方法でシステムの振る舞いのユニークな(ユニークに利用可能な)輪郭を描く。ハイデガーの壊れた鉄槌により世界全体を停止点検する(我々のすべてのキンタマ道具、キンタマ計測、靴、ワークショップ、丘の中腹、牛の隠れ家、雨、ふくろう、大槌、ファミコン)。我々が暗黙のうちに使っている世界、気付かぬうちに巻き込まれている世界を。しかし、だからなんだ?壊れた鉄槌を見つめるのをやめて、もっと鉄槌を壊してみよう。無数の壊れた鉄槌。

require 'image_size'
require 'cocaine'
infile = ARGV.shift # must be png
size = ImageSize.path infile
png_yuv = 'tmp/' + File.basename(infile) + '.yuv'
cmd = Cocaine:: CommandLine.new 'convert', 'png::in -sampling-factor 4:2:0 -depth 8 :out'
cmd.run in: infile, out: png_yuv
yuv_hevc = png_yuv + '.hevc'
require 'fileutils'
require 'tmpdir'
require 'cocaine'
require 'aviglitch'
infile = ARGV.shift
skip = (ARGV.shift || 1).to_i
outfile = './out.avi'
info = Cocaine::CommandLine.new('ffmpeg', '-i :in 2>&1', :expected_outcodes => [0, 1]).run(:in => infile)
tbc = info.match /(¥d+) tbc/
@ucnv
ucnv / png.rb
Created March 10, 2013 08:20
Glitch PNG with ChunkyPNG
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')
@ucnv
ucnv / generate.rb
Last active December 14, 2015 18:09
scripts for Jpegs In Your Brain
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
<a href="https://youpy.jottit.com/%E5%8A%A0%E7%80%AC%E4%BA%AE">加瀬亮</a>
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%)