Skip to content

Instantly share code, notes, and snippets.

View allanbatista's full-sized avatar

Allan Batista allanbatista

View GitHub Profile
@allanbatista
allanbatista / README.md
Last active August 18, 2018 15:55
Start Jupyter notebook on docker to developer with volume mounted

Start Jupyter notebook on docker to developer with volume mounted

$ mkdir $HOME/workspace/notebooks -p && \
  docker run -d -p 8888:8888 --restart unless-stopped --name jupyter -v $HOME/workspace/notebooks:/notebooks tensorflow/tensorflow:latest-gpu

To GET a token, not forgot to see jupyter logs.

$ docker logs jupyter

Output

@allanbatista
allanbatista / script.rb
Created August 15, 2018 17:41
Update multiples visualizations with name and new pattern index
require 'json'
require 'faraday'
conn = Faraday.new(url: 'http://localhost:9200') # create a new Connection with base URL
conn.basic_auth('username', 'password') # set the Authentication header
response = conn.get('/.kibana/_search?q=type:visualization&size=200')
JSON.parse(response.body)["hits"]["hits"].each do |doc|
next if doc["_source"]["type"] != "visualization"
source = doc["_source"]
@allanbatista
allanbatista / daemon.json
Last active August 15, 2018 14:14
How Configure Docker to delivery log to logstash
# /etc/docker/daemon.json
{
"log-driver": "gelf",
"log-opts": {
"gelf-address": "udp://127.0.0.1:12201",
"labels": "production_status",
"env": "os,customer"
}
}
@allanbatista
allanbatista / 1_install_couchdb.sh
Last active June 30, 2018 12:56
Configuração do couchdb
# Executado em cada server
mkdir /data
docker run -d --name couchdb -p 5984:5984 -v /data:/opt/couchdb/data couchdb:2.1.1
@allanbatista
allanbatista / README.md
Last active August 28, 2018 16:47
Comandos para facilitar a inicialização de um projeto limpo na skyhub

Criação de Contas e usuários

Cria Account Admin e Suporte

admin = Admin.create(email: "[email protected]", password: "password", password_confirmation: "password")
Tenant.current = account_test = Account.find_by(name: "account_test") || Account.create(name: "account_test", email: "[email protected]")
suporte = User.last || User.create(email: "[email protected]", support: true, password: "password", password_confirmation: "password", name: "support", account: account) rescue User.last

Cria uma nova conta com todas as permissoes

@allanbatista
allanbatista / mp4-to-gif.sh
Last active April 3, 2018 18:07
Convert Video MP4 to GIF
# sudo apt-get install ffmpeg -y
# -an ignore audio
# -vf filters
# -ss second start
# -t how much seconds
ffmpeg -i input.mp4 -y -an -vf fps=2,scale=720:-1 -ss 5 -t 8 output.gif
@allanbatista
allanbatista / abs_relative.py
Created February 27, 2018 16:27
python path absolute and relative path
import os
path = os.path.abspath(os.path.join(os.path.dirname(__file__),"..", "marvin_python_toolbox"))
print(path)
@allanbatista
allanbatista / Dockerfile
Created February 21, 2018 20:59
Dockerfile for marvin-ai
FROM ubuntu:16.04
MAINTAINER Allan Batista <[email protected]>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install python2.7 libsasl2-dev python-pip vim curl git -y
RUN pip install --upgrade pip
RUN pip install virtualenvwrapper --ignore-installed six
RUN curl https://d3kbcqa49mib13.cloudfront.net/spark-2.1.1-bin-hadoop2.6.tgz -o /tmp/spark-2.1.1-bin-hadoop2.6.tgz && \
[[1],[1,10],[1,1,10],[1,1,1,10],[1,1,1,1,10],[1,100,1,1,1,10]]
{{1},{1,10},{1,1,10},{1,1,1,10},{1,1,1,1,10},{1,100,1,1,1,10}}
@allanbatista
allanbatista / DateTimeHelper.ex
Last active January 18, 2018 18:37
Create a elixir datetime with timezone
defmodule DateTimeHelper do
def get_datetimezone_iso8601 do
Timex.now
|> Timex.format!("{ISO:Extended:Z}")
end
end
iex> DateTimeHelper.get_datetimezone_iso8601()
#=> "2018-01-18T15:31:05.153423Z"