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
'''Provides utility functions for encoding and decoding linestrings using the | |
Google encoded polyline algorithm. | |
''' | |
def encode_coords(coords): | |
'''Encodes a polyline using Google's polyline algorithm | |
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html | |
for more information. | |
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
time | wind | |
---|---|---|
2010-01-01 00:00:00 | 1367 | |
2010-01-01 01:00:00 | 1187 | |
2010-01-01 02:00:00 | 1090 | |
2010-01-01 03:00:00 | 1439 | |
2010-01-01 04:00:00 | 2362 | |
2010-01-01 05:00:00 | 2783 | |
2010-01-01 06:00:00 | 2869 | |
2010-01-01 07:00:00 | 2512 | |
2010-01-01 08:00:00 | 1804 |
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
ಠ_ಠ | |
( ͡° ͜ʖ ͡°) | |
¯\_(ツ)_/¯ | |
(╯°□°)╯︵ ┻━┻ | |
http://www.fileformat.info/convert/text/upside-down.htm | |
WRTTN http://wrttn.me/30dbfd/ | |
Unicode Emoticons |
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
def decode_google_polyline(encoded): | |
""" | |
Decode a google polyline string into a list of coordinates. | |
See http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html | |
""" | |
raw_numbers = [ord(c) - 63 for c in encoded[::-1]] | |
current_number = 0 | |
sequence = [] |
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
### | |
Converts the distance between the WGS 84 coordinates pointA and pointB to meters. | |
Ported from http://groups.google.com/group/sci.geo.satellite-nav/msg/0bfca0bf8a986395 | |
with the suggested radii-calculation optimization. | |
### | |
module.exports.WGS84DegreesToMeters = (pointA, pointB)-> | |
radFactor = Math.PI/180 | |
[lat1, lon1] = [pointA[0]*radFactor, pointA[1]*radFactor] | |
[lat2, lon2] = [pointB[0]*radFactor, pointB[1]*radFactor] |
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
# First install tmux | |
brew install tmux | |
# For mouse support (for switching panes and windows) | |
# Only needed if you are using Terminal.app (iTerm has mouse support) | |
Install http://www.culater.net/software/SIMBL/SIMBL.php | |
Then install https://bitheap.org/mouseterm/ | |
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ |
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/python | |
# http://en.wikipedia.org/wiki/Viterbi_algorithm | |
''' | |
Consider two friends, Alice and Bob, who live far apart from each other and who talk together daily over the telephone about what they did that day. Bob is only interested in three activities: walking in the park, shopping, and cleaning his apartment. The choice of what to do is determined exclusively by the weather on a given day. Alice has no definite information about the weather where Bob lives, but she knows general trends. Based on what Bob tells her he did each day, Alice tries to guess what the weather must have been like. | |
Alice believes that the weather operates as a discrete Markov chain. There are two states, "Rainy" and "Sunny", but she cannot observe them directly, that is, they are hidden from her. On each day, there is a certain chance that Bob will perform one of the following activities, depending on the weather: "walk", "shop", or "clean". Since Bob tells Alice about his activities, those are the observations. The entire |
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 ruby | |
# encoding: utf-8 | |
require 'bson' | |
20.times do | |
puts BSON::ObjectId.new | |
end |
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
--------- clients.py -------- | |
class PikaPubSubPublishClient(object): | |
def __init__(self, host=settings.APP_MESSAGER_DEFAULT_HOST, | |
port=settings.APP_MESSAGER_DEFAULT_PORT, | |
virtual_host=settings.APP_MESSAGER_DEFAULT_VIRTUALHOST, | |
username=settings.APP_MESSAGER_DEFAULT_USERNAME, | |
password=settings.APP_MESSAGER_DEFAULT_PASSWORD, | |
exchange_name='ground', |
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
license: gpl-3.0 |