Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrea Borruso aborruso

View GitHub Profile
@aborruso
aborruso / .block
Last active Mar 18, 2021 — forked from gbvitrano/.block
COVID-19 | Incidenza cumulativa settimanale dei contagi - By ondata.it
View .block
license: cc-by-4.0
View fix-wsl2-dns-resolution
1. Create a file: /etc/wsl.conf.
2. Put the following lines in the file in order to ensure the your DNS changes do not get blown away
[network]
generateResolvConf = false
3. In a cmd window, run wsl --shutdown
4. Restart WSL2
5. Create a file: /etc/resolv.conf. If it exists, replace existing one with this new file.
6. Put the following line in the file
View geopandas-polygon-cascaded-overlay.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View xpath-cheatsheet.js
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@aborruso
aborruso / create-new-file.ahk
Created Mar 30, 2019 — forked from TheBeastOfCaerbannog/create-new-file.ahk
AutoHotKey: Create a new file with Alt+N keyboard shortcut in Windows Explorer
View create-new-file.ahk
; This is part of my AutoHotKey [1] script. When you are in Windows Explorer it
; allows you to press Alt+N and type a filename, and that file is created
; in the current directory and opened in the appropriate editor (usually
; [gVim](http://www.vim.org/) in my case, but it will use whatever program is
; associated with the file in Windows Explorer).
; This is much easier than the alternative that I have been using until now:
; Right click > New > Text file, delete default filename and extension (which
; isn't highlighted in Windows 7), type the filename, press enter twice.
; (Particularly for creating dot files like ".htaccess".)
@aborruso
aborruso / gdal_ecw.sh
Created Mar 28, 2019 — forked from geodavey/gdal_ecw.sh
Install GDAL 2.3 with ECW support on Ubuntu 18.04
View gdal_ecw.sh
#!/bin/bash
##
## Tested on: Ubuntu 18.04 & ECW 5.4 & GDAL 2.3.1
##
## Download the ERDAS ECW JP2 SDK v5.4 Linux
## https://download.hexagongeospatial.com/downloads/ecw/erdas-ecw-jp2-sdk-v5-4-linux
## Download GDAL v2.3 Source (ex. 2.3.1)
View che_bello.sql
-- Thread: http://lists.gfoss.it/pipermail/gfoss/2017-October/042175.html
-- per eseguire lo SQL script devi semplicemente:
-- aprire una shell dei comandi (finestra nera)
-- posizionarti sulla cartella dove hai messo il tuo DB "campania_test.sqlite"
-- ed infine eseguire questo comando:
-- spatialite napoli.sqlite <moraca.sql
-- vedrai che alla fine ti troverai con un nuovo DB di
-- nome "napoli.sqlite" che contiene esclusivamente
@aborruso
aborruso / gist:2c8297779dae83d90bfe68ac0fa1fe1c
Created Jun 20, 2017 — forked from leifcr/gist:6448361
Install PhantomJS 1.9.1 x64 on ubuntu 12.04
View gist:2c8297779dae83d90bfe68ac0fa1fe1c
sudo apt-get install libfontconfig1
cd /usr/local/share/
wget https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
tar xjf phantomjs-1.9.1-linux-x86_64.tar.bz2
rm -f phantomjs-1.9.1-linux-x86_64.tar.bz2
ln -s phantomjs-1.9.1-linux-x86_64 phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/bin/phantomjs
phantomjs --version
@aborruso
aborruso / index.html
Last active May 16, 2017 — forked from darwin/index.html
OpenDataFest, invito
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<style>
a, a:visited {
color:red !important;
text-decoration:none !important;
}
View useful_pandas_snippets.py
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]