Skip to content

Instantly share code, notes, and snippets.

View tappoz's full-sized avatar

Alessio Gottardo tappoz

View GitHub Profile
# See official docs at https://dash.plotly.com
# pip install dash pandas
from dash import Dash, dcc, html, Input, Output
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv')
@mrlesmithjr
mrlesmithjr / ansible-macos-homebrew-packages.yml
Last active January 21, 2025 16:34
Install MacOS Homebrew Packages With Ansible
---
- name: Install MacOS Packages
hosts: localhost
become: false
vars:
brew_cask_packages:
- atom
- docker
- dropbox
- firefox
@mappingvermont
mappingvermont / osm_boundingbox.py
Created July 21, 2016 21:49
Use geopandas to extract south/west/north/east bounding box from a gridded shapefile
import geopandas as gpd
import pandas as pd
shp = gpd.GeoDataFrame.from_file('lossdata_footprint/lossdata_footprint.shp')
# BBox order
# minimum latitude, minimum longitude, maximum latitude, maximum longitude
# (or South-West-North-East).
bbox_dict = {}
@deadprogram
deadprogram / sastoken.go
Last active December 19, 2021 16:43
Golang command line utility to generate Microsoft Azure SAS tokens for Azure IoT Hub
// Golang command line utility to generate an Microsoft Azure SAS token for use
// with the MS Azure IoT Hub.
//
// USAGE: USAGE: sastoken <URI> <key> <expiresInMins> [policy]
//
// Copyright © 2016 The Hybrid Group (http://hybridgroup.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the “Software”), to deal
// in the Software without restriction, including without limitation the rights
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cdipaolo
cdipaolo / HaversinFormula.go
Created April 15, 2015 01:31
Golang functions to calculate the distance in meters between long,lat points on Earth.
// haversin(θ) function
func hsin(theta float64) float64 {
return math.Pow(math.Sin(theta/2), 2)
}
// Distance function returns the distance (in meters) between two points of
// a given longitude and latitude relatively accurately (using a spherical
// approximation of the Earth) through the Haversin Distance Formula for
// great arc distance on a sphere with accuracy for small distances
//
@jayswan
jayswan / gist:a8d9920ef74516a02fe1
Last active March 11, 2022 15:33
Elasticsearch Python bulk index API example
>>> import itertools
>>> import string
>>> from elasticsearch import Elasticsearch,helpers
es = Elasticsearch()
>>> # k is a generator expression that produces
... # a series of dictionaries containing test data.
... # The test data are just letter permutations
... # created with itertools.permutations.
... #
... # We then reference k as the iterator that's
@bollwyvl
bollwyvl / Embedded Mermaid diagrams in the IPython Notebook.ipynb
Last active January 17, 2023 10:12
Embedded Mermaid diagrams in the IPython Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@l0ki000
l0ki000 / csd-wrapper.sh
Last active March 7, 2025 10:14 — forked from zer4tul/gist:6477470
Cisco Anyconnect CSD wrapper for OpenConnect (exhanced to autodownload and autoupdate hostscan)
#!/bin/bash
# Cisco Anyconnect CSD wrapper for OpenConnect
# Enter your vpn host here
CSD_HOSTNAME=
if [[ -z ${CSD_HOSTNAME} ]]
then
echo "Define CSD_HOSTNAME with vpn-host in script text. Exiting."
exit 1
fi
@shaond
shaond / proxy.js
Last active June 27, 2018 11:28
Node.js code to proxy an upstream webpage using cheerio
var http = require('http');
var express = require('express');
var router = express.Router();
/* GET users listing. */
router.get('/', function(req, res) {
var request = require('request');
var url = req.query.url;