Skip to content

Instantly share code, notes, and snippets.

View mgmanalili's full-sized avatar

Michael Andrew Manalili mgmanalili

View GitHub Profile
var polygon = ee.Geometry.Polygon([[
[-119.33364769821117, 46.05123532178373],
[-119.3233620672313, 45.869732769408905],
[-119.04111088542663, 45.873079023065166],
[-119.0396574679861, 46.045448840018565]
]]);
var landsat8 = ee.ImageCollection("LANDSAT/LC8_L1T_TOA_FMASK");
//
// Masking Clouds with Fmask

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor
@mgmanalili
mgmanalili / mongo.bash
Created July 19, 2018 07:03 — forked from iwatakeshi/mongo.bash
Create a Windows service for MongoDB
# Create directories
mkdir c:\mongo\db
mkdir c:\mongo\config
mkdir c:\mongo\log
# Create a configuration file
# in c:\mongo\config\ as
# 'mongod.cfg' and paste:
#|==================================|
#| logpath=C:\mongo\log\mongodb.log |
@mgmanalili
mgmanalili / modern-geospatial-python.md
Created July 4, 2018 06:28 — forked from jqtrde/modern-geospatial-python.md
Modern remote sensing image processing with Python
brew install python3
pip install argparse (optional)
pip install virtualenv
mkdir <your_fancy_project>
cd <your_fancy_project>
mkdir <your_fancy_repo>
virtualenv -p /usr/local/bin/python3 env
source env/bin/activate
source activate
*source deactivate
@mgmanalili
mgmanalili / postgresql-cheatsheet.md
Last active June 21, 2021 10:43 — forked from davydany/postgresql-cheatsheet.md
PostgreSQL Cheat Sheet

PostgreSQL Cheat Sheet

Quick Commands

Creating a DB and Setting its Ownership

To create a database, you need to first ensure that the database's role exists first. Role and User are synonymous in PostgreSQL. Once you create the ROLE, you can create the Database and set the OWNER as the ROLE.

Create Role

@mgmanalili
mgmanalili / postgresql_id.sql
Created May 18, 2018 07:55 — forked from yohangdev/postgresql_id.sql
PostgreSQL Better ID & UUID Generator
create schema shard_1;
create sequence shard_1.global_id_sequence;
CREATE OR REPLACE FUNCTION shard_1.id_generator(OUT result bigint) AS $$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
now_millis bigint;
-- the id of this DB shard, must be set for each
-- schema shard you have - you could pass this as a parameter too
@mgmanalili
mgmanalili / geo_update_trigger.sql
Created May 17, 2018 14:29 — forked from mmohiudd/geo_update_trigger.sql
Update geometry and geography data with a trigger for PostgreSQL(PostGIS)
DROP TABLE IF EXISTS test_table;
CREATE TABLE test_table(
id bigserial NOT NULL,
latitude double precision,
longitude double precision,
geom geometry,
geog geography,
updated_ts double precision,
CONSTRAINT test_table_unique_key UNIQUE (id)
);
@mgmanalili
mgmanalili / listen_pg.py
Created May 11, 2018 12:30 — forked from dtheodor/listen_pg.py
Listen for pg_notify with Psycopg2
import select
import datetime
import psycopg2
import psycopg2.extensions
conn = psycopg2.connect(database="postgres", user="vagrant")
#conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
curs = conn.cursor()
@mgmanalili
mgmanalili / README.md
Created May 11, 2018 09:35 — forked from bruth/README.md
Postgres push notification

Postgres push triggers

Watch a table for changes and push a notification with a payload describing the change.

Example

In the Postgres shell:

-- Create the functions