Skip to content

Instantly share code, notes, and snippets.

# create figure form matplotlib.pyplot
fig = plt.figure()
# make global min/max for the whole array,
# so colour scale will be consistent between the frames
data_min = np.nanmin(full_data_panel.values)
data_max = np.nanmax(full_data_panel.values)
# create iterator
data_frames_iterator = full_data_panel.iteritems()
full_data_dict = dict()
for frame in fetch_batch():
for layer in frame['entries']: # single batch can contain more than one timestamp
layer_coords = dict()
# convert lists of axes into dict
for layer_coord in layer['indexAxes']:
layer_coords[layer_coord[0]] = layer_coord[1]
# latitude and longitude should be present in the axes output
def fetch_batch(page=0):
while True:
res = API.datasets(DATASET_ID).area().get(
apikey=APIKEY,
polygon=POLYGON,
count=PAGESIZE,
var=VARIABLE,
offset=PAGESIZE * page,
grouping='location',
)
@dobrych
dobrych / GIF-Screencast-OSX.md
Created November 23, 2015 19:32 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@dobrych
dobrych / read_png_row_to_json.py
Last active December 19, 2015 21:28
made a quick script that generates json list of rgb values from png row, useful for palette reading # pip install pypng
import png
f = open('palette.png', 'r')
p = png.Reader(f)
res = p.read()
palette = res[3]['palette']
data = list(res[2])
@dobrych
dobrych / git versioner
Created January 23, 2012 17:07 — forked from Abizern/git versioner
Xcode build script that adds the commit sha to the CFBundleVersion
#!/usr/bin/env ruby
# Xcode auto-versioning script for Subversion by Axel Andersson
# Updated for git by Marcus S. Zarra and Matt Long
# Converted to ruby by Abizer Nasir
# Appends the git sha to the version number set in Xcode.
# see http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/ for more details
# These are the common places where git is installed.
# Change this if your path isn't here
@dobrych
dobrych / rails.conf
Created December 10, 2011 00:39 — forked from jcf/rails.conf
NewSyslog Log Rotate on OS X
# Rotate rails logs on OS X using newsyslog
# count: how many old files to keep around, this is dev, so 0
# size: 1000 kb
# when: * - only rely on the size property
# flags: G - interpret logfilename as a shell pattern
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/Users/jcf/Code/**/log/*.log 666 0 1000 * G
@dobrych
dobrych / rails.conf
Created December 10, 2011 00:25 — forked from jcf/rails.conf
NewSyslog Log Rotate on OS X
# Rotate rails logs on OS X using newsyslog
# count: how many old files to keep around, this is dev, so 0
# size: 1000 kb
# when: * - only rely on the size property
# flags: G - interpret logfilename as a shell pattern
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/Users/jcf/Code/**/log/*.log 666 0 1000 * G
@dobrych
dobrych / gist:1082332
Created July 14, 2011 12:06
zenlist include
<html>
<head>
<script src="http://dev-upload.zenlist.com:9191/js/client.js" type="text/javascript"></script>
</head>
<body>
<div id="zenlist" name="zenlist" class="mainWrapper"></div><!-- zenlist -->
<div class="mainWrapper featured_block"></div><!-- zenlist -->
<script>
Zenlist.urls.assets = 'http://dev-upload.zenlist.com:9191';
Zenlist.urls.api = 'http://dev-api.zenlist.com:8151/';
@dobrych
dobrych / gist:964998
Created May 10, 2011 17:59
parse virtual hosts info from multiple apache configs
#!/bin/sh
find /webhomes/*/conf -name vhost.conf | while read -r CONF
do
username=$(echo $CONF | awk 'BEGIN { FS = "/" } ; {print $3}')
domains=$(egrep 'ServerName|ServerAlias' $CONF | awk '{print $2}')
echo $username: $domains
echo
done