Skip to content

Instantly share code, notes, and snippets.

@RoxasShadow
RoxasShadow / shinbo.rb
Last active December 19, 2015 13:59
Dat Shinbo that headtilts in #omnivium.
##
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@RoxasShadow
RoxasShadow / crunchybot.rb
Last active December 19, 2015 17:19
Crunchyroll bot for IRC
##
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
class Query
def initialize(&block)
instance_eval(&block)
end
def select(select); @select = select; end
def from (from ); @from = from ; end
def where(op, where)
(@where ||= []) << [ op, where]
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define CENTER 0
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) {
HWND hwnd;
char *title;
INTERFACE = ARGV[0] || 'wlan0'
class Float; def to_mb; self / 1048576; end; end
initial = (ARGV[1] || 0 ).to_f
available = (ARGV[2] || 100).to_f
delay = (ARGV[3] || 5 ).to_f
left = 0
initial = File.read('.band') if !ARGV[1] && File.exists?('.band')
abort 'mkv needed' if ARGV.empty?
input = ARGV[0]
folder = File.dirname input
target = folder + '\\' + (ARGV[1] || (File.basename(input) + '.ass'))
system "mkvextract tracks \"#{input}\" 2:\"#{target}\""
require 'benchmark'
time = Benchmark.realtime do
puts [].tap { |ary|
1000.times { |i|
ary << i
}
}.length
end
puts "Time elapsed #{time*1000} milliseconds"
class String
def contained_in?(ary)
ary.each { |elm|
return true if self.include? elm
}
false
end
end
puts 'ciao marco'.contained_in? [ 'ciao', 'we' ]
require 'money'
jpy = [ # http://www.amiami.com/top/cart/wishlist?wish_scode=FIGURE-001918
{ :name => 'Makise Kurisu', :price => 6280, :buy => false }, # Steins;Gate
{ :name => 'Shiki Ryougi', :price => 4480, :buy => false }, # Kara no Kyoukai
{ :name => 'BakeCoin', :price => 750, :buy => true }, # Monogatari
{ :name => 'BakeMousePad', :price => 470, :buy => true }, # Monogatari
{ :name => 'BakeCoin', :price => 750, :buy => true }, # Monogatari
{ :name => 'Rin Shibuya', :price => 7020, :buy => false }, # iDOLM@STER
{ :name => 'Riko Sunomie', :price => 5500, :buy => false }, # KissXSis
require 'money'
require 'json'
require 'open-uri'
if ARGV.length == 3
from = ARGV[0]
to = ARGV[1]
money = ARGV[2].to_f
else
from = 'JPY'