Skip to content

Instantly share code, notes, and snippets.

View hugonbgg's full-sized avatar

Hugo Nicolau Barbosa de Gusmão hugonbgg

View GitHub Profile
@korakot
korakot / selenium.py
Last active March 26, 2024 07:40
Use selenium in Colab
# install chromium, its driver, and selenium
!apt update
!apt install libu2f-udev libvulkan1
!wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
!dpkg -i google-chrome-stable_current_amd64.deb
!wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/118.0.5993.70/linux64/chromedriver-linux64.zip
!unzip -j chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/
!pip install selenium chromedriver_autoinstaller
# set options to be headless, ..
@malwoodsantoro
malwoodsantoro / index.html
Last active August 25, 2022 17:49
Use feature state to change features to same color on hover
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Create a hover effect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@geog4046instructor
geog4046instructor / leaflet-basemap-switcher.js
Last active March 28, 2023 14:49
Leaflet - Basemap switcher
/* This example is similar to the leaflet-layer-control.js example:
* (https://gist.github.com/geog4046instructor/65f38124e3f56f11c9461b23335c0c92)
* but this example only adds basemaps (tileLayer) to the control.
*/
// create a street map layer and add it to the map, making it the default basemap
let streets = L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' ).addTo( map )
// create a satellite imagery layer
let satellite = L.tileLayer( 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}' )
@geog4046instructor
geog4046instructor / leaflet-jquery-geojson-layer-control.js
Last active June 29, 2023 06:37
Leaflet - Control to show/hide a GeoJSON layer that has been added with AJAX through jQuery
/*
* This example shows how to add a layer list to a map where users can check and uncheck boxes to show and hide layers.
* The code below is combined with the code to add geojson to a map, since those two things are often used together.
* The code consists of five main parts:
* 1. Create the basemap(s) and layer(s)
* 2. Get geojson data and run a function to add it to a layer from step 1
* 3. Create the function that will be run in step 2
* 4. Create the list of layers that will appear in the control component
* 5. Create the control component
*/
#!/usr/bin/env python3
from io import BytesIO
from os.path import abspath, dirname, join
from zipfile import ZipFile
from lxml.html import parse
from requests import get
baseurl = 'http://www1.caixa.gov.br/loterias/_arquivos/loterias/{product}'
@YKCzoli
YKCzoli / Lidar_walkthrough.md
Last active November 15, 2023 18:35
Lidar_walkthrough

Processing LiDAR to extract building heights

Walk through

Detailed walk through of building extraction using postgis

First lets pull a data layer from of openstreetmap. You can do this any which way you’d like, as there are a variety of methods for pulling openstreetmap data from their database. Check the [wiki] (http://wiki.openstreetmap.org/wiki/Downloading_data) for a comprehensive list. My favourite method thus far is pulling the data straight into QGIS using the open layers plugin. For those who may want to explore this method, check [this tutorial] (http://www.qgistutorials.com/en/docs/downloading_osm_data.html). For building extraction you only need building footprints, and include the building tags. Not all polygons are of type building in OSM, so we can download all the polygons, and then filter the layer for only polygons tagged as buildings.

LiDAR data was pulled from USGS via the Earth Explorer site. [Here] (http://earthobservatory.nasa.gov/blogs/ele