Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
💯 :atom:

Srividya Bharadwaj srividyacb

:octocat:
💯 :atom:
View GitHub Profile
@srividyacb
srividyacb / example-query.js
Created May 26, 2020 — forked from thetrevorharmon/example-query.js
Query JSON with S3 Select in Node.js
View example-query.js
// See tth.im/s3json for a full explanation of this code
const AWS = require('aws-sdk');
const S3 = new AWS.S3();
exports.handler = async (_, context) => {
try {
const query = 'SELECT * FROM s3object[*].results[*] r;';
// test query is against data from https://swapi.co/api/planets/?page=2
@srividyacb
srividyacb / frechet.js
Created Nov 28, 2019 — forked from argelius/frechet.js
Discrete Frechet Distance
View frechet.js
/* Discrete Fréchet Distance
* By Andreas Argelius http://argeli.us/
*
* Implementation of Discrete Frechet Distance in Javascript.
*
* The paths are defined as [[x0, y0], [x1, y1], ...]
*
*/
(function() {
@srividyacb
srividyacb / geojson-conversion.sh
Created Nov 1, 2019 — forked from benbalter/geojson-conversion.sh
Bulk convert shapefiles to geojson using ogr2ogr
View geojson-conversion.sh
# Bulk convert shapefiles to geojson using ogr2ogr
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/
# Note: Assumes you're in a folder with one or more zip files containing shape files
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere)
#geojson conversion
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}
@srividyacb
srividyacb / README.md
Created Nov 1, 2019 — forked from mojodna/README.md
GDAL 2.0 on Amazon Linux
View README.md
sudo yum -y update
sudo yum-config-manager --enable epel
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
cd /tmp
curl -L http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz | tar zxf -
cd gdal-2.0.0/
./configure --prefix=/usr/local --without-python
make -j4
sudo make install
View extract-geojson-relations.js
var osmium = require('osmium');
var _ = require("lodash")
var count = 0;
var restrictions=0;
var relHandler = new osmium.Handler();
var geomHandler = new osmium.Handler();
var nodes = []
@srividyacb
srividyacb / .bashrc
Created Aug 20, 2019 — forked from JanTvrdik/.bashrc
ssh-agent support for Git Bash / MinGW / msys / Windows
View .bashrc
# put this in ~/.bashrc
export SSH_AUTH_SOCK=/tmp/.ssh-socket
ssh-add -l > /dev/null
if [ $? = 2 ]; then
rm -f $SSH_AUTH_SOCK
echo Starting new ssh-agent...
eval $(ssh-agent -a $SSH_AUTH_SOCK) > /dev/null
ssh-add && echo "ssh-agent set up successfully with the following keys:" && ssh-add -l
fi
View gist:6436a5134eda6eb2cce9aaadd52c8129

Fixing India on mapbox-streets style

  • Add Indian disputed boundaries source: planemad.bb1ba8b5 to you style project from the layers panel
  • If the source is locked, open the project.yml file and append it manually to the source field. You would also need to manually add the layers boundaries-claimed and boundaries-disputed after the admin layer similiar to this:
source: "mapbox:///mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6,planemad.bb1ba8b5"
layers:
  - landcover
@srividyacb
srividyacb / uninstall node and npm.md
Created Dec 1, 2015 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
View uninstall node and npm.md

First:

lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*

To recap, the best way (I've found) to completely uninstall node + npm is to do the following:

#go to /usr/local/lib and delete any node and node_modules cd /usr/local/lib sudo rm -rf node*