Skip to content

Instantly share code, notes, and snippets.

View andrashann's full-sized avatar

andrashann

View GitHub Profile
@JamesChevalier
JamesChevalier / overpass_query_all_streets.md
Last active March 20, 2024 13:33
Overpass API query to retrieve all streets in a city

An area ID in Overpass is the OSM relation ID + 3600000000

This information is kind of buried in the Overpass API wiki page documenting the available filters: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29

The OSM relation ID can be seen in two places:

  • Visit https://www.openstreetmap.org and search for the city
  • Click on its entry and you will be taken to a https://www.openstreetmap.org/relation/SOME_NUMBER_HERE page
  • The relation ID is in the URL as "SOME_NUMBER_HERE" in the bullet point above
  • The relation ID will also be in parentheses next to the city name in the left column
@stecman
stecman / AutoCrop.lua
Last active March 14, 2024 15:56
Lightroom plugin to calculate image crops using OpenCV
-- LR imports
local LrApplication = import("LrApplication")
local LrApplicationView = import("LrApplicationView")
local LrBinding = import("LrBinding")
local LrDevelopController = import("LrDevelopController")
local LrDialogs = import("LrDialogs")
local LrExportSession = import("LrExportSession")
local LrFileUtils = import("LrFileUtils")
local LrFunctionContext = import("LrFunctionContext")
local LrLogger = import("LrLogger")
@mdo
mdo / 00-intro.md
Last active March 24, 2024 08:04
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@kaitmorano
kaitmorano / README.md
Created October 20, 2015 06:32 — forked from TDahlberg/README.md
GeoData Science Learning Resources

#“A data scientist is someone who knows more statistics than a computer scientist and more computer science than a statistician.” -Josh Blumenstock

#"A geo-data scientist is someone who knows more about GIS than either of those guys." -Tyler Dahlberg

#Going Geo Open Source In all likelihood a list like this has been written somewhere, by someone, for some reason. I know I'm not breaking any ground here; I'm just trying to organize on paper what's been going through my head ever since I got out of grad school.

@chtzvt
chtzvt / smokey.conf
Last active December 30, 2017 21:00
This bit of lighttpd configuration is what I use to stop image hotlinking, while also ensuring that search engines and social media can still access images.
###Hotlinking madness :^)
$HTTP["host"] =~ "charltontrezevant\.com" {
$HTTP["referer"] !~ "charltontrezevant|ctis\.me|google|bing|facebook|twitter|reddit|ycombinator|Skype|Slack" {
$HTTP["useragent"] !~ "Google|msnbot|FlipBoard|Bing|Yahoo|Facebook|Yandex|twitter|Slack|Skype" {
$HTTP["url"] =~ "\.jpeg|\.jpg|\.png|\.gif|\.bmp" {
$HTTP["url"] !~ "hotlinking\.png" {
url.redirect = ("" => "https://www.charltontrezevant.com/resources/images/hotlinking.png")
}
}
}
@dapangmao
dapangmao / blog.md
Last active April 5, 2016 15:57
Spark example

###Transform RDD to DataFrame in Spark

from pyspark.sql import Row
import os

rdd = sc.textFile('C:/Users/chao.huang.ctr/spark-playground//class.txt')
def transform(x):
    args = x.split()
 funcs = [str, str, int, float, float]
@pbugnion
pbugnion / ipython_notebook_in_git.md
Last active October 22, 2023 12:25
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.

@jbarratt
jbarratt / nbgrep
Last active April 27, 2023 15:00
'nbgrep', search the code of all your ipython notebooks
#!/bin/bash
# usage: nbgrep 'pattern'
SEARCHPATH=~/work/
# 'jq' technique lifted with gratitude
# from https://gist.github.com/mlgill/5c55253a3bc84a96addf
# Break on newlines instead of any whitespace
@vicapow
vicapow / README.md
Last active December 17, 2019 11:15
An example of creating a PNG from an SVG in D3.

This is an example of creating a PNG from an SVG. (You should notice that you're able to right click on the last image and save it as a PNG image.) It has been Tested in Firefox and Chrome but doesn't work in Safari as of 2014-07-20.

Normally, you'll create your SVG in D3 but to make the example a bit more readable, the SVG is already placed in the document. There are a few important points. Namely:

  1. All the styles of the SVG need to be self contained in side of the <defs> tags. (These styles should be escaped using the <![[CDATA[ ... ]] tag.)
  2. The SVG needs to have the proper namespaces and document types.
  3. The SVG needs to be saved to an image, then read from an canvas element, then saved to an image again.

Note: Portions of this demo where taken from The New York Times' excellent Crowbar SVG extractor.

@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers