Skip to content

Instantly share code, notes, and snippets.

View matyushkin's full-sized avatar
🐕
Glad you found this page

Leo Matyushkin matyushkin

🐕
Glad you found this page
View GitHub Profile
@matyushkin
matyushkin / geo_distance.py
Created October 29, 2017 10:03
Find distance between two geolocations by addresses string in python
from geopy.geocoders import Nominatim
from geopy import distance
geolocator = Nominatim()
my_location = geolocator.geocode("Russia, Saint-Petersburg")
user_location = geolocator.geocode("Russia, Moscow")
my_coords = ((my_location.latitude, my_location.longitude))
user_coords = ((user_location.latitude, user_location.longitude))
print(distance.vincenty(my_coords, user_coords).km)
@matyushkin
matyushkin / The_orbit_of_the_Earth_around_the_Sun.py
Created July 22, 2014 16:32
The orbit of the Earth around the Sun
from numpy import sqrt, arange
import matplotlib.pyplot as plt
G = 6.67384e-11 # Gravitational constant, m3 kg-1 s-2
M = 1.989e30 # Mass of Sun, kg
x = 1.475e11 # Perihelion Sun-Earth distance
y = 0
r = 0
@matyushkin
matyushkin / range_xrange_comparison.py
Created July 15, 2014 19:13
range/xrange comparison (python 2.7)
import time
from matplotlib import pyplot as plt
n = 9
def who_is_best(func):
t0 = time.time()
for i in func:
i = i**2
delta_t = time.time() - t0