Skip to content

Instantly share code, notes, and snippets.

View shaunakv1's full-sized avatar
🖖
Keep Calm and Code On

Shaunak Vairagare shaunakv1

🖖
Keep Calm and Code On
View GitHub Profile
@shaunakv1
shaunakv1 / install-wsl2-fix-dns-resolution.md
Last active July 3, 2024 16:11 — forked from coltenkrauter/fix-wsl2-dns-resolution
How to install WSL 2 and Ubuntu on windows 10 and setup network access for VPN

(optional but recommended) Install Windows Terminal Application using one of the three Options:

  1. Windows App Store
  2. NOAA Users should use Software Center Windows Terminal
  3. Install from Github Releases

We will use the new Windows windows terminal app for the rest of the steps. If you chose not to install it. then you may use Windows Powershell Application. For WSL commands, have another PowerShell window logged into wsl using (wsl) command once you have wsl installed.

Open Powershell in Admin mode

@shaunakv1
shaunakv1 / git_repo_cleanup.md
Last active August 29, 2019 03:53
Cleaning up Large Git Repos

Find out sizes of all files in all the history

git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest \
| tee file-size-list
@shaunakv1
shaunakv1 / search-index.js
Created August 1, 2018 16:59
Experiment with building offline search index for "Polygons in Map View" search
/**
* Process to create geojsons.
* Connect to MasterDataregistery DB from QGIS
* Convert to Geojson, which splits feature into different data types
* Convert the polygin layer to WGS84 Shapefile
* Convert the WGS84 shapefile to individual GeoJSON file using ogr2ogr from qgis
* "gdalogr:convertformat","C:/Projects/qgis/shapefiles/MasterRegistryFootptintsPolygonsWGS84.shp",1,"COORDINATE_PRECISION=5 ","C:/Projects/qgis/geojsons/MasterRegistryFootprintsPolygonsWGS84.geojson
*
* crashing on holes may be?
*
@shaunakv1
shaunakv1 / flask_mvt.py
Created March 17, 2018 02:13 — forked from giohappy/flask_mvt.py
OL + Flask + PostGIS for MVT rendering
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import shutil
import math
import psycopg2
from flask import Flask, render_template, make_response
app = Flask(__name__)
@shaunakv1
shaunakv1 / jquery.reportViewProgress.js
Last active April 13, 2016 16:05
Report intevals of percentage of webpage scrolled by user
/**
* Author: Shaunak Vairagare
* Licence: MIT
* Plugin Url: https://gist.github.com/shaunakv1/4d187d9f445427ed31814735a575801c
*
* jQuery Plugin to report viewProgress on a element. Usually this will be used on window object, to
* detect how much of the page user has seen, and to get a callback each time.
*
* Usage Example:
* $(window).reportViewProgress({
@shaunakv1
shaunakv1 / angular-leaflet-directive multiple Geo json
Created September 18, 2014 18:02
angular-leaflet-directive multiple Geo json
leafletData.getMap().then(function(map) {
theMap = map;
highlightTrackGeoJson = L.geoJson(highlightTrack, {
style: function (feature) {
return {
weight: 12,
opacity: 1,
color: "#ffffff"
};
}
@shaunakv1
shaunakv1 / gist:4625384
Created January 24, 2013 17:23
JavaScript OpenLayers Map With ESRI Tiles
var slrMap = {
//default properties
map : null,
//class functions
loadMap: function(){
this.map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913"
@shaunakv1
shaunakv1 / gist:4549044
Created January 16, 2013 17:36
JavaScript: Openlayers Map Starting Template
function loadMap()
{
//create map object
map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913"
});
map.addLayer(
new OpenLayers.Layer.XYZ("esri", 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/${z}/${y}/${x}', {