This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
"exec" "twxec" "-e" "rand_ints()" "$0" "$@" | |
import random | |
import gevent | |
def rand_ints(): | |
while True: | |
value = random.randint({{number minval}}, {{number maxval}} + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"item": { | |
"title": "New Map", | |
"snippet": "Census Blocks", | |
"extent": [ | |
[ | |
-124.86249999996639, | |
-42.233197141816774 | |
], | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href= | |
"http://js.arcgis.com/3.14/esri/css/esri.css"> | |
<link rel="stylesheet" type="text/css" href= | |
"https://rawgit.com/benheb/legend/master/legend.css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import matplotlib.pyplot as plt | |
from datetime import timedelta | |
from bson import ObjectId | |
import seaborn as sns | |
sns.set_style('whitegrid') | |
from itertools import cycle | |
cyclic_palette = cycle(sns.color_palette()) | |
values = [] | |
X = [ObjectId(oid).generation_time for oid, rec in data][:40] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 as b64 | |
import numpy as np | |
import cv2 | |
import matplotlib.pyplot as plt | |
from ipywidgets import interact, interactive, fixed | |
from IPython.display import Image, display | |
import ipywidgets as widgets | |
def convert_media_to_image(media): | |
arr = np.asarray(bytearray(b64.b64decode(media["__data__"])), dtype=np.uint8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gevent | |
import urllib2 | |
image_url = "http://manage.hdrelay.com/snapshot/ee489921-1004-45df-9634-0fa96543dabf?size=710x425&f=30000" | |
polling_interval = "31" | |
def stream(): | |
while True: | |
msg = {"media_url": image_url} | |
msg["polling_interval"] = float(polling_interval) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import rasterio | |
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def render_array(arr1, arr2=None, width=7, height=7, cmap=plt.cm.jet): | |
if arr2 is None: | |
fig, ax = plt.subplots(1, figsize=(width,height), facecolor='white') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gevent | |
from planet import api | |
import geojson | |
bbox = {{ string bbox }} | |
minx, miny, maxx, maxy = None, None, None, None | |
if bbox is not None: | |
minx, miny, maxx, maxy = bbox.split(',') | |
if minx is not None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from planet import api | |
import sys, os | |
import urllib2, httplib | |
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import matplotlib.image as mpimg | |
class NoRedirection(urllib2.HTTPErrorProcessor): | |
def http_response(self, request, response): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
from skimage import measure | |
from skimage.measure import regionprops | |
from skimage.morphology import skeletonize, convex_hull_image, medial_axis, opening | |
from scipy import ndimage | |
def seg_buffer(im, dist=25): | |
mask = im.copy() |
OlderNewer