This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
editor = /usr/bin/vim | |
autocrlf = input | |
[color] | |
ui = true | |
[alias] | |
lol = log --graph --decorate --pretty=oneline --abbrev-commit --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
db: | |
image: gordlea/postgis:9.5 | |
environment: | |
- POSTGRES_DB=myapp_api_development | |
- POSTGRES_USER=root | |
dbtest: | |
image: gordlea/postgis:9.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: 5 | |
development: | |
<<: *default | |
database: myapp_api_development | |
host: db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query" | |
"http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails" | |
# payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
# data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backend: TkAgg |
OlderNewer