Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working

William Dollins geobabbler

💭
Working
View GitHub Profile
View notify_with_mail.js
var PGPubsub = require('pg-pubsub');
var nodemailer = require('nodemailer');
var pubsubInstance = new PGPubsub('postgres://password:user@host:port/database'); // don't hard code this in real life. get it from a config or environment variable
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: "email@gmail.com", // don't hard code this in real life. get it from a config or environment variable
pass: "complex_gmail_password" // don't hard code this in real life. get it from a config or environment variable
@geobabbler
geobabbler / jhu_counties2geopackage.fmw
Last active Apr 1, 2020
FME workspace to scrape JHU COVID-19 county-level data into a geopackage.
View jhu_counties2geopackage.fmw
#! <?xml version="1.0" encoding="UTF-8" ?>
#! <WORKSPACE
# Command-line to run this workspace:
# /opt/fme-desktop-2020/fme /home/myname/jhu_counties2gpkg.fmw
# --SourceDataset_GEOJSON "https://services1.arcgis.com/0MSEUqKaxRlEPj5g/ArcGIS/rest/services/ncov_cases_US/FeatureServer/0/query?where=1%3D1&outFields=*&f=geojson&token="
# --DestDataset_OGCGEOPACKAGE "/home/myname/jhu_county.gpkg"
#
#! ATTR_TYPE_ENCODING="SDF"
#! BEGIN_PYTHON=""
#! BEGIN_TCL=""
View jhu_listen.js
var PGPubsub = require('pg-pubsub');
var pubsubInstance = new PGPubsub('postgres://password:user@host:5432/database');
pubsubInstance.addChannel('jhucounty', function (channelPayload) {
console.log(channelPayload);
console.log('---------------------------------');
console.log(JSON.stringify(channelPayload));
});
View jhu_update.sh
#!/bin/bash
###################################################
# Bash script to pull JHU data and update
###################################################
#Set the value of variable
database="$1"
user="$2"
host="$3"
View jhu_update.sh
#!/bin/bash
###################################################
# Bash script to pull JHU data and update
###################################################
#Set the value of variable
database="$1"
user="$2"
host="$3"
View jhu_trigger.sql
CREATE TRIGGER jhu_county_trigger
AFTER UPDATE
ON public.jhu_county
FOR EACH ROW
WHEN(NEW.watched = TRUE)
EXECUTE PROCEDURE public.jhu_county_watched();
View jhu_trigger_func.sql
CREATE OR REPLACE FUNCTION public.jhu_county_watched()
RETURNS trigger AS
$BODY$
DECLARE
BEGIN
PERFORM pg_notify('jhucounty', '{"type": "Feature", "geometry": ' ||
st_asgeojson(NEW.wkb_geometry) ||
',"properties": {"message": "' ||
'update' || '",' ||
'"fips": "' || NEW.fips || '",' ||
View watched_column.sql
-- Column: watched
-- ALTER TABLE public.jhu_county DROP COLUMN watched;
ALTER TABLE public.jhu_county ADD COLUMN watched boolean;
ALTER TABLE public.jhu_county ALTER COLUMN watched SET DEFAULT false;
View jhu_initial_pull.sh
ogr2ogr -overwrite -f "PostGreSQL"
PG:"host=$host user=$user dbname=$database password=$pw"
'https://services1.arcgis.com/0MSEUqKaxRlEPj5g/ArcGIS/rest/services/ncov_cases_US/FeatureServer/0/query?where=1%3D1&outFields=*&f=geojson&token='
-nln jhu_county
@geobabbler
geobabbler / Program.cs
Created Jul 30, 2019
Fulcrum API/AWS Rekognition with .Net Core
View Program.cs
using System;
using System.Drawing;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using Amazon.Rekognition;
using Amazon.Rekognition.Model;
using Newtonsoft.Json;
namespace fulcrumRek
You can’t perform that action at this time.