Skip to content

Instantly share code, notes, and snippets.

View odrianoaliveira's full-sized avatar

Adriano de Oliveira odrianoaliveira

View GitHub Profile
#!/bin/bash
#
# Bootstrap script to install OpenJDK 1.8 and maven into Amazon Linux
#
yum install git -y
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
class Pouring(capacity: Vector[Int]) {
//states
type State = Vector[Int]
val initialState = capacity map (x => 0)
trait Move {
def change(state: State): State
}
"""
File name: main.py
Author: adriano
Date created: 10/11/17
"""
import json
import requests
from requests.auth import HTTPBasicAuth
__HOST = "http://apisdigitais.interno:8765"
@odrianoaliveira
odrianoaliveira / docker-compose.yml
Created November 16, 2017 17:36
MongoDB Sharded Cluster
version: "2.1"
services:
cfg:
container_name: mongo_cfg
image: dadhx05.interno:9092/mongo:3.4.4
restart: unless-stopped
command: mongod --config /config/cfgsrv.yaml --port 27000
ulimits:
class Solution {
public int[] twoSum(int[] nums, int target) {
int n = nums.length;
int [][] arr = new int[n][2];
for (int i=0; i < n; i++) {
arr[i][0] = nums[i];
arr[i][1] = i;
}
@odrianoaliveira
odrianoaliveira / scripted_field.painless
Created April 12, 2018 14:01
kibana scripted field
if (!doc['request.keyword'].empty) {
def m = /\/api\/(.*[-\/]v[0-9])\/.*/.matcher(doc['request.keyword'].value);
if (m.matches()) {
return m.group(1)
}
}
return ""
@odrianoaliveira
odrianoaliveira / HA-redis-master-slave-sentinel.yml
Last active April 20, 2018 18:49
High Available Redis master/slave nodes with sentinel
version: '2.1'
services:
master:
image: redis:3.2-alpine
command: ["redis-server","/usr/local/etc/redis/redis.conf"]
sysctls:
net.core.somaxconn: '1024'
mem_limit: 8g
memswap_limit: 8g
// create the file:
sudo vim /usr/share/applications/intellij.desktop
// add the following entry
[Desktop Entry]
Version=2018.1.1
Type=Application
Terminal=false
Icon[en_US]=/opt/idea/idea-IC-181.4203.550/bin/idea.png
Name[en_US]=IntelliJ
@odrianoaliveira
odrianoaliveira / application.yml
Created May 30, 2018 14:15
Spring Boot - Configuring sleuth with others binders
# Spring
spring:
cloud:
stream:
default:
contentType: application/json
bindings:
input:
destination: pollerIn-process
group: group
version: "2.1"
services:
rabbit1:
image: "rabbitmq:3-management-alpine"
mem_limit: 2g
memswap_limit: 2g
mem_swappiness: 0
restart: unless-stopped
ports:
- "15672:15672"