Skip to content

Instantly share code, notes, and snippets.

View thyagobr's full-sized avatar

Thyago Barbosa thyagobr

View GitHub Profile
@thyagobr
thyagobr / Rakefile
Created July 29, 2016 19:47 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@thyagobr
thyagobr / gist:24a902e6358f83cb5697
Created August 7, 2015 13:56
logstash basic udp/es config
input {
udp {
port => 5228
codec => json_lines
}
}
output {
elasticsearch { host => localhost }
stdout {
codec => json_lines
@thyagobr
thyagobr / chat.rb
Last active August 29, 2015 14:18 — forked from rkh/chat.rb
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
//Cria o índice especificando quais os analyzer ele tem
//Além disso especifica que o campo "titulo" do tipo "seu_tipo" utiliza o analyzer recem criado
curl -XPUT "http://localhost:9200/my_index" -d'
{
"settings": {
"analysis": {
"analyzer": {
"analyzer_customizado": {
"tokenizer": "standard",