Skip to content

Instantly share code, notes, and snippets.

View thnery's full-sized avatar
🎸
Playing The Blues

Tácio Nery thnery

🎸
Playing The Blues
View GitHub Profile
@thnery
thnery / postgres install arch
Created September 21, 2016 01:15
postgres instal arch
# uninstall postgresql if necessary
$ sudo pacman -R postgresql postgresql-libs
# remove postgres files
$ sudo rm -rfv /var/lib/postgres
# proceed with the installation
$ sudo pacman -S postgresql postgresql-libs
# setup password for postgres
$ sudo passwd postgres
@thnery
thnery / haversine_calc_distance_in_meters.sql
Last active March 24, 2017 14:05
Haversine SQL function to calc the distance in meters between two points (lat, lgn)
CREATE OR REPLACE FUNCTION CALC_DISTANCE_IN_METERS(alat double precision, alng double precision, blat double precision, blng double precision)
RETURNS double precision AS
$BODY$
SELECT atan2(
sqrt(
sin(radians($3-$1)/2)^2 +
sin(radians($4-$2)/2)^2 *
cos(radians($1)) *
cos(radians($3))
),
@thnery
thnery / haversine_check_if_two_points_are_within_distance.sql
Created March 24, 2017 14:07
Haversine SQL function to check if two distinct points are within a distance
CREATE OR REPLACE FUNCTION WITHIN_DISTANCE(alat double precision, algn double precision, blat double precision, blgn double precision, distance double precision)
RETURNS boolean AS
$BODY$
BEGIN
RETURN CALC_DISTANCE_IN_METERS(alat, algn, blat, blgn) <= distance;
END
$BODY$
LANGUAGE plpgsql STABLE STRICT;
@thnery
thnery / Dockerfile
Created April 5, 2017 20:16
dockerfile sample
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential
RUN apt-get install -y libpq-dev
RUN apt-get install -y ghostscript
RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
@thnery
thnery / docker-compose.yml
Created April 8, 2017 23:06
docker compose sample
version: '2'
services:
db:
image: gordlea/postgis:9.5
environment:
- POSTGRES_DB=myapp_api_development
- POSTGRES_USER=root
dbtest:
image: gordlea/postgis:9.5
@thnery
thnery / databse_sample.yml
Created April 9, 2017 01:23
config/database for docker container
default: &default
adapter: postgresql
encoding: unicode
pool: 5
development:
<<: *default
database: myapp_api_development
host: db
AWS ECS setup
1. Create VPC
VPC Dashboard > Start VPC Wizard > VPC with a Single Public Subnet
- CIRD: 10.0.0.0/16
- VPC name: <project>-<environment>
- Public Subnet: 10.0.0.0/24
- Availiability Zone: us-east-1a
@thnery
thnery / .matplotlib
Created March 18, 2018 02:53
configuration file for matplotlib on mac osx
backend: TkAgg
@thnery
thnery / .gitconfig
Last active March 26, 2018 15:21
gitconfig
[core]
editor = /usr/bin/vim
autocrlf = input
[color]
ui = true
[alias]
lol = log --graph --decorate --pretty=oneline --abbrev-commit --all
@thnery
thnery / sublime_config.json
Last active May 10, 2018 11:36
Sublime config file
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"color_inactive_tabs": false,
"color_scheme": "Packages/Python 3/Gloom.tmTheme",
"copy_with_empty_selection": true,
"ensure_newline_at_eof_on_save": true,
"font_size": 13,
"ignored_packages":
[