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 matplotlib.pyplot as plt | |
def point_in_circle(xp, yp, xc, yc, r): | |
return (xp - xc)**2 + (yp - yc)**2 < r**2 | |
def draw_circles(ax, centers, classes, colors): | |
for i in range(centers.shape[0]): | |
circle = plt.Circle((centers[i, 1], centers[i, 0]), 20, color=colors[classes[i]], fill=False) |
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
#!/usr/bin/env python | |
import sys | |
import urllib2 | |
import json | |
endpoint = "https://api.coinmarketcap.com/v1/ticker/" | |
args = 'bitcoin 1 litecoin 1 ethereum 1'.split(' ') | |
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
# coding: utf-8 | |
import json | |
import geojson | |
from geojson import Feature, Point, FeatureCollection, Polygon | |
import os | |
def parse_geojson(fname): | |
print fname | |
with open(fname, 'r') as f: |
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
for i in *.kml; do | |
new=$(printf "%s.geojson" $(echo $i | cut -f 1 -d '.')); | |
togeojson "$i" > "$new"; | |
done |
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 math import cos,sin,acos,asin,tan | |
from math import degrees as deg, radians as rad | |
from datetime import date,datetime,time | |
# this module is not provided here. See text. | |
from timezone import LocalTimezone | |
class sun: | |
""" | |
Calculate sunrise and sunset based on equations from NOAA |
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/bash | |
file="$1" | |
for page in $(identify -density 12 -format '%p ' "$file") ; do | |
if convert "$file[$((page-1))]" -colorspace RGB -unique-colors txt:- | sed -e 1d | egrep -q -v ': \(\s*([0-9]*),\s*\1,\s*\1' ; then | |
echo $page | |
fi | |
done |
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
newr='./r'; for f in `find . -name "*.jpg"`; do newname="${f/./$newr}"; convert $f -resize 32x32\! $newname; done |
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
convert -delay 100 -loop 0 *.png anim.gif |
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/bash | |
date | md5 | tail -c 16 | pbcopy |
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
// Example | |
var x = [1, 2, 3, 4, 5] // [1, 2, 3, 4, 5] | |
var y = [1, 1, 2, 3, 5] // [1, 1, 2, 3, 5] | |
var z = x - y // [0, 1, 1, 1, 0] | |
x[ x % 2 != 0 ] = x + 1 // [2, 2, 4, 4, 6] | |
y[ y > 2 * z ] = y * y // [1, 1, 2, 9, 25] | |
z[ x > 2 && x < 6 ] = 0 // [0, 1, 0, 0, 0] |