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 / 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 / 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 / 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 / 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 / .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 / 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