Skip to content

Instantly share code, notes, and snippets.

View voluntas's full-sized avatar
🎲
Focusing

voluntas voluntas

🎲
Focusing
View GitHub Profile
case Spam of
<<1:32, B:32>> | <<2:32, B:32>> ->
... ;
<<1:16, 2:16, C/binary>> ->
...
end.
-module(sample).
-compile(export_all).
-record(store, {key, value}).
main() ->
crypto:start(),
mnesia:start(),
mnesia:create_table(store,
% erl
Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.5 (abort with ^G)
1> c(sample).
{ok,sample}
2> sample:main().
---> Processes holding locks <---
---> Processes waiting for locks <---
---> Participant transactions <---
%% A
F = fun() ->
mnesia:table_info(store, size)
end,
Result = mnesia:activity(async_dirty, F, [], mnesia_frag).
%% B
Result = mnesia:activity(async_dirty,
fun() ->
mnesia:table_info(store, size)
@voluntas
voluntas / gist:737963
Created December 12, 2010 09:54
Erlang 使っている企業
* Bluetail/Alteon/Nortel (distributed, fault tolerant email system, SSL accelerator)
* Cellpoint (Location-based Mobile Services)
* Corelatus (SS7 monitoring).
* dqdp.net (in Latvian) (Web Services).
* Facebook (Facebook chat backend)
* Finnish Meteorological Institute (Data acquisition and real-time monitoring)
* IDT corp. (Real-time least-cost routing expert systems)
* Kreditor (Electronic payment systems)
* Mobilearts (GSM and UMTS services)
-module(ipv6mcast).
-compile([export_all]).
-include_lib("eunit/include/eunit.hrl").
%% struct ipv6_mreq {
%% struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast addr */
%% unsigned int ipv6mr_interface; /* interface index */
%% };
@voluntas
voluntas / cover.erl
Created January 23, 2011 14:53
meck 使ってるとこの部分のエラーが出てしまう
%% Removes a module from the list of imported modules and writes a warning
%% This is done when a module is compiled.
remove_imported(Module,Imported) ->
case lists:keysearch(Module,1,Imported) of
{value,{Module,_,ImportFiles}} ->
io:fwrite("WARNING: Deleting data for module ~w imported from~n"
"~p~n",[Module,ImportFiles]),
lists:keydelete(Module,1,Imported);
false ->
Imported
@voluntas
voluntas / gist:796242
Created January 26, 2011 04:45
meck + ets ... errorr orz
Eshell V5.8.2 (abort with ^G)
1> code:unstick_mod(ets).
true
2> meck:new(ets).
ok
3> meck:expect(ets, insert, 2, ok).
=ERROR REPORT==== 26-Jan-2011::13:45:19 ===
Loading of failed: badfile
{erl_opts, [fail_on_warning, debug_info]}.
{xref_checks, [undefined_function_calls]}.
%% {eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.
{cover_enabled, true}.
{clean_files, [".eunit", "ebin/*.beam"]}.
{dialyzer_opts,
[{warnings,
[no_return,
no_unused,
no_improper_lists,
{require_otp_vsn, "R14"}.
{erl_opts, [fail_on_warning,
warn_export_all, warn_unused_import,
warn_missing_spec, warn_untyped_record]}.
{xref_checks, [undefined_function_calls]}.
{clean_files, [".qc/*", ".eunit/*", "ebin/*.beam"]}.
%% Jenkins 向け
%% {eunit_opts, [{report,{eunit_surefire,[{dir,"."}]}}]}.
{cover_enabled, true}.
{edoc_opts, [{dialyzer_specs, all}, {report_missing_type, true},