Skip to content

Instantly share code, notes, and snippets.

View rgwozdz's full-sized avatar

Rich Gwozdz rgwozdz

  • Esri
  • Bellingham, WA
View GitHub Profile

##Prerequisites In order to follow this guide, you should have a Fully Qualified Domain Name pointed at your Ubuntu 14.04 server.

For example:

sd-pmte-stage.spatialdevmo.com points to 54.83.188.204

##Install the Software The installation process of Postfix on Ubuntu 14.04 is easy because the software is in Ubuntu's default package repositories.

@rgwozdz
rgwozdz / gist:22232c592b509236cc52
Created May 27, 2015 21:06
Static site NGINX
upstream apt-web{
server 127.0.0.1;
}
# NGINX Server Instance
server {
listen 0.0.0.0:80;
server_name apt.spatialdevmo.com;
access_log /var/log/nginx/apt.spatialdevmo.log;
upstream apt-api {
server 127.0.0.1:9000;
}
server {
listen 0.0.0.0:80;
server_name apt-api.spatialdevmo.com;
access_log /var/log/nginx/apt-api.spatialdevmo.log;
# Gzip Compression
@rgwozdz
rgwozdz / api-integration-testing.yml
Created September 21, 2016 03:17
Psuedo Ansible Playbook for API/DB integration testing - Mocha.js, Express.js, PostgreSQL
- name: Run DB/API integration test suite
hosts: localhost
become: True
become_method: sudo
tasks:
- name: Use PSQL to Close Postgres DB connection to the master database
become: True
become_user: postgres
@rgwozdz
rgwozdz / pg-grant-cheatsheet.sql
Created March 9, 2017 18:40
Postgres Privledge cheatsheet
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO postgres;
GRANT USAGE ON SCHEMA public TO <app_user>;
GRANT ALL ON SCHEMA public TO PUBLIC;
REVOKE ALL ON FUNCTION <function-name>(<signature>) FROM PUBLIC;
GRANT ALL ON FUNCTION <function-name>(<signature>) TO <app_user>;
SELECT n.nspname as "Schema",
p.proname as "Name",
pg_catalog.pg_get_function_result(p.oid) as "Result data type",
pg_catalog.pg_get_function_arguments(p.oid) as "Argument data types",
CASE
WHEN p.proisagg THEN 'agg'
WHEN p.proiswindow THEN 'window'
WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN 'trigger'
ELSE 'normal'
END as "Type"
@rgwozdz
rgwozdz / 0_reuse_code.js
Created May 4, 2017 16:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rgwozdz
rgwozdz / insert-into.sql
Last active June 16, 2017 20:00
INSERT INTO FROM SELECT
INSERT INTO table_target (col1,col2) (SELECT col1, col2 FROM table_source);
@rgwozdz
rgwozdz / layerThumbnail.scala
Created July 6, 2017 17:21 — forked from echeipesh/layerThumbnail.scala
GeoTrellis Samples
s3 > test:console
[info] Starting scala interpreter...
[info]
Welcome to Scala 2.11.11 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_131).
Type in expressions for evaluation. Or try :help.
scala> import geotrellis.raster._
import geotrellis.vector._
import geotrellis.proj4._
import geotrellis.spark._
@rgwozdz
rgwozdz / java-service-example.sh
Created July 10, 2017 19:49
Setting up Ubuntu java service
# /usr/local/bin/service-name-restart.sh, owner: root, group: root, mode: 0755
#!/bin/bash
# /usr/local/bin/service-name-restart.sh
#
if [ -f "<java program working dir>/RUNNING_PID" ]; then kill -9 `cat <java program working dir>/RUNNING_PID`; fi
if [ -f "<java program working dir>/RUNNING_PID" ]; then rm <java program working dir>/RUNNING_PID; fi
cd <java program working dir>/bin
env JAVA_OPTS="-Xms4096m -Xmx4096m" ./geotrellis-api -Dconfig.file=<java program working dir>/conf/application.conf -Dhttp.port=7777 -Dplay.crypto.secret=abcdefghijk > <the-log-path> 2>&1
#########################################################################################################