Skip to content

Instantly share code, notes, and snippets.

View archaelus's full-sized avatar

Geoff Cant archaelus

  • San Francisco, CA
View GitHub Profile
@archaelus
archaelus / mochiweb_loop.erl
Created March 9, 2009 20:30
mochiweb pre-gzipped content example
serve_gzipped_files(Req, RelPath, DocRoot) ->
case mochiweb_util:safe_relative_path(RelPath) of
undefined ->
Req:not_found();
SafeRelPath ->
serve_gzipped_files2(Req, SafeRelPath, DocRoot)
end.
serve_gzipped_files2(Req, SafeRelPath, DocRoot) ->
Header = case Req:get_header_value("Accept-Encoding") of
A Fail event had been detected on md device /dev/md1.
It could be related to component device /dev/sdd1.
Faithfully yours, etc.
P.S. The /proc/mdstat file currently contains the following:
Personalities : [raid1] [raid6] [raid5] [raid4]
md3 : active raid5 sdb3[0] sda3[4] sde3[3] sdc3[1]
Content analysis details: (6.6 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-3.3 ALL_TRUSTED Did not pass through any untrusted hosts
-2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1%
[score: 0.0000]
13 AWL AWL: From: address is in the auto white-list
%% @copyright Geoff Cant
%% @author Geoff Cant <[email protected]>
%% @version {@vsn}, {@date} {@time}
%% @doc EWGI Mochiweb example app.
%% @end
-module(ewex_web).
-export([start/0,stop/0,
loop/1,app_run/1]).
require 'brewkit'
class ErlangManuals <Formula
@version='5.7.3-snapshot'
@homepage='http://www.erlang.org'
@url='http://erlang.org/download/snapshots/otp_man_R13B02_2009-09-04_18.tar.gz'
@md5='fa8f96159bd9a88aa2fb9e4d79d7affe'
end
class ErlangHtmldocs <Formula
require 'brewkit'
class ErlangManuals <Formula
url 'http://www.erlang.org/download/otp_doc_man_R13B02-1.tar.gz'
md5 'b5f7b20faa049a8b6a753fc7a462d02d'
end
class ErlangHtmlDocs <Formula
url 'http://erlang.org/download/otp_doc_html_R13B02-1.tar.gz'
md5 'd48da533b49f7b32c94032f2a53c0073'
class Cleaner
def initialize f
@f=f
# correct common issues
share=f.prefix+'share'
(f.prefix+'man').mv share rescue nil
[f.bin, f.sbin, f.lib].each {|d| clean_dir d}
PrintSrc = fun (Module) ->
{ok,{_,[{abstract_code,{_,AC}}]}} =
beam_lib:chunks(code:which(Module),[abstract_code]),
io:put_chars(erl_prettypr:format(erl_syntax:form_list(AC)))
end.
build_rel_file({ReleaseName, ReleaseVSN}, RelFileName, Apps) ->
Deps = walk_deps(Apps),
{ok, FD} = file:open(RelFileName, [write]),
RelInfo = {release,
{ReleaseName, ReleaseVSN},
{erts, erts_vsn()},
[{Pkg, lib_vsn(Pkg)} || Pkg <- Deps]
},
io:format(FD, "~p.", [RelInfo]),
file:close(FD).
%% @copyright Geoff Cant 2009, 2010
%% @author Geoff Cant <[email protected]>
%% @version {@vsn}, {@date} {@time}
%% @doc Erlang shell code to trace the messages for one process.
%% @end
dbg:stop_clear(),
f(GL).
GL=group_leader(),
dbg:tracer(process,