Skip to content

Instantly share code, notes, and snippets.

View chrisluedtke's full-sized avatar

Chris Luedtke chrisluedtke

View GitHub Profile
@colejhudson
colejhudson / rosenbrock.py
Last active February 24, 2019 08:10
Manual gradient descent over the rosenbrock function
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
def derivative(f):
def df(x, h=0.1e-10):
return (f(x+h)-f(x-h))/(2*h)
return df
@adamhaney
adamhaney / dag.py
Created June 14, 2017 18:10
DBT Airflow DAG with model/graph introspection
from datetime import datetime, timedelta
import networkx as nx
from airflow import DAG
from airflow.operators import BashOperator, SubDagOperator
start_date = datetime(year=2017, month=6, day=13, hour=19, minute=0)
schedule_interval = '0 * * * 1-5'
default_args = {
@signed0
signed0 / gist:2031157
Created March 13, 2012 19:53
Google Polyline encoder & decoder
'''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.