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 | |
require 'RMagick' | |
include Magick | |
infile, outfile = ARGV | |
unless infile && outfile | |
puts "Usage: #{$0} <infile> <outfile>" | |
exit 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
is_prime 1 = False | |
is_prime 2 = True | |
is_prime x = not (any (\n -> x `rem` n == 0) [2..(x `div` 2)]) | |
primes = [x | x <- [1..], is_prime x] | |
primes_until n = takeWhile (<= n) primes |
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
-module(codepoint). | |
-export([codepoint_to_utf8/1, test/0]). | |
%% See: http://en.wikipedia.org/wiki/Utf-8#Description | |
%% TODO: endianess | |
codepoint_to_utf8(CP) when CP =< 16#7F -> | |
[CP]; | |
codepoint_to_utf8(CP) when CP =< 16#7FF -> |
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 | |
# An attempt to create an efficient HTTP client using eventmachine, utilizing HTTP pipelining. I reconsidered and decided it would be more natural to hack this in Erlang. Please finish. | |
require 'yaml' | |
require 'eventmachine' | |
require 'dnsruby' | |
require 'uri' | |
require 'zlib' | |
Dnsruby::Resolver::use_eventmachine true |
NewerOlder