Skip to content

Instantly share code, notes, and snippets.

server.modules = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_compress",
"mod_fastcgi",
"mod_rewrite"
)
## a static document-root, for virtual-hosting take look at the
import platform
system, _, release, version, machine, processor = platform.uname()
system, release, version = platform.system_alias(system, release,version)
if (system == 'Darwin' and release == '9.1.0'):
#操作系统为Mac OSX 10.5
chroot_path = "/"
namedconf = "/etc"
elif (system == "FreeBSD" and release[:3] == "7.0"):
@Arbow
Arbow / SimpleWgetService.java
Created November 8, 2008 04:25
一个封装好的java wget库
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import org.apache.commons.codec.binary.Base64;
/**
% Create a signature of your data with Erlang
-module(signit.erl).
-export(start/0,sha_sign/0).
start() -> application:start(crypto).
%% Sign the data using SHA.
%% This will return a 20 byte key for the data
sha_sign(Data) ->
Sha_data = crypto:sha(Data),
#include <stdio.h>
int add(int i, int j, void (*continuation)(int)) {
int k = i + j;
continuation(k);
}
void print(int i) {
printf("%d\n", i);
}
def httpAuthUrlFetch(self, url, username, password, mheaders={}):
import base64
encoded = base64.b64encode(username + ':' + password)
authstr = "Basic " + encoded
mheaders['Authorization'] = authstr
return urlfetch.fetch(url, headers = mheaders)
@Arbow
Arbow / dame_shit.erl
Created July 28, 2008 02:10
These codes show bugs in Erlang's SUB BINARY OPTIMIZED mechanism
%% Notice:These codes show bugs in Erlang's SUB BINARY OPTIMIZED mechanism
-module(dame_shit).
-export([main/0, dame_shit/1, dame_shit2/1]).
dame_shit(Bin) ->
dame_shit(Bin, not_found).
dame_shit(Bin, found) ->
{found, Bin};
dame_shit(<<"\r\n", T/binary>>, not_found) ->
dame_shit(T, found);