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 'rubygems' | |
require 'xmlrpc/client' | |
require 'bencode' | |
require 'fileutils' | |
mode = :list if ARGV[0] == nil | |
if ARGV[0] == nil | |
mode = :list |
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
import java.util.Collections; | |
import java.util.Iterator; | |
import java.util.Vector; | |
public class testClass { | |
public static void main(String[] args) { | |
System.out.println("Hello World"); | |
weirdClass wc = new weirdClass(); |
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 'rubygems' | |
require 'mechanize' | |
require 'nokogiri' | |
unless ARGV.size == 2 | |
STDERR.puts "$0 trackid last-four-phone-digits" | |
exit 1 | |
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 | |
require 'fileutils' | |
def base_dir | |
File.dirname(File.expand_path(__FILE__)) | |
end | |
def read_matrix path, file | |
IO.readlines(File.join(path, file))\ |
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
def chunks a, size | |
chunk_count = a.size/size | |
chunk_count -= 1 if (a.size % size) == 0 | |
(0..chunk_count).map do |k| | |
a.slice(k*size, size) | |
end | |
end | |
chunks((1...100).to_a, 20).each { |x| puts x.inspect } |
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
# encoding: UTF-8 | |
require 'nokogiri' | |
doc = Nokogiri::HTML($stdin.read) | |
doc.search('//a[contains(@href, \'wiki\') or contains(@href, \'omsk\')]'). | |
each { |a| a.replace(doc.create_text_node(a.text)) } | |
doc.search('//sup').remove | |
puts doc.to_html |
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 'fileutils' | |
raise 'This is ruby 1.9 script' if RUBY_VERSION =~ /^1\.8/ | |
def process file, simulate | |
raise 'Please point at movie file' if (File.extname(file) == '.srt' || !File.file?(file)) | |
name = File.basename(file) |
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 'uri' | |
magnet = URI.unescape ARGV.first | |
benc = "d10:magnet-uri#{magnet.size}:#{magnet}e" | |
exit(1) unless magnet =~ /xt=urn:btih:([a-zA-Z0-9]+)/ | |
File.open("meta-#{$1}.torrent", 'w') { |f| f.write benc } | |
#[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit; | |
#echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent" | |
# vim: ft=ruby |
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
#!/bin/sh | |
VOL=$1 | |
if [ -z "$VOL" ] ; then | |
echo Usage: $0 vol | |
exit 1 | |
fi | |
LABEL="" | |
command -v e2label > /dev/null && [ -z "$LABEL" ] && LABEL=`e2label $VOL 2>/dev/null` | |
command -v dosfslabel > /dev/null && [ -z "$LABEL" ] && LABEL=`dosfslabel $VOL 2>/dev/null` | |
command -v ntfslabel > /dev/null && [ -z "$LABEL" ] && LABEL=`ntfslabel -f $VOL 2>/dev/null` |
OlderNewer