Skip to content

Instantly share code, notes, and snippets.

View jleinonen's full-sized avatar

Jussi Leinonen jleinonen

View GitHub Profile
@jleinonen
jleinonen / bs_datetime.py
Last active December 14, 2015 11:49
Django widget for bootstrap-datetimepicker
from django import forms
from django.utils.safestring import mark_safe
class DateTimeWidget(forms.DateTimeInput):
class Media:
css = {
"all": ("bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css",)
}
js = ("bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js")
@jleinonen
jleinonen / gdal_mmap.py
Created June 14, 2013 12:02
Use a GDAL memory-mapped file to open an image retrieved via HTTP directly as a NumPy array without saving to a temporary file.
from gzip import GzipFile
from io import BytesIO
import urllib2
from uuid import uuid4
import gdal
def open_http_query(url):
try:
request = urllib2.Request(url,