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 pandas as pd | |
from geopy.distance import EARTH_RADIUS | |
def numpy_distance(src_lats, src_longs, dest_lats, dest_longs): | |
"""Calculate distance between (effectively) two Series of points.""" | |
# Convert from degrees to radians. | |
src_lats = src_lats.apply(np.deg2rad) | |
src_longs = src_longs.apply(np.deg2rad) | |
dest_lats = dest_lats.apply(np.deg2rad) | |
dest_longs = dest_longs.apply(np.deg2rad) |
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
# Works on Py3 | |
def parse_version_failsafe(version_string): | |
try: | |
return Version( | |
unicodedata.normalize('NFKD', six.text_type(version_string)) | |
) | |
except (UnicodeError, InvalidVersion): | |
return 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
import datetime | |
def get_date(x): | |
"""Extract date from the provided timestamp. | |
Useful because the Pandas data model makes it hard to invoke | |
instance methods of values directly.""" | |
return x['Occurred Date or Date Range Start'].date() |
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
⇒ pip install jupyter [ruby-2.2.1] | |
Collecting jupyter | |
Downloading https://dev-infrastructure.rescuetime.com/root/pypi/+f/f81/d039e084c2c0c/jupyter-1.0.0-py2.py3-none-any.whl | |
Collecting qtconsole (from jupyter) | |
Downloading https://dev-infrastructure.rescuetime.com/root/pypi/+f/046/29b6bfeaa40fd/qtconsole-4.2.1-py2.py3-none-any.whl (104kB) | |
100% |████████████████████████████████| 112kB 1.4MB/s | |
Collecting ipykernel (from jupyter) | |
Downloading https://dev-infrastructure.rescuetime.com/root/pypi/+f/8dc/3c636084d2471/ipykernel-4.3.1-py2.py3-none-any.whl (93kB) | |
100% |████████████████████████████████| 102kB 1.8MB/s | |
Collecting nbconvert (from jupyter) |
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
../../dist/bin/jython ez_setup.py | |
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.1.tar.gz | |
Extracting in /var/folders/z0/0wnmjqt16pg547qwlmcw0xdw0000gp/T/tmpiUmmta | |
Now working in /var/folders/z0/0wnmjqt16pg547qwlmcw0xdw0000gp/T/tmpiUmmta/setuptools-2.0.1 | |
Installing Setuptools | |
Traceback (most recent call last): | |
File "setup.py", line 200, in <module> | |
dist = setuptools.setup(**setup_params) | |
File "/Users/whg/dev/jython-ssl/dist/Lib/distutils/core.py", line 112, in setup | |
_setup_distribution = dist = klass(attrs) |
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
<div data-dojo-type="dojo/store/Memory" | |
data-dojo-id="vendorStore" | |
data-dojo-props="[{id: 'spam', name: 'spam'}, {id: 'ham', name: 'ham'}, {id: 'eggs', name: 'eggs'}]"> | |
</div> | |
<!-- SNIP --> | |
<input | |
name="stuffAndStuff" | |
id="stuffAndStuff" | |
class="actualExpenseVendorControl" | |
data-dojo-type="dijit/form/ComboBox" |
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
whg@hanks-mbp:~|⇒ brew doctor | |
Warning: "config" scripts exist outside your system or Homebrew directories. | |
`./configure` scripts often look for *-config scripts to determine if | |
software packages are installed, and what additional flags to use when | |
compiling and linking. | |
Having additional scripts in your path can confuse software installed via | |
Homebrew if the config script overrides a system or Homebrew provided | |
script of the same name. We found the following "config" scripts: |
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
.flair { | |
border: none !important; | |
top: 20px; | |
padding: 0px; | |
background: url(%%hawks-flair-partial%%); | |
display: inline-block; } | |
.flair-10sharpsmall { | |
background-position: 0 0; | |
width: 16px; |
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
± heroku run bundle exec rake clean generate | |
Running `bundle exec rake clean generate` attached to terminal... up, run.1266 | |
rm -rf .pygments-cache/** .gist-cache/** .sass-cache/** source/stylesheets/screen.css | |
## Generating Site with Jekyll | |
create source/stylesheets/screen.css | |
Configuration from /app/_config.yml | |
Building site: source -> public | |
Liquid Exception: incompatible character encodings: UTF-8 and ASCII-8BIT in atom.xml | |
/app/vendor/bundle/ruby/1.9.1/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `join' | |
/app/vendor/bundle/ruby/1.9.1/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `render_all' |
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 timeit | |
def main(): | |
list_comp_t = timeit.Timer("y = [math.log10(num) for num in x]", setup="import math; x = [1500, 1049.8, 34, 351]") | |
map_t = timeit.Timer("z = map(math.log10, x)", setup="import math; x = [1500, 1049.8, 34, 351]") | |
# Use an absurdly high number of reps because the data is tiny and I want the numbers to be on a reasonably human timescale. | |
print list_comp_t.timeit(1000000) | |
print map_t.timeit(1000000) |
NewerOlder