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 | |
# 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 |
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
-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 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 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 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 | |
HOSTS = %w(hummer astrom dn42 ldap wiefelspuetz astron icq www1 zardoz jabber1 debcache jabber2 unsafe dhcp kdc utur).map{ |s| "#{s}.hq.c3d2.de" } | |
=begin | |
Forward-resolves HOSTS and puts their IPv6 addresses suitable for BIND | |
reverse-lookup zonefiles. | |
=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
# /etc/nsswitch.conf | |
passwd: compat | |
group: compat | |
shadow: compat | |
hosts: files dns [NOTFOUND=continue] mdns4_minimal [NOTFOUND=continue] mdns6_minimal [NOTFOUND=continue] mdns4 [NOTFOUND=continue] mdns6 | |
networks: files | |
protocols: db files |
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 ruby1.8 | |
# | |
# Copyright 2009 Astro <[email protected]> | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
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
require 'nokogiri' | |
doc = Nokogiri::XML::Document.new | |
loop do | |
n = Nokogiri::XML::Element.new('e', doc) | |
n.add_namespace(nil, 'http://example.com') | |
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
[6 of 9] Compiling Neuronal.Operations ( Neuronal/Operations.hs, Neuronal/Operations.o ) | |
Neuronal/Operations.hs:42:33: | |
Couldn't match expected type `forall n. (Num n) => n' | |
against inferred type `Double' | |
In the first argument of `OpState', namely `opLinkWeight' | |
In the second argument of `($)', namely | |
`OpState opLinkWeight opNet' | |
In the expression: return $ OpState opLinkWeight opNet |
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
-- http://svn.pugscode.org/pugs/examples/adventure/adventure.pl | |
import Data.Char as Char | |
import Data.List (intercalate) | |
import Text.ParserCombinators.Parsec | |
import Control.Monad.State.Lazy | |
import System.Console.Editline.Readline | |
-- | |
-- Parser |
OlderNewer