Skip to content

Instantly share code, notes, and snippets.

View romulojales's full-sized avatar

Rômulo Jales romulojales

View GitHub Profile
@romulojales
romulojales / KafkaReader.scala
Created February 23, 2021 15:56
Simple scala kafka consumer
import org.apache.kafka.clients.consumer.KafkaConsumer
import org.apache.kafka.clients.CommonClientConfigs
import org.apache.kafka.common.serialization.StringDeserializer
import scala.jdk.CollectionConverters._
import java.util.Properties
object KafkaReader extends App {
def getProperties: Properties = {
@romulojales
romulojales / e2c4.erl
Last active August 29, 2015 14:00
Exercises from "Programming Erlang: Software for a Concurrent world."
%%%-------------------------------------------------------------------
%%% @author romulo.jales
%%% @copyright (C) 2014, <COMPANY>
%%% Exercise 2 chapter 4 "programming erlang: Software for a concurrent world"
%%% The BIF tuple_to_list( T) converts the elements of the tuple T to a list.
%%% Write a function called my_tuple_to_list( T) that does the same thing only not using the BIF that does this.
%%% @end
%%% Created : 23. Apr 2014 1:42 AM
%%%-------------------------------------------------------------------
-module(e2c4).
@romulojales
romulojales / utils.py
Created February 26, 2014 02:27
Some functional methods with months
import calendar
from datetime import datetime
import pytz
def month_range(year, month):
init = datetime(year, month, 1, 0, 0, 0, 0, tzinfo=pytz.UTC)
max_day_month = calendar.monthrange(year, month)[1]
final = datetime(year, month, max_day_month, datetime.max.hour, datetime.max.minute,
datetime.max.second, datetime.max.microsecond, tzinfo=pytz.UTC)
return init, final
@romulojales
romulojales / bridge.py
Created September 11, 2013 16:50
Exemplo do Design Pattern Bridge
class NegocioAbstrato(object):
def funcao_abs(self, arg):
return arg
def funcao_repassada_ao_bridge(self, arg):
ponte = self.__get_ponte(arg)
return ponte.funcao_assumida(arg)
def __get_ponte(self, arg):