It reads your torrents. Spit out magnet URIs.
$ ./magneto.rb magneto.rb.torrentResults in:
| require 'singleton' | |
| class Example | |
| include Singleton | |
| attr_accessor :keep, :strip | |
| def _dump(depth) | |
| # this strips the @strip information from the instance | |
| Marshal.dump(@keep, depth) | |
| end |
| require 'nokogiri' | |
| require 'open-uri' | |
| items = Array.new | |
| prices = Array.new | |
| doc = Nokogiri::HTML(open("http://www.thinkgeek.com/caffeine/feature/desc/0/all")) | |
| items = doc.xpath("//div/a/h4").collect {|node| node.text.strip} |
| # using fibers count words number of occurences in a file | |
| words = Fiber.new do | |
| File.foreach("samp.txt") do |line| | |
| line.scan(/\w+/) do |word| | |
| Fiber.yield word.downcase | |
| end | |
| end | |
| nil | |
| end |
| class Node | |
| attr_accessor :node, :next | |
| def self.last(node) | |
| return node if node.next.nil? | |
| node = last node.next | |
| end | |
| def self.reverse(node) | |
| return node if node.next.nil? |
| package pack; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileNotFoundException; | |
| import java.io.IOException; | |
| public class TriangleNumbersPuzzle | |
| { | |
| private static int returnNumberOfDivisors(int inNum) |
| =begin | |
| * Method should accept two parameters. First parameter is first number to display, second parameter should be number of rows to be printed. | |
| * Any programming language is fine. | |
| * Sample: printseries(7,4) | |
| * Output should be: | |
| * 7 | |
| * 14 15 | |
| * 28 29 30 31 | |
| * 56 57 58 59 60 61 62 63 | |
| =end |
It reads your torrents. Spit out magnet URIs.
$ ./magneto.rb magneto.rb.torrentResults in:
| require 'socket' | |
| require 'win32/sound' #gem install win32-sound | |
| require 'bigdecimal' | |
| require 'bigdecimal/math' | |
| include BigMath | |
| include Win32 | |
| server = TCPServer.new("127.0.0.1",9090) | |
| request = "" | |
| bytest = "" |
| require 'socket' | |
| server = TCPSocket.open("127.0.0.1", 9090) | |
| puts "You have the following options on this devilish server: \r" | |
| puts "Type '%time' to see the time \r" | |
| puts "Type '%hastalavista' to see the exit \r" | |
| puts "Type '%pie' for some pie \r" | |
| puts "Type '%why' to get some answer \r" | |
| puts "Type '%Showtime' to get the image \r" | |
| puts "Type '%nyan' to listen some music \r" |
| #!/usr/bin/env ruby -w | |
| require "socket" | |
| class Server | |
| def initialize( port, ip ) | |
| @server = TCPServer.open( ip, port ) | |
| @connections = Hash.new | |
| @rooms = Hash.new | |
| @clients = Hash.new | |
| @connections[:server] = @server | |
| @connections[:rooms] = @rooms |