Skip to content

Instantly share code, notes, and snippets.

View rafaeljesus's full-sized avatar

Rafael Jesus rafaeljesus

  • Berlin, Germany
View GitHub Profile

HAProxy + Consul vs VulcanD + EtcD

HAProxy/Consul

  • Pro: Both are production ready
  • Pro: Can handle any throughput we will see
  • Pro: More feature rich
    1. Healthchecks
    2. DNS and HTTP API available to map endpoints
    3. Lots of service discovery built in
  • Pro: Solution could be used in more than one place (bld/prod/etc..)
GITLEAGUE
An application that scores users on github activity.
This applicaiton was made by following Tenderlove's PlayByPlay Peepcode video. I changed the tests from Unit tests to RSpec but the code should otherwise remain the same.
He calls the application omglol which I've renamed to gitleague.
Task:

Abstraction Suggestions

Summary: use good/established messaging patterns like Enterprise Integration Patterns. Don't make up your own. Don't expose transport implementation details to your application.

Broker

As much as possible, I prefer to hide Rabbit's implementation details from my application. In .Net we have a Broker abstraction that can communicate through a lot of different transports (rabbit just happens to be our preferred one). The broker allows us to expose a very simple API which is basically:

  • publish
  • request
  • start/stop subscription
@rafaeljesus
rafaeljesus / sort.js
Created February 2, 2015 18:10
sort by date asc and desc
function sortKeysDesc(formattedDate1, formattedDate2) {
var date1 = moment(formattedDate1);
var date2 = moment(formattedDate2);
if (date1.isSame(date2) ) return 0;
return date1.isAfter(date2) ? -1 : 1;
};
function sortKeysAsc(formattedDate1, formattedDate2) {
var date1 = moment(formattedDate1);
var date2 = moment(formattedDate2);
begin
for i in (select 'drop table '||table_name||' cascade constraints' tbl from user_tables)
loop
execute immediate i.tbl;
end loop;
end;
select 'drop table '||table_name||' cascade constraints;' from user_tables;
-- copy, paste and exec results
@rafaeljesus
rafaeljesus / users_with_alerts_gt_100.sql
Created March 5, 2015 12:04
Search all users with alerts qty more then 100
select u.id, u.login, u.name, p.role
from erm_user u, erm_user_profiles p
where id in (select user_id
from erm_alert
where alert_read = 0
having count(*) > 100
group by user_id)
and u.id = p.user_id
order by 2
@rafaeljesus
rafaeljesus / grep_file_terminal
Created March 13, 2015 12:40
search file for terminal
grep -rl 'domain/shipTo' .
@rafaeljesus
rafaeljesus / oportunidade.md
Last active August 29, 2015 14:17
Senior Software Engineer

A GSW esta com vaga para Engenheiro de Software Sênior full-time para multinacional em São José dos Campos-SP

DESCRIÇÃO

Buscamos desenvolvedores apaixonados e experientes em Java, com visão arquitetural no contexto de APIs e arquiteturas orientadas a serviços.

STACK ATUAL

Backend - Java, Spring(Data, Event, AOP), Mockito, Apache Camel, RabbitMQ, Maven Frontend - Marionettejs, Backbone Radio, Bluebird, Jasmine, Gulp.js, Plato, Istanbul, Sass

@rafaeljesus
rafaeljesus / aws.md
Last active August 29, 2015 14:19 — forked from anonymous/aws.md

Parse AWS IP ranges

Write a simple script to take the AWS IP ranges from https://ip-ranges.amazonaws.com/ip-ranges.json and output the range and location for each range in CSV format, e.g.:

23.20.0.0/14,"CA, US"
27.0.0.0/22,"Tokyo, JP"
...