Mix.install([
{:kino, "~> 0.12.0"},
{:xlsx_reader, "~> 0.8.3"}
])
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example xml | |
| <?xml version="1.0" encoding="UTF-8" ?> | |
| <configuration> | |
| <application id="test"> | |
| <platform id="vk"> | |
| <appId>123</appId> | |
| <secretKey>secret</secretKey> | |
| <packages> | |
| <package id="vk0" price="100" points="3" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In order to use the Erlang-syntax as interface descriptions ( using types, records, fields , etc), | |
| I needed an XML-representation for the module. | |
| You might have heard for the AbstractCode which can be generated from the module, for instance like this: | |
| ``` | |
| {ok, {rec, [{abstract_code, Abs}]}} = beam_lib:chunks("rec.beam", [abstract_code])2> rp(Abs). | |
| ``` | |
| But that is not exactly what I wanted. While talking during CodeBeam about this the OTP team told me that edoc | |
| already does this for you, and right they are: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %% | |
| %% %CopyrightBegin% | |
| %% | |
| %% Copyright Ericsson AB 1997-2020. 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(sid_tools). | |
| -compile([export_all]). | |
| % https://github.com/core-wg/comi/blob/master/draft-ietf-core-comi.md | |
| % https://tools.ietf.org/html/rfc4648#section-5 | |
| -define(CHARSET64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"). | |
| sid_encoded(Sid) -> | |
| Chars = [ | |
| (Sid bsr 60) band 16#3F, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- table.filter({"a", "b", "c", "d"}, function(o, k, i) return o >= "c" end) --> {"c","d"} | |
| -- | |
| -- @FGRibreau - Francois-Guillaume Ribreau | |
| -- @Redsmin - A full-feature client for Redis http://redsmin.com | |
| table.filter = function(t, filterIter) | |
| local out = {} | |
| for k, v in pairs(t) do | |
| if filterIter(v, k, t) then out[k] = v end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(xmltest). | |
| -compile(export_all). | |
| -include_lib("xmerl/include/xmerl.hrl"). | |
| %% @doc Helper function to generate XML from a data structure and print it | |
| serialize(Data) -> | |
| Xml = lists:flatten(xmerl:export_simple(Data, xmerl_xml)), | |
| io:format("~s~n", [Xml]). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- @desc: Publish a message to all SET member channels | |
| -- @usage: redis-cli EVAL "$(cat SPUBLISH.lua)" 1 <setKey> <message> | |
| -- @return: number of SET member channels | |
| local function SPUBLISH(key, msg) | |
| local members = redis.call("SMEMBERS", key) | |
| for _,member in ipairs(members) do | |
| redis.call("PUBLISH", member, msg) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- gets all fields from a hash as a dictionary | |
| local hgetall = function (key) | |
| local bulk = redis.call('HGETALL', key) | |
| local result = {} | |
| local nextkey | |
| for i, v in ipairs(bulk) do | |
| if i % 2 == 1 then | |
| nextkey = v | |
| else | |
| result[nextkey] = v |
NewerOlder