Skip to content

Instantly share code, notes, and snippets.

@trivisonno
trivisonno / gist:8cfc27366039c96ec3e895d24c89036d
Created December 9, 2024 19:21
Instacart Bookmarklet to transform a list of cart items into a printable HTML page
javascript:(function() {
const ulElement = document.querySelector('ul.e-pv1s1f');
if (!ulElement) {
alert('Shopping cart element not found!');
return;
}
const listItems = ulElement.querySelectorAll('li');
let htmlContent = `
<!DOCTYPE html>
@trivisonno
trivisonno / map.html
Created July 26, 2024 13:10
Add an ESRI tileLayer to a LeafletJS map
<!-- Load Esri Leaflet from CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/esri-leaflet/3.1.0/esri-leaflet.min.js"></script>
<script>
const aerialLayer = L.esri.tiledMapLayer({
url: 'https://gis.cuyahogacounty.us/server/rest/services/IMAGERY/2022_Fall_Aerial/MapServer/',
zoomOffset: -10, // <-- important or else tiles will not render properly
maxZoom: 21,
});
ffmpeg -i "http://host/folder/file.m3u8" -c copy file.mp4
@trivisonno
trivisonno / postgis-linestring-to-wkt-aws-rds.txt
Last active January 5, 2021 15:08
Adding O&E Towpath Trail route segments to a PostgreSQL database
I will add all unidentified travel paths as a six-digit integer beginning with 9xxxxx.
Should I use this trailhead map as section segment dividers?: https://www.ohioanderiecanalway.com/media/1309/n2015towpathtrailmaponly-final3.pdf
Using pgAdmin to connect to AWS RDS server.
Convert linestrings to RDS PostGIS PostgreSQL WKT and INSERT INTO.
Tremont Trail O&E
SELECT ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[-81.69042527675629,41.48433309935147],[-81.69051110744476,41.484192445280506],[-81.69063448905945,41.48412412747873],[-81.69072568416595,41.4841000152962],[-81.69090270996094,41.48397543554351],[-81.69097244739532,41.48374636892159],[-81.69087052345274,41.4834288892821],[-81.69095098972319,41.48323598950095],[-81.6911655664444,41.482990845200504],[-81.69123530387878,41.48264121156085],[-81.69122457504272,41.48248849742517],[-81.69121384620667,41.48229559484462]]}')
INSERT INTO streets VALUES
('TREMONT TRAIL', 'TREMONT TRAIL btw ABBEY AV/FAIRFIELD AV', 900001, ST_Multi(ST_SetSRID(ST_Geom
@trivisonno
trivisonno / gist:8b9f48343ecb9ab83ff3750de903e5fb
Created July 17, 2018 13:40
get address points within a polygon
SELECT cleveland_address_points.the_geom_webmercator, cleveland_address_points.cartodb_id FROM cleveland_address_points, (SELECT * FROM cleveland_ward_boundaries_2014 WHERE ward='1') cleveland_ward_boundaries_2014_subward WHERE ST_Intersects(ST_Centroid(cleveland_address_points.the_geom_webmercator), cleveland_ward_boundaries_2014_subward.the_geom_webmercator)
@trivisonno
trivisonno / gist:aa17bf71196fe1d342fbd3261b19faf4
Created September 30, 2017 19:09
Calculate line length in miles
SELECT *, ST_Length(ST_Transform(the_geom, 2877))/5280 as length FROM gophercle
@trivisonno
trivisonno / sql date filtering
Created September 30, 2017 14:13
CARTO sql filter by date (rows with date within x days ago)
SELECT * FROM gophercle WHERE EXTRACT(DAY FROM now()-date)<5
@trivisonno
trivisonno / st_makeline
Created September 29, 2017 13:08
Insert line into empty carto table
INSERT INTO untitled_table_1(the_geom) VALUES (
ST_MakeLine(ST_SetSRID(ST_Point(-81.7132294178009,41.484132164870914), 4326), ST_SetSRID(ST_Point(-81.71879768371582,41.48125471476161), 4326))
)
@trivisonno
trivisonno / installOpenVbx.sh
Last active March 18, 2016 01:37 — forked from dwelch2344/installOpenVbx.sh
A simple install script to setup OpenVbx on an Ubuntu 14.04 box
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
export DBNAME=openvbx
export DBUSER=openvbx
export DBPASS=openvbxPass
@trivisonno
trivisonno / setup.md
Last active September 20, 2016 12:46
OpenTreeMap Linode install notes

If your intention is to set up OpenTreeMap for development and contributing to the open source project, instead of using this guide, we recommend you use the otm-vagrant project instead of following these steps. That will get you a "dev env" much more quickly!

This guide assumes use of 64-bit Ubuntu 12.04. IMPORTANT: OpenTreeMap will ONLY work on 64-bit Ubuntu. Do not attempt with 32-bit.

There are several config files, upstart scripts, and other small files that you'll need to copy/get from the otm-vagrant project's "scripts" directory. We'll link to them here when you need them.

Table of Contents

  1. Install Basics
  2. Postgres and PostGIS