Skip to content

Instantly share code, notes, and snippets.

http://develop.github.com/p/repo.html
=begin rdoc
=Introduction
ForkManager is a very simple Class for managing the forking of
processes in a controlled manner. ForkManager allows for the limiting
of concurrent child processes to a number specified by the user.
Copyright (c) 2006 Dustin Spinhirne - http://spinhirne.com
Licensed under the same terms as Ruby, No Warranty is provided.
require 'socket'
server=TCPServer.new '127.0.0.1',9090
3000.times{
f=server.accept
puts f.gets
f.print "HTTP/1.1 200/OK\r\n"
f.print "content-type:text/html\r\n\r\n"
f.puts rand
f.close
}
puts DATA.read.scan(/\w+/).inject({}){|s,w|
w.downcase!
s[w]||=0
s[w]+=1
s
}.sort_by{|k,v|v}.reverse.map{|k,v|"#{k}: #{v}"}
__END__
<<word counter with ruby>>
counter is great
using ruby for counter
require 'ffi-inliner'
module A
extend Inliner
inline '
int sum(int e){
int s=0,i=0;
for(i=1;i<=e;i++){
s+=i;
}
return s;
require 'ffi'
module A
extend FFI::Library
ffi_lib 'user32'
attach_function :msg,:MessageBoxA,[:pointer,:string,:string,:int],:int
end
A.msg(nil,"good",'ruby',0)
#http://www.matthulse.com/past/2009/9/15/testing/
http://www.countryipblocks.net/country-blocks/ip-range-format/
==
task :get_link do
require 'forkoff'
#http://www.countryipblocks.net/country-blocks/ip-range-format/
data=%{
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
@axgle
axgle / upload
Created October 27, 2009 14:44
upload.txt
http://modporter.com/
upload是web.app的一个有趣应用!~
研究一下ror文件上传相关的一些技术
===
关注ror而非ruby(ruby是小日本的干活。xd国内舆论。。。)
ror是web相关的:http://weblog.rubyonrails.org/2009/10/22/community-highlights
可见这方面的东西,涉及的知识是挺广泛的。例如:upload就是很有用的功能~~
sudo apt-get install festival lame
===================================
WARNING
No default voice found in ("/usr/share/festival/voices/")
either no voices unpacked or voice-path is wrong
Scheme interpreter will work, but there is no voice to speak with.
WARNING
-=-=-=-=-=- EST Error -=-=-=-=-=-
{FND} Feature Token_Method not defined
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#include "stdio.h"
#include <stdlib.h>
#include "string.h"
#include <curl/curl.h>
int main(void)
{
CURL *curl;
char ires;
curl=curl_easy_init();