This file contains hidden or 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
# ref. | |
# http://www.frexx.de/xterm-256-notes/ | |
$stdin.sync = true | |
filename = ARGV.shift | |
open(filename || '/dev/stdin') do |f| | |
f.each do |line| | |
line.unpack('U*') do |c| | |
print "\033[38;5;%im" % c |
This file contains hidden or 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 'scissor' | |
def main | |
max = 16 | |
max.times.inject([[random_sequence], Scissor()]) do |memo, i| | |
# workaround to avoid ecasound bug which occurs when the number of tracks is 3 or 10 (or more) | |
tracks = memo[0] + (max - (memo[0].size - 1)).times.map { Scissor.silence(1) } | |
memo[1] += (mix(tracks, 'tracks_%i.wav' % i) * 8) | |
memo[0] += [random_sequence] |
This file contains hidden or 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 'scissor' | |
def main | |
16.times.inject([[random_sequence], Scissor()]) do |memo, i| | |
memo[1] += (mix(memo[0], 'tracks_%i.wav' % i) * 8) | |
memo[0] << random_sequence | |
memo | |
end[1] >> 'result.wav' | |
end |
This file contains hidden or 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 'scissor' | |
# original | |
# http://beatsdrummachine.com/ | |
def main | |
@kits = { | |
:b => tape('house_2_1.wav'), | |
:s => tape('roland_tr_909_2.wav').pan(60), | |
:h => tape('house_2_5.wav') .pan(20), |
This file contains hidden or 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 'eventmachine-distributed-notification' | |
require 'ruby_gntp' | |
require 'json' | |
# EM.post_distributed_notification('growl_notify', msg) | |
EM.run { | |
EM.watch_distributed_notification('growl_notify') {|c| | |
(class << c; self; end).send(:define_method, :notify) {|name, info| | |
msg = info['data'] |
This file contains hidden or 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 | |
$stdin.each do |line| | |
print "\a" | |
$stdout.write line | |
end |
This file contains hidden or 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 macruby | |
framework 'AppKit' | |
require 'tempfile' | |
require 'shellwords' | |
class WindowController < NSWindowController | |
def awakeFromNib | |
@timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target:self, selector:'onTimer', userInfo:nil, repeats:true) |
This file contains hidden or 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
;; Google Suggest で補完 | |
(defun google-suggest () | |
(setq ac-source-mysource1-point ac-point) | |
(let (result buf (case-fold-search nil)) | |
(setq buf (get-buffer-create "*google-suggest*")) | |
(if (string-match "^[A-Z]" ac-prefix) | |
(with-current-buffer buf | |
(erase-buffer) | |
;; https://gist.github.com/2425165 | |
(call-process "/Users/youpy/work/google_suggest.rb" nil buf nil ac-prefix) |
This file contains hidden or 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
# encoding: utf-8 | |
require 'json' | |
require 'open-uri' | |
require 'nkf' | |
require 'cgi' | |
url_pattern = 'http://clients1.google.co.jp/complete/search?client=hp&hl=ja&q=%s' | |
content = NKF.nkf('-w', open(url_pattern % CGI.escape(ARGV.shift)).read) | |
content.sub!(/^[^\(]+\((.+)\)$/, '\1') |
This file contains hidden or 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 'ubygems' | |
require 'grope' | |
id, user = ARGV | |
env = Grope::Env.new | |
env.load('http://shindanmaker.com/%s' % id) | |
env.find('//input[@class="shindanuser"]').value = user | |
env.document.getElementById('form').submit | |
env.document.title |