Python with virtualenv, curl and jq in $PATH, running CouchDB available on http://localhost:5984
git clone https://gist.github.com/f05328e7e24a1064c3ce.git test-linked| #!/usr/bin/env python | |
| # coding: utf-8 | |
| """ | |
| Generic python script skeleton | |
| """ | |
| import sys, os, argparse, logging, ConfigParser | |
| def parse_args(): |
| var items = _.chain(this.state.docs) | |
| .slice(0, 10) | |
| .map(function(doc, idx) { | |
| return [ | |
| React.createElement(ListDivider, { | |
| key: 'div' + idx, | |
| inset: false | |
| }), | |
| React.createElement(ListItem, { | |
| key: 'item' + idx, |
| {ok, F} = escript:extract("cfcheck", []). | |
| file:write_file("c.zip", proplists:get_value(archive, F)). |
Python with virtualenv, curl and jq in $PATH, running CouchDB available on http://localhost:5984
git clone https://gist.github.com/f05328e7e24a1064c3ce.git test-linkedJust make Erlang to do some light-load task in a bunch of relatively short leaving processes. Calculating PI to 80th digit in batches per 10 procs with short, 8 ms, sleep in-between, to give schedulers a breath space, will do.
Run erl with 8 schedulers and no busy waiting on schedulers at all.
| #!/usr/bin/env escript | |
| % -*- mode: erlang -*- | |
| main([BeamFile]) -> | |
| {ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]), | |
| io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). |
| make_random_ref_key() -> | |
| <<X:264/big-unsigned-integer>> = term_to_binary(make_ref()), | |
| [Key] = io_lib:format("~66.16.0b", [X]), | |
| {ok, Key}. | |
| make_random_md5_key() -> | |
| <<X:128/big-unsigned-integer>> = crypto:hash(md5, term_to_binary(make_ref())), | |
| [Key] = io_lib:format("~32.16.0b", [X]), | |
| {ok, Key}. |
| #!/usr/bin/env escript | |
| %% -*- erlang -*- | |
| %% * slurp in terms using inlined version of kernels file:consult/1 | |
| %% * convert to abstract syntax tree | |
| %% * annotate all tuples | |
| %% * pretty print using a hook to prefix the annotated nodes with newline | |
| main([]) -> | |
| io:format("%% -*-erlang-*-~n"), |
| # Build and slim Erlang | |
| # Author: Matthias Lang <matthias@corelatus.se> | |
| # Reference: http://erlang.org/pipermail/erlang-questions/2016-February/087935.html | |
| # Change the line below if you want to use a different version of Erlang | |
| # (Keep in mind that patches may not apply cleanly) | |
| erlang_version=otp_src_R14B03 | |
| erlang_source_file:=$(PACKAGE_SOURCES)/$(erlang_version)/$(erlang_version).tar.gz | |
| erlang_root=$(GTH_ERLANG_ROOT)/$(erlang_version) |
| [core] | |
| editor = vim | |
| pager = less | |
| whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eolpager | |
| [color] | |
| status = auto | |
| branch = auto | |
| diff = auto | |
| interactive = auto | |
| pager = true |