code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1
value |
|---|---|---|---|---|---|
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the ... | src/mem3/src/mem3_reshard_api.erl | 0.547101 | 0.409988 | mem3_reshard_api.erl | starcoder |
%%%---------------------------------------------------------------------
%%% module pwd
%%%---------------------------------------------------------------------
%%% Decrypts md5-hashed strings of known length. This is demonstration
%%% code for an intro talk on Erlang concurrency.
%%%------------------------------... | pwd.erl | 0.542136 | 0.537466 | pwd.erl | starcoder |
%%=============================================================================
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless ... | src/meck_cover.erl | 0.564819 | 0.459379 | meck_cover.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% Copyright <2013-2018> <
%% Technische Universität Kaiserslautern, Germany
%% Université Pierre et Marie Curie / Sorbonne-Université, France
%% Universidade NOVA de Lisboa, Portugal
%% Université catholique de Louvain (UCL), Belgique
%% IN... | apps/antidote_crdt/src/antidote_crdt_map_rr.erl | 0.516352 | 0.507934 | antidote_crdt_map_rr.erl | starcoder |
%%
%% @doc This module implements a hash ring.
%% Items are hashed into the ring NumReplicas times.
%%
%% An item is hashed using the following:
%%
%% sha1(Item + string(N)) where N is (1..NumReplicas)
%%
%% Note: When N is converted to a string it is not zero padded.
%%
-module(hash_ring).
-export([
create_ring/2,
... | src/hash_ring.erl | 0.522202 | 0.527803 | hash_ring.erl | starcoder |
%%
%% @doc Various functions to work on binaries.
%%
%% @reference [A2] Chapter 7
%%
-module(bin).
-export([integer_to_bitstring/1]).
-export([lxor/1, lxor/2]).
-export([bin_to_hexstr/1, hexstr_to_bin/1]).
-export([reverse_bytes/1, reverse_bits/1]).
-export([term_to_packet/1, packet_to_term/1]).
%%
%% @doc Returns a ... | lib/ndpar/src/bin.erl | 0.609873 | 0.576393 | bin.erl | starcoder |
%-*-Mode:erlang;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
% ex: set ft=erlang fenc=utf-8 sts=4 ts=4 sw=4 et:
% Data Structures For String (List of Integers) Keys
% rbdict/aadict taken from:
% https://github.com/rvirding/rb/tree/develop/src
% trie taken from:
% https://github.com/okeuday/CloudI... | src/string_key.erl | 0.629319 | 0.425963 | string_key.erl | starcoder |
%% WorkDir = os:cmd("mktemp -d /tmp/grass.XXXXXX"),%% @doc Grass is a toy graph database with LevelBD as a backend.
%% @version 0.1
%% @reference <a href="https://github.com/eiri/grass">https://github.com/eiri/grass</a>
%% @author <NAME> <<EMAIL>>
%% @copyright 2012 <NAME>
%% @todo Make it compatable with <a href="http... | src/grass.erl | 0.525612 | 0.575588 | grass.erl | starcoder |
%%%-------------------------------------------------------------------
%%% @doc
%%% A set of optics specific to arrays.
%%% @end
%%%-------------------------------------------------------------------
-module(optic_array).
%% API
-export([all/0,
all/1,
nth/1,
nth/2]).
%%%====================... | src/optic_array.erl | 0.619356 | 0.495056 | optic_array.erl | starcoder |
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the ... | src/mem3/src/mem3_reshard_job.erl | 0.57081 | 0.419172 | mem3_reshard_job.erl | starcoder |
%%% @copyright Erlware, LLC. All Rights Reserved.
%%%
%%% This file is provided to you under the BSD License; you may not use
%%% this file except in compliance with the License.
-module(erlcron).
-export([validate/1,
cron/1,
at/2,
once/2,
cancel/1,
datetime/0,
set... | deps/erlcron/src/erlcron.erl | 0.589598 | 0.401482 | erlcron.erl | starcoder |
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless req... | src/minirest_handler.erl | 0.525369 | 0.404096 | minirest_handler.erl | starcoder |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contraction Clustering (RASTER):
% Reference Implementation in Erlang with an Example
% (c) 2016, 2017 Fraunhofer-Chalmers Centre for Industrial Mathematics
%
% Algorithm development and implementation:
% <NAME> (<EMAIL>)
%
% Requirements:
% . E... | 5_Erlang/raster.erl | 0.502197 | 0.554229 | raster.erl | starcoder |
%% Copyright (c) 2008-2021 <NAME>
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to... | src/lfe_translate.erl | 0.52829 | 0.492005 | lfe_translate.erl | starcoder |
-module(rstar).
-export([new/1, new/2, insert/2, delete/2, search_within/2, search_nearest/3, search_around/3]).
-export_type([rtree/0, geometry/0]).
-include("../include/rstar.hrl").
% Expose type references
-type rtree() :: #rtree{}.
-type geometry() :: #geometry{}.
% Returns a new empty R* tree of the specified ... | src/rstar.erl | 0.651133 | 0.720786 | rstar.erl | starcoder |
-module(ecc_curves).
-export([execute_ecdh/0]).
-record(point, {x, y}).
execute_ecdh() ->
io:fwrite("An example of Elliptic Curve Diffie-Hellman over secp256k1~n"),
io:fwrite("==========================================================~n"),
io:fwrite("THIS IMPLEMENTATION OF THIS ALGORITHM IS NOT SECURE~n"... | src/ecc_curves.erl | 0.524638 | 0.436862 | ecc_curves.erl | starcoder |
-module(mzbl_loop).
-compile({inline, [msnow/0, eval_rates/7, time_of_next_iteration/3, batch_size/4]}).
-export([eval/5]).
% For Common and EUnit tests
-export([time_of_next_iteration/3, msnow/0]).
-define(MAXSLEEP, 1000).
-define(DEFAULT_MAX_BATCH, 1000000).
-define(MSEC_in_SEC, 1000).
-include("mzbl_types.hrl")... | common_apps/mzbench_language/src/mzbl_loop.erl | 0.547464 | 0.446615 | mzbl_loop.erl | starcoder |
%% @author <NAME> <<EMAIL>>
%% @copyright 2018 <NAME> <<EMAIL>>
%%
%% @doc 'Species1' rules implementation module for 'cgolam' app.
%%
%% This is SIMILAR to the coloured version of Conway's Game of
%% Life, but here the different colours are relabelled species
%% as they are broadly UNcooperative.
%%
%% The calculation... | src/cgolam_rules_species1.erl | 0.557123 | 0.620564 | cgolam_rules_species1.erl | starcoder |
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2005-2013. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
... | lib/ssh/src/ssh_bits.erl | 0.53048 | 0.493592 | ssh_bits.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% External functions for schema writers and cuttlefish invokers
%%
%% Copyright (c) 2013 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use... | deps/cuttlefish/src/cuttlefish.erl | 0.5 | 0.410638 | cuttlefish.erl | starcoder |
%%%------------------------------------------------------------------------
%% Copyright 2019, OpenTelemetry Authors
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.o... | src/ot_meter_default.erl | 0.552057 | 0.439386 | ot_meter_default.erl | starcoder |
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed ... | lib/stdlib/src/gb_sets.erl | 0.807119 | 0.567637 | gb_sets.erl | starcoder |
-module(day16).
-export([main/0]).
-include_lib("eunit/include/eunit.hrl").
-record(range, {min, max}).
-record(field, {name, r1, r2}).
-record(matchset, {index, names}).
-record(match, {index, name}).
main() ->
Fields = fields(),
[Mine | Nearby] = tickets(),
{Valid, ErrRate} = part_one(Fields, Nearby),
i... | day16/day16.erl | 0.511229 | 0.500488 | day16.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% Copyright (c) 2018 <NAME>. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of the ... | src/vclock.erl | 0.695958 | 0.400105 | vclock.erl | starcoder |
%%% @doc Prioritize a list of IPs for a specific key in increasing order
%%% for their weight. The original algorithm in
%%% http://www.eecs.umich.edu/techreports/cse/96/CSE-TR-316-96.pdf goes for the
%%% highest weight available, but describes that no loss of generality will happen
%%% going with LRW or HRW (see page ... | src/lrw.erl | 0.630571 | 0.689621 | lrw.erl | starcoder |
%% Copyright (c) 2019-2021, <NAME> <<EMAIL>>. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless require... | src/binbo_bb.erl | 0.607547 | 0.401394 | binbo_bb.erl | starcoder |
-module(codewars).
%% API exports
-compile(export_all).
% -export([row_sum_odd_numbers/1]).
%%====================================================================
%% API functions
%%====================================================================
% Given the triangle of consecutive odd numbers:
% 1
... | codewars/src/codewars.erl | 0.545165 | 0.765769 | codewars.erl | starcoder |
% MIT License
% Copyright (c) 2020 <NAME>
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish... | erlang/src/lesson4.erl | 0.582847 | 0.426919 | lesson4.erl | starcoder |
%% Puzzle:
%%
%% First half: Find most common binary digit in each position. Binary
%% number composed of most common is "gamma", inverse is "epsilon.
%%
%% https://adventofcode.com/2021/day/3
%%
%% explanation:
%% https://blog.beerriot.com/2021/12/14/advent-of-code-day-3/
-module(puzzle03).
-export([
solveA... | src/puzzle03.erl | 0.553505 | 0.786049 | puzzle03.erl | starcoder |
%% vim: set ai et sw=4 sts=4:
%% See LICENSE for licensing information.
-module(yaml_double).
-export([ scalar/3
]).
-include("yaml_grapheme.hrl").
%=======================================================================
-type style() :: block | flow.
%=====================================================... | src/yaml_double.erl | 0.60288 | 0.437944 | yaml_double.erl | starcoder |
%%--------------------------------------------------------------------
%% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License a... | test/emqx_vm_SUITE.erl | 0.57093 | 0.405154 | emqx_vm_SUITE.erl | starcoder |
%%==============================================================================
%% @copyright 2019-2020 Erlang Solutions Ltd.
%% Licensed under the Apache License, Version 2.0 (see LICENSE file)
%% @end
%%
%% @doc
%% In this scenario, users are communicating using PEP and MUC Light, while GDPR
%% removal requests are ... | src/scenarios/gdpr_removal.erl | 0.670824 | 0.562657 | gdpr_removal.erl | starcoder |
%%%------------------------------------------------------------------------
%% Copyright 2018, OpenCensus Authors
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/... | src/oc_sampler_period_or_count.erl | 0.521471 | 0.480235 | oc_sampler_period_or_count.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% Copyright (c) 2014 <NAME>, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of... | deps/riak_ensemble/src/synctree.erl | 0.576423 | 0.521227 | synctree.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% jam_erlang: Convert jam-specific records to and from Erlang's
%% date/time tuples
%%
%% Copyright (c) 2016 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (... | src/jam_erlang.erl | 0.598312 | 0.431644 | jam_erlang.erl | starcoder |
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the Li... | src/mango/src/mango_selector_text.erl | 0.585101 | 0.47658 | mango_selector_text.erl | starcoder |
%% @author <NAME> <<EMAIL>>
%% @copyright 2013 <NAME>
%%
%% @doc Binary String Helper Functions
%%
%% Copyright 2013 <NAME>
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http... | src/elli_bstr.erl | 0.613931 | 0.454412 | elli_bstr.erl | starcoder |
%%%-------------------------------------------------------------------
%%% @author <NAME>
%%% @copyright (C) 2017 ACK CYFRONET AGH
%%% This software is released under the MIT license
%%% cited in 'LICENSE.txt'.
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% This module prov... | src/modules/datastore/links/datastore_links.erl | 0.651244 | 0.527986 | datastore_links.erl | starcoder |
%% Copyright (c) 2011-2012 Bash<NAME>, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.... | src/lager_transform.erl | 0.572245 | 0.45423 | lager_transform.erl | starcoder |
%%% Advent of Code solution for 2019 day 10.
%%% Created: 2019-12-10T05:33:20+00:00
-module(aoc2019_day10).
-include_lib("stdlib/include/assert.hrl").
-include("aoc_puzzle.hrl").
-export([parse/1, solve/1, info/0]).
-behavior(aoc_puzzle).
-spec info() -> aoc_puzzle().
info() ->
#aoc_puzzle{module = ?MODULE,
... | src/2019/aoc2019_day10.erl | 0.576184 | 0.616214 | aoc2019_day10.erl | starcoder |
% https://icebreakerideas.com/fun-games-to-play-at-home/#Dots_and_Boxes
-module (dots_and_boxes).
-export ([dots/2, boxes/1, join/4, draw/1, auto_play/3]).
-type point() :: {integer(),integer()}.
-type line() :: {atom(), point(), point(), boolean()}.
-type dots() :: [point()].
-type box() :: {atom(), [line()], string(... | sequential/dots_and_boxes.erl | 0.510741 | 0.581422 | dots_and_boxes.erl | starcoder |
%% -------------------------------------------------------------------
%% @doc Provides a process to queue incoming propositions.<br/>
%% The validator pulls the propositions from the queue via
%% {@link get_proposition/0} and returns the answer via
%% {@link put_score/3}.
%% The queue process keeps proposition until i... | src/validator/validator_queue.erl | 0.685213 | 0.484136 | validator_queue.erl | starcoder |
%% @doc Patches the output of
%% <a href="http://erlang.org/doc/man/edoc_layout.html">edoc_layout</a>.
%%
%% This module append the reference and configuration for mermaid
%% javascript. For each html file created by <a href="http://erlang.org/doc/man/edoc_layout.html#module-2">
%% edoc_layout:module/2</a> and <a href=... | src/edocmermaid_layout.erl | 0.581184 | 0.471345 | edocmermaid_layout.erl | starcoder |
-module(day1).
-behavior(aoc).
-include_lib("eunit/include/eunit.hrl").
-export([input_type/0, p1/1, p2/1]).
input_type() -> number_list.
%% @doc
%% # Sonar Sweep
%% You're minding your own business on a ship at sea when the overboard alarm
%% goes off! You rush to see if you can help. Apparently, one of the Elves
%... | src/day1.erl | 0.506836 | 0.601447 | day1.erl | starcoder |
%%%
%%% Limit tracker
%%%
%%% Behaviour:
%%%
%%% - If _limit_ is exceeded then there's no need to reject the transaction.
%%%
%%% - _Account_ operation is idempotent as long as the transaction is nor
%%% confirmed neither rejected.
%%%
%%% After that any transaction w/ the same ID will be handled regularly as a... | apps/fistful/src/ff_limit.erl | 0.505371 | 0.500854 | ff_limit.erl | starcoder |
%%==========================================================================
%% Copyright (C) 2004 <NAME>
%% 2010 <NAME>
%%
%% Permission is hereby granted, free of charge, to any person obtaining a
%% copy of this software and associated documentation files (the
%% "Software"), to deal in the Software wi... | src/eg_table.erl | 0.52756 | 0.402803 | eg_table.erl | starcoder |
% @copyright 2008-2011 Zuse Institute Berlin
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law... | src/cyclon_cache.erl | 0.640074 | 0.418519 | cyclon_cache.erl | starcoder |
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2021-2022 VMware, Inc. or its affiliates. All rights reserved.
%%
-module(khepri_utils).
-incl... | src/khepri_utils.erl | 0.52683 | 0.477859 | khepri_utils.erl | starcoder |
%%
%% Copyright 2013, <NAME> <<EMAIL>>
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by appli... | src/ecapnp_val.erl | 0.52683 | 0.532243 | ecapnp_val.erl | starcoder |
%% coding: utf-8
%--------------------------------------------------------------------
%
% Copyright (c) 2015 <NAME>
%
% This software is released under the MIT license
% http://www.opensource.org/licenses/mit-license.php
%
%--------------------------------------------------------------------
% @doc YAZL '<i>yazzle</... | src/yazl.erl | 0.642545 | 0.53127 | yazl.erl | starcoder |
-module(day03).
-export([main/0]).
main() ->
Map = load(),
part1(Map),
part2(Map).
% Part one: determine how many trees are passed at slope {3,1}
part1(Map) ->
Ans = trees_for_slope(3, 1, Map),
io:format("~p~n", [Ans]).
% Part two: the product of the number of trees on a fine selection of slopes.
part2(Map... | day03/day03.erl | 0.52756 | 0.811489 | day03.erl | starcoder |
-module(day12).
-export([solve_part1/1, solve_part2/1]).
% for tests
-export([
parse/1,
cruise/3, wp_cruise/3,
turn/2, rotate/2
]).
%%% solution
solve_part1(Input) ->
{{Lon, Lat}, _Heading} = cruise({0, 0}, 0, parse(Input)),
abs(Lon) + abs(Lat).
solve_part2(Input) ->
... | src/day12.erl | 0.549641 | 0.684376 | day12.erl | starcoder |
-module(buffer).
-compile([export_all, nowarn_export_all]).
-ifdef(TEST).
-include_lib("proper/include/proper.hrl").
-endif.
% Experiments in building a text buffer data structure
% for use in the elsa language server.
%
% It's based on specialized finger trees[1], with
% inspiration from the Yi editor's rope data st... | apps/elsa/src/buffer.erl | 0.624064 | 0.665465 | buffer.erl | starcoder |
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2010-2012. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
... | lib/diameter/src/base/diameter_session.erl | 0.680772 | 0.439627 | diameter_session.erl | starcoder |
% @author <NAME> <<EMAIL>>
% @copyright 2021 <NAME>
% @doc Lossless encoding and handling of monetary values.
-module(money).
-compile({no_auto_import,[abs/1,min/2,max/2]}).
-export([currency/1,
dense_currency/1,
dense/2,
dense_unsafe/2,
dense_from_discrete/1,
dense_from_d... | src/money.erl | 0.578924 | 0.446072 | money.erl | starcoder |
%% Copyright 2014 Erlio GmbH Basel Switzerland (http://erl.io)
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required b... | src/vmq_updo.erl | 0.523664 | 0.417331 | vmq_updo.erl | starcoder |
%%%-------------------------------------------------------------------
%%% @author <NAME> <<EMAIL>>
%%% @author <NAME> <<EMAIL>>
%%% @copyright (C) 2011 InakaLabs SRL
%%% @doc Benchmarker. Given a module to test with, it helps users determine
%%% the order of functions
%%% @end
%%%---------------------------------... | test/edis_bench.erl | 0.585338 | 0.460228 | edis_bench.erl | starcoder |
%%% Copyright (c) 2007, 2008, 2009 JackNyfe, Inc. <<EMAIL>>.
%%% See the accompanying LICENSE file.
%% vim: ts=4 sts=4 sw=4 expandtab
-module(jn_mavg).
%%
%% This module implements exponential moving average logic,
%% a useful data structure to store hits/second averaged over some time period.
%%
%% For a general de... | src/jn_mavg.erl | 0.715026 | 0.403978 | jn_mavg.erl | starcoder |
%%==============================================================================
%% Copyright 2018-2021 <NAME> <<EMAIL>>
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.a... | src/bencoding.erl | 0.559531 | 0.46642 | bencoding.erl | starcoder |
%% =====================================================================
%% @doc An abstraction library providing an interface to the possible
%% options supported by hugin. The values returned from the functions
%% in this library can be returned in the hugin init/0 callback
%% function, or be used in the hugin API fu... | src/hugin_opts.erl | 0.735737 | 0.464659 | hugin_opts.erl | starcoder |
% Copyright 2017-2018 <NAME>
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, ... | src/statser_util.erl | 0.761272 | 0.514156 | statser_util.erl | starcoder |
%% @doc Process which manages users, their receivers, and channels.
%% @version 0.1.0
%% @author <NAME> <<EMAIL>>
%% [http://student.vub.ac.be/~dmeysman]
%% @copyright 2016 <NAME>
-module(master).
-export([initialize/0, initialize_with/2, master_actor/2]).
-spec initialize() -> pid().
%% @doc Creates a new master p... | src/master.erl | 0.614857 | 0.439627 | master.erl | starcoder |
%% A worker that keeps values for a single metric for fixed time period.
-module(collector).
-behaviour(gen_server).
-export([start_link/1, stop/1, average/1, record/2]).
-export([init/1, handle_call/3, handle_cast/2,
handle_info/2, code_change/3, terminate/2]).
-define(PERIOD, 60000). % 1 minute = 60000 ms
... | src/collector.erl | 0.520253 | 0.517754 | collector.erl | starcoder |
%%--------------------------------------------------------------------
%% Copyright (c) 2020-2021 DGIOT Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the Li... | apps/dgiot_modbus/src/modbus/modbus_util.erl | 0.673192 | 0.464112 | modbus_util.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% Copyright (c) 2014 SyncFree Consortium. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a... | test/object_log_state_SUITE.erl | 0.559651 | 0.452294 | object_log_state_SUITE.erl | starcoder |
-module(listFns).
-export([nthtail/2, prefix/2, search/2, subtract/2]).
% Returns nth tail of a list
% Requires N to be a non-negative integer and L to be a list
nthtail(N, L)
when (is_integer(N) and is_list(L)) ->
nthtail_helper(N, L).
nthtail_helper(0, L) -> L;
nthtail_helper(N, _) when (N < 0) -> erlang:e... | lists/listFns.erl | 0.555194 | 0.545286 | listFns.erl | starcoder |
%% @author Couchbase <<EMAIL>>
%% @copyright 2017-2018 Couchbase, Inc.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless r... | src/functools.erl | 0.616359 | 0.478346 | functools.erl | starcoder |
%% ====================================================================
%% @author <NAME> <<EMAIL>>
%% @copyright 2016, <NAME>
%% @doc Wrap a JSON parser to provide easy abstractions across
%% implementations and ensure a consistent return interface.
%% @end
%% =====================================================... | src/rabbitmq_aws_json.erl | 0.552781 | 0.497253 | rabbitmq_aws_json.erl | starcoder |
%%%------------------------------------------------------------------------
%% Copyright 2019, OpenTelemetry Authors
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.o... | apps/opentelemetry_api/src/otel_propagator_b3single.erl | 0.690872 | 0.491334 | otel_propagator_b3single.erl | starcoder |
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved.
%%
%% @type close_reason(Type) =... | erlang_server/_build/default/lib/amqp_client/src/amqp_connection.erl | 0.615203 | 0.486271 | amqp_connection.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% Copyright (c) 2012 Basho Technologies, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of the Licen... | dist-tests/basic_command_line.erl | 0.561215 | 0.527682 | basic_command_line.erl | starcoder |
%%%-------------------------------------------------------------------
%%% @author <NAME>
%%% @copyright (C) 2020 ACK CYFRONET AGH
%%% This software is released under the MIT license
%%% cited in 'LICENSE.txt'.
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% This module enca... | src/space_support/provider_sync_progress.erl | 0.517327 | 0.482063 | provider_sync_progress.erl | starcoder |
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the ... | src/couch_log/src/couch_log_util.erl | 0.612541 | 0.513303 | couch_log_util.erl | starcoder |
%% @doc Zotonic/Adlib integration
-module(mod_ginger_adlib).
-author("Driebit <<EMAIL>>").
-mod_title("Adlib").
-mod_prio(500).
-mod_description("Integrates Zotonic with the Adlib API.").
-behaviour(gen_server).
-export([
observe_search_query/2,
pid_observe_tick_1m/3,
pid_observe_tick_1h/3,
pid_obser... | modules/mod_ginger_adlib/mod_ginger_adlib.erl | 0.5769 | 0.465387 | mod_ginger_adlib.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% riakc_set: Eventually-consistent set type
%%
%% Copyright (c) 2013 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except ... | src/riakc_set.erl | 0.675765 | 0.416915 | riakc_set.erl | starcoder |
%%% ====================================================================
%%% ``The contents of this file are subject to the Erlang Public License,
%%% Version 1.1, (the "License"); you may not use this file except in
%%% compliance with the License. You should have received a copy of the
%%% Erlang Public License along... | blades/ejabberd/src/node_dag.erl | 0.534127 | 0.426083 | node_dag.erl | starcoder |
%% ---------------------------------------------------------------------
%% Licensed under the Apache License, Version 2.0 (the "License"); you may
%% not use this file except in compliance with the License. You may obtain
%% a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
%%
%% Unless required by... | lib/syntax_tools/examples/merl/lisp.erl | 0.54819 | 0.475971 | lisp.erl | starcoder |
-module(crypto).
-export([main/1]).
%% Decrypts the contents of Filename, printing any solutions to stdout
%% as they're found. We could just accumulate the solution keys in a list,
%% but sometimes that takes a long time.
%%
main(Filename) ->
Dictionary = load_dictionary("../words"),
Ciphertext = load_cipher... | src/crypto.erl | 0.544559 | 0.590248 | crypto.erl | starcoder |
% Binary Search Trees (BST)
% 13 June 2008
-module(bst).
-compile(export_all). % I am lazy. Don't do this.
%=====================================================================
% Membership. `mem(E,T)' is `false' if item `E' is not present in the
% BST `T', otherwise `true'.
%
% In tail form.
%
% In the worst case... | Defun/Tests/bst.erl | 0.596903 | 0.59358 | bst.erl | starcoder |
%
% reia_eval: Evaluate a given set of Reia expressions
% Copyright (C)2009 <NAME>
%
% Redistribution is permitted under the MIT license. See LICENSE for details.
%
-module(reia_eval).
-export([new_binding/0, string/1, string/2, exprs/1, exprs/2]).
-include("../compiler/reia_nodes.hrl").
-include("../compiler/reia_bi... | src/core/reia_eval.erl | 0.559531 | 0.523968 | reia_eval.erl | starcoder |
%% -------------------------------------------------------------------
%%
%% Copyright (c) 2012-2015 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may ob... | eqc/hashtree_eqc.erl | 0.580233 | 0.47993 | hashtree_eqc.erl | starcoder |
%%--------------------------------------------------------------------
%% Copyright (c) 2020 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License a... | test/emqx_vm_SUITE.erl | 0.53777 | 0.435841 | emqx_vm_SUITE.erl | starcoder |
-module(aoc2017_day07).
-include_lib("eunit/include/eunit.hrl").
-behavior(aoc_puzzle).
-export([parse/1, solve/1, info/0]).
-include("aoc_puzzle.hrl").
-spec info() -> aoc_puzzle().
info() ->
#aoc_puzzle{module = ?MODULE,
year = 2017,
day = 7,
name = "Recursive ... | src/2017/aoc2017_day07.erl | 0.574156 | 0.454654 | aoc2017_day07.erl | starcoder |
%% @author <NAME> <<EMAIL>>
%% @copyright 2010 <NAME>
%% @doc 'format_price' filter, show a price with two digits. Accepts a price in cents.
%% Copyright 2010 <NAME>
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obta... | modules/mod_base/filters/filter_format_price.erl | 0.557845 | 0.53206 | filter_format_price.erl | starcoder |
%%======================================================================
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014-2017 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You ma... | src/svc_metrics_histogram.erl | 0.55917 | 0.422862 | svc_metrics_histogram.erl | starcoder |
%%------------------------------------------------------------------------------
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%%... | tapestry/apps/tapestry/src/part_labelprop.erl | 0.609757 | 0.591399 | part_labelprop.erl | starcoder |
-module(tql_compare).
%% API exports
-export([ by/1
, by/2
, by_prop/1
, by_prop/2
, by_prop/3
, concat/1
, reverse/1
]).
-type comparator(T) :: fun ((T, T) -> boolean()).
-type order() :: ascending | descending.
-export_types([ comparator/1
, ord... | src/tql_compare.erl | 0.659734 | 0.510802 | tql_compare.erl | starcoder |
-module(carbonara_schema).
-export([
archive_settings_for_metric/1
]).
retention_seconds(I) when is_integer(I) -> I;
retention_seconds({Count, second}) -> Count;
retention_seconds({Count, minute}) -> retention_seconds({60 * Count, second});
retention_seconds({Count, hour}) -> retention_seconds({60 * Count, minute}... | src/carbonara_schema.erl | 0.507324 | 0.415077 | carbonara_schema.erl | starcoder |
%% Copyright (C) 1997, Ericsson Telecom AB
%% File: fs_string.erl
%% Author: <NAME>
%%
%% @doc
%% String handling functions.
%% @end
-module (fs_string).
-vsn('1.0').
-export ([stringize/1,
lowercase/1,
uppercase/1,
integer_to_hex/1,
byte_to_hex/1,
hex_to_integer/1,
hex_to_string/1,
string_to... | lib/fslib/src/fs_string.erl | 0.533397 | 0.401981 | fs_string.erl | starcoder |
-module(dijkstra).
-export([dijkstra/3, shortest_dist/2, shortest_path/2, closed_set/1]).
-record(state, {source, graph, closed, frontier, distances, parents, callbackfun}).
shortest_dist(#state{distances = Map}, Node) ->
maps:get(Node, Map).
shortest_path(State, Node) ->
shortest_path(State, Node, [Node]).... | src/utils/dijkstra.erl | 0.52074 | 0.567877 | dijkstra.erl | starcoder |
%% Copyright (c) 2016 <NAME>
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in w... | test/prop_lfe_doc.erl | 0.502197 | 0.405743 | prop_lfe_doc.erl | starcoder |
%% Minicache. Feel free to rename this module and include it in other projects.
%%-----------------------------------------------------------------------------
%% Copyright 2014 <NAME>
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the Licens... | deps/mysql/src/mysql_cache.erl | 0.714329 | 0.509032 | mysql_cache.erl | starcoder |
%
% reia: Interface between Erlang and Reia environments
% Copyright (C)2008-10 <NAME>
%
% Redistribution is permitted under the MIT license. See LICENSE for details.
%
-module(reia).
-export([
init/0,
load/1,
parse/1,
eval/1, eval/2,
apply/3, apply/4,
inst/2, inst/3,
invoke/3, invoke/4,
throw/2, thro... | src/core/reia.erl | 0.555315 | 0.47384 | reia.erl | starcoder |
%%
%% @doc One of the implementations of
%% [https://groups.google.com/g/erlang-programming/c/ZUHZpH0wsOA
%% coinductive data types].
%%
%% @see lazy2
%%
-module(lazy).
-author("<NAME> <<EMAIL>>").
-export([gen/2, filter/2, foldl/3, map/2, take/2]).
-export([natural_numbers/0]).
-dialyzer(no_improper_lists).
-type l... | lib/ndpar/src/lazy.erl | 0.649356 | 0.666008 | lazy.erl | starcoder |
%%
%% Inpired from 'https://github.com/erlang/otp/blob/master/lib/edoc/src/edoc_layout.erl'
%%
-module(hover_doc_layout).
-export([module/2]).
-include_lib("xmerl/include/xmerl.hrl").
%% @doc return a string
module(Element, Options) ->
Functions = layout_module(Element, init_opts(Element,Options)),
%return ... | apps/erlangbridge/src/hover_doc_layout.erl | 0.551211 | 0.509825 | hover_doc_layout.erl | starcoder |
-module(openapi_bans_api).
-export([get_blocked_server_hashes/1, get_blocked_server_hashes/2]).
-define(BASE_URL, "").
%% @doc A list of SHA1 hashes of banned servers
%% Returns a list of SHA1 hashes used to check server addresses against when the client tries to connect. Clients check the lowercase name, using the ... | generated-sources/erlang-client/mojang-sessions/src/openapi_bans_api.erl | 0.627951 | 0.400398 | openapi_bans_api.erl | starcoder |
%%%-------------------------------------------------------------------
%%% Copyright (c) 2017, sFractal Consulting, LLC
%%% Licensed under the Apache License, Version 2.0 (the "License");
%%% you may not use this file except in compliance with the License.
%%% You may obtain a copy of the License at
%%% http://ww... | test/helper_json.erl | 0.575946 | 0.41182 | helper_json.erl | starcoder |
-module(graph_creation).
-export([create_graph/2, insert_parent_data/1]).
-type vertex() :: {nonempty_string(), integer()}.
-type order() :: [vertex()].
-type connections() :: [vertex()].
-type graph_without_n_parents() :: #{vertex() => connections() | list()}.
-type vertex_data_parents() :: {connections(), integer()... | src/graph_creation.erl | 0.570451 | 0.609292 | graph_creation.erl | starcoder |
-module(heaps).
%% (c) 2011-2013 <NAME> <<EMAIL>>. All rights reserved.
%% Released under the BSD 2-clause license - see this for details:
%% http://github.com/herenowcoder/erl-heaps/blob/master/LICENSE
-export([ add/3, add/4, contains_value/2, delete_by_value/2, delete/3,
is_empty/1, mapping/2, new/0, take_m... | src/heaps.erl | 0.691602 | 0.474875 | heaps.erl | starcoder |
%|==========================================================================================|
%| Copyright (c) 2016 <NAME> |
%| |
%| Permission is hereby granted, free of charge, to... | cputest.erl | 0.745584 | 0.442877 | cputest.erl | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.