Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Gratier ThomasG77

View GitHub Profile
View shapely_benchmarks.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View iPython_svg_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pygments_magic.py
"""
IPython magics for displaying source code files with syntax highlighting.
This uses the Pygments library: http://pygments.org.
To make it works, you need to cute and paste this file into
~/.ipython/profile_default/startup/
If you use custom profile, replace profile_default with your own path
Two magics are available:
View wrapper-usage.js
define([
'my/superModule',
'wrapper';
], function (superModule, wrapper) {
// Let's wrap it, aspect style
wrapper(superModule, 'superModule');
// Tada, all superModule methods will now log
});
View extract_airports_pdf.py
# -*- coding: utf8 -*-
import lxml.html
from lxml.cssselect import CSSSelector
# get some html
import requests
def scrapeAirport(page):
r = requests.get('http://aeronav.faa.gov/new_afd.asp?effDate=24JUL2014&eff=07-24-2014&end=09-18-2014&search=&submit1=Search&select=&StateSearch=ALL&CitySearch=&ChartSearch=&volsearch=&navaidSearch=&page=%s#results' % page)
@ThomasG77
ThomasG77 / index.html
Created Sep 22, 2014
Leaflet swipe (Adapted from https://www.mapbox.com/mapbox.js/example/v1.0.0/swipe-layers/ to use only Leaflet and not the MapBox API)
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Swipe between layers</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js'></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<style>
body { margin:0; padding:0; }
View index.html
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css" type="text/css">
<style>
body {
margin: 0;
padding: 0;
}
.map {
@ThomasG77
ThomasG77 / index.html
Last active Aug 29, 2015
Proj4js 2.x support with OpenLayers 2.x. Open the brower console to see the result
View index.html
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.3/proj4.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js"></script>
<script type="text/javascript">
//Snippet comes from http://osgeo-org.1560.x6.nabble.com/OL-2-13-1-latest-Proj4js-td5081636.html
window.Proj4js = {
Proj: function(code) {
return proj4(Proj4js.defs[code]);
@ThomasG77
ThomasG77 / index.html
Last active Aug 29, 2015
Proj4js classic demo based on OpenLayers 2.x and Proj4js 1.1. Open the brower console to see the result
View index.html
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js"></script>
<script type="text/javascript">
//Correct datum for potsdam (altough already corrected with changes in towgs84 in the projection declaration)
// Only useful if you use the outdated spatialreference.org proj4js definition whereas epsg.io is right...
Proj4js.Datum["potsdam"] = {towgs84: "598.1,73.7,418.2,0.202,0.045,-2.455,6.7", ellipse: "bessel", datumName: "Potsdam Rauenberg 1950 DHDN"};
// Declare projection
View deploy_python_27_alwaysdata.py
from __future__ import with_statement
from fabric.api import local, settings, abort, run, cd, env
from fabric.contrib.console import confirm
from fabric.contrib.files import exists, contains
# We reuse config from $HOME/.ssh/config
# Try
# fab --hosts=alwaysdata -f deploy_python_27_alwaysdata.py deploy_python
# or to set a specific version
# fab --hosts=alwaysdata -f deploy_python_27_alwaysdata.py deploy_python:version=2.7.5
You can’t perform that action at this time.