Skip to content

Instantly share code, notes, and snippets.

View dgaubert's full-sized avatar

Daniel G. Aubert dgaubert

View GitHub Profile
@dgaubert
dgaubert / inspect.ts
Created August 31, 2023 16:09
Console Inspect
// eslint-disable-next-line no-console
console.log((await import('util')).inspect(myObject, { showHidden: false, depth: null, colors: true }))
@dgaubert
dgaubert / README.md
Created December 30, 2022 13:02
Deferred Fetch

Get started

$ npm i

Run

$ node app.js

Test: tests/e2e/data/observatory/enrichment/test_enrichment.py::TestEnrichment::test_points_and_private_data

Test is failing in both branches because of the same reason: do_area area doesn't match between enriched vs expected. The easiest solution is to update fixture to match with current enriched reault.

  • Branch enrichment

    • Enriched DataFrame

          BLOCKGROUP  MLTCY7224  RSGCY7224       do_area                    geometry
      

Comparison beetwen overviews vs aggregation vs original data with turbocarto applied

Original table has 700k points. To compare load times, select a layer (You must be connected to the VPN) and open developer tools and check console output

@dgaubert
dgaubert / README.md
Last active October 4, 2018 16:43
overviews vs aggregation vs original data

Performance comparison beetwen overviews vs aggregation vs original data

Original table has 700k points. To compare load times, select a layer (You must be connected to the VPN) and open developer tools and check console output

Maps API: getting started

Basic concepts:

  • What's a map?: User's data (sql/analyses) + basemap + pop-ups + dataviews

Components:

  • Browser (carto[JS|VL]), cdn, nginx, varnish, maps-api, batch-api, redis-metadata, user's database

Map Instatiation Workflow: Map Config (request) & Layergroup (response):

const { promisify } = require('util')
function timeout (time, callback) {
if (time > 1000) {
throw new Error('Limit 1000')
}
if (time > 500) {
return callback(new Error('Limit 500'))
}
@dgaubert
dgaubert / cheatsheet-postgresql-monitoring.md
Last active September 13, 2023 07:56
Cheatsheet: PostgreSQL Monitoring

Cheatsheet: PostgreSQL Monitoring

To query these metrics, you must be logged into PostgreSQL as a user that has read access to pg_stat_database

Useful psql commands

  • Check version of PostgreSQL: SELECT version();
  • Show location of postgresql.conf file (requires superuser privileges): SHOW config_file;
  • Show location of data directory (requires superuser privileges): SHOW data_directory;
  • Show location of log directory (may be a path relative to data directory, requires superuser privileges): SHOW log_directory;
const express = require('express');
const app = express();
const mw1Factory = function () {
return function mw1 (req, res, next) {
next();
}
}
<!DOCTYPE html>
<html>
<body>
<img id="200-body-tile" src="http://localhost:3000/200-body-tile" width="256" height="256">
<img id="429-body-tile" src="http://localhost:3000/429-body-tile" width="256" height="256">
<img id="200-body-no-renderable" src="http://localhost:3000/200-body-no-renderable" width="256" height="256">
<img id="429-body-no-renderable" src="http://localhost:3000/429-body-no-renderable" width="256" height="256">
<script type="text/javascript">
document.getElementById("200-body-tile").addEventListener('load', function () {
console.log('200-body-tile: load')