Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jeanfbrito's full-sized avatar
🌱
Seeding the future!

Jean Brito jeanfbrito

🌱
Seeding the future!
View GitHub Profile
location_points = [
[-29.640088, -50.764216],
[-29.637486, -50.770814],
[-29.633196, -50.773013]
]
# using Harvesine formula to calculate the distance
# based on https://github.com/alexreisner/geocoder/blob/master/lib/geocoder/calculations.rb#L72
def distance(location_one, location_two)
rad_per_deg = Math::PI/180
@jeanfbrito
jeanfbrito / watertank.yaml
Created April 30, 2020 13:53
My watertank ESPHome configuration
esphome:
name: watertank
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "greenhouse"
password: "senhasupersecreta"
# Enable fallback hotspot (captive portal) in case wifi connection fails
@jeanfbrito
jeanfbrito / conky.conf
Created April 29, 2020 19:35
My configuration for conky
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
Any original torsmo code is licensed under the BSD license
All code written since the fork of torsmo is licensed under the GPL
Please see COPYING for details
@jeanfbrito
jeanfbrito / profiles.json
Created April 23, 2020 06:06
My Windows Terminal Configuration
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"profiles":
@jeanfbrito
jeanfbrito / influxdb.lua
Created January 6, 2016 18:41
NodeMCU and InfluxDB
-- Your access point's SSID and password
local SSID = "greenhouse"
local SSID_PASSWORD = "senhasupersecreta"
local DEVICE = "device001"
local temperature = 27.5
-- configure ESP as a station
wifi.setmode(wifi.STATION)
wifi.sta.config(SSID,SSID_PASSWORD)
wifi.sta.autoconnect(1)
@jeanfbrito
jeanfbrito / ha.sh
Created August 22, 2019 15:01
Make wkhtmltopdf work in Ubuntu 18.04
wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt-get install fontconfig libxrender1 xfonts-75dpi xfonts-base
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin/
@jeanfbrito
jeanfbrito / Capistrano 3.md
Created April 21, 2019 01:08 — forked from stevenyap/Capistrano 3.md
Capistrano 3 Setup

This guide explains the way to setup a production server using Capistrano.

Setup Capistrano on LOCAL

  • Capistrano is a development gem which assist the developer to run commands on the production server (something like a Heroku toolbelt)
  • Hence, it is installed and configured on developer's computer
# Gemfile

# Use Capistrano for deployment
@jeanfbrito
jeanfbrito / postgres-outage.md
Created October 2, 2018 13:33 — forked from andywer/postgres-outage.md
Post Mortem: Postgres outage on 2018-08-20

2018-08-20: Postgres failure

What happened

The PostgreSQL container stopped unexpectedly, was automatically restarted, but suddenly didn't accept any connections anymore. Neither from the API service containers nor from the Macbook over the internet.

Error in logs:

FATAL:  pg_hba.conf rejects connection for host "10.0.1.2", user "postgres", database "******", SSL off
@jeanfbrito
jeanfbrito / server.md
Last active September 30, 2018 18:18 — forked from josemarluedke/server.md
Ubuntu with Nginx + Ruby 1.9.3 + PostgreSQL 9.1 + Passenger + Papistrano

Ubuntu with Nginx + Ruby 1.9.3 + PostgreSQL 9.1 + Passenger + Papistrano

Update the system

sudo apt-get update

Install some dependencies

@jeanfbrito
jeanfbrito / reverse.md
Last active August 28, 2018 19:23
Add SSH Reverse Tunnel

Configuring a SSH Reverse Tunnel sevice

First, let`s assume that:

The server IP is 1.1.1.1.

The user on the server is relayserver_user.

The user on the client is homeserver_user.