Skip to content

Instantly share code, notes, and snippets.

---
title: 'Multivariate Distances: Mahalanobis vs. Euclidean'
author: "Billy Raseman"
date: "July 12, 2018"
output: html_document
---
Below is the code used to create the plots for https://waterprogramming.wordpress.com/2018/07/23/multivariate-distances-mahalanobis-vs-euclidean/. My apologies that it is not entirely reproducible. I found it a bit easier to post-process a few of the plots (particularly for the PCA part)!
```{r}
@scrapehero
scrapehero / expedia.py
Last active August 24, 2020 04:32
Python 3 code to extract the flight schedules and prices for a source and destination pair.
import json
import requests
from lxml import html
from collections import OrderedDict
import argparse
def parse(source,destination,date):
for i in range(5):
try:
url = "https://www.expedia.com/Flights-Search?trip=oneway&leg1=from:{0},to:{1},departure:{2}TANYT&passengers=adults:1,children:0,seniors:0,infantinlap:Y&options=cabinclass%3Aeconomy&mode=search&origref=www.expedia.com".format(source,destination,date)
@keithweaver
keithweaver / create-folder.py
Created March 10, 2017 03:42
Create a folder with Python
import os
def createFolder(directory):
try:
if not os.path.exists(directory):
os.makedirs(directory)
except OSError:
print ('Error: Creating directory. ' + directory)
@ateucher
ateucher / setup-gh-cli-auth-2fa.md
Last active May 3, 2024 11:06
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email '[email protected]'
    
@malkitsingh
malkitsingh / instructions.txt
Created February 2, 2017 17:37
Step by step guide to install nominatim server
I followed these two blogs to install server
1. http://koo.fi/blog/2015/03/19/openstreetmap-nominatim-server-for-geocoding/#Compile_Nominatim
This explains ( and is the main blog which I followed) various steps
2. https://www.linuxbabe.com/linux-server/openstreetmap-tile-server-ubuntu-16-04
This explains how to setup swap files and install tiles if needed.
I will use Ubuntu 14.04 LTS as the platform. Just a basic install with ssh server. We will install Apache to serve http requests. Make sure you have enough disk space and RAM to hold the data and serve it efficiently. I used the Finland extract, which was about a 200 MB download. The resulting database was 26 GB after importing, indexing and adding Wikipedia data. The Wikipedia data probably actually took more disk space than the OSM data. My server has 4 GB RAM, which seems to be enough for this small data set.
1. Sofware requirements
@bradoyler
bradoyler / .block
Last active September 12, 2024 04:39
crime rates in US cities
license: mit
#!/bin/python
# -*- coding: utf-8 -*-
from time import sleep
from random import randint
from selenium import webdriver
from pyvirtualdisplay import Display
class MuncherySpider():
def __init__(self):
@lukas-h
lukas-h / license-badges.md
Last active December 23, 2025 15:41
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@camb416
camb416 / grabAllTheCameras.sh
Created January 29, 2016 23:06
Grab all the NYC DOT Traffic camera images and make a contact sheet with imagemagick
#!/bin/bash
wget http://207.251.86.238/cctv261.jpg
wget http://207.251.86.238/cctv254.jpg
wget http://207.251.86.238/cctv490.jpg
wget http://207.251.86.238/cctv263.jpg
wget http://207.251.86.238/cctv644.jpg
wget http://207.251.86.238/cctv696.jpg
wget http://207.251.86.238/cctv722.jpg
wget http://207.251.86.238/cctv200.jpg
wget http://207.251.86.238/cctv31.jpg