Skip to content

Instantly share code, notes, and snippets.

View ahamez's full-sized avatar
🦉

Alexandre Hamez ahamez

🦉
View GitHub Profile
@ahamez
ahamez / conformance.txt
Last active June 17, 2020 20:19
protobuf-elixir conformance
CONFORMANCE TEST BEGIN ====================================
ERROR, test=Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_0: Should have failed to parse, but didn't. request=protobuf_payload: "\001DEADBEEF" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto3.TestAllTypesProto3" test_category: BINARY_TEST, response=protobuf_payload: ""
ERROR, test=Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_0: Should have failed to parse, but didn't. request=protobuf_payload: "\001DEADBEEF" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto2.TestAllTypesProto2" test_category: BINARY_TEST, response=protobuf_payload: ""
ERROR, test=Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_1: Should have failed to parse, but didn't. request=protobuf_payload: "\002\001\001" requested_output_format: PROTOBUF message_type: "protobuf_test_messages.proto3.TestAllTypesProto3" test_category: BINARY_TEST, response=protobuf_payload: ""
ERROR, test=Required.Proto2.Protobuf
@ahamez
ahamez / timestamp.ex
Created September 15, 2020 15:47
Generate a timestamp in Elixir
defmodule Timestamp do
@moduledoc """
Generate a timestamp as an integer using current time.
"""
@spec make() :: integer()
def make() do
%{year: y, month: m, day: d, hour: hh, minute: mm, second: ss, microsecond: {us, _}} =
NaiveDateTime.utc_now()
@ahamez
ahamez / rle.exs
Created February 4, 2021 13:01
RLE
# As an exercise after reading this tweet: https://twitter.com/Al_Grigor/status/1357028887209902088?s=20
str = String.split("aaaabbbcca", "", trim: true)
str
|> Enum.reduce([], fn
x, [{x, count} | rest] ->
[{x, count + 1} | rest]
x, acc ->
# ---------------------------------------------------------------------------------------------------
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.31.0"
}
kubernetes = {
source = "hashicorp/kubernetes"