Skip to content

Instantly share code, notes, and snippets.

View ewjoachim's full-sized avatar
🐍
👨‍💻

Joachim Jablon ewjoachim

🐍
👨‍💻
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ewjoachim on github.
  • I am ewjoachim (https://keybase.io/ewjoachim) on keybase.
  • I have a public key whose fingerprint is 9018 4FBE 55F2 A1F7 EBC9 A49E 4E90 5C37 D2C6 5627

To claim this, I am signing this object:

@ewjoachim
ewjoachim / distance.py
Last active July 12, 2016 15:46
Meetup Lille.py 12 juillet
from math import cos, sin, radians, atan2, sqrt
radius = 6371 # km
def distance(origin, destination):
"""
Determine distance between 2 sets of [lat,lon] in km
"""
@ewjoachim
ewjoachim / ipynb_to_jekyll.py
Last active May 15, 2016 12:21
Jupyter Notebook to Jekyll (GHP)
#!/usr/bin/env python3
# coding=utf-8
"""
Borrowed and updated from
https://adamj.eu/tech/2014/09/21/using-ipython-notebook-to-write-jekyll-blog-posts/
"""
from __future__ import print_function
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ewjoachim
ewjoachim / debug.py
Created September 14, 2015 11:06
Debug in place
import inspect
def debug():
"""
Anywhere in the code:
debug() # opens ipython shell
"""
from IPython.terminal.embed import InteractiveShellEmbed
ipshell = InteractiveShellEmbed()
@ewjoachim
ewjoachim / comprehension.ipynb
Created September 14, 2015 08:47
Comprehensions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def get_linked_objects(obj):
"""
Returns all the objects that would be deleted if a cascade deletion were to be done.
"""
links = [rel.get_accessor_name() for rel in obj._meta.get_all_related_objects()]
return [liked_obj for link in links for liked_obj in getattr(obj, link).all()]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ewjoachim
ewjoachim / puzzle.ipynb
Created March 14, 2015 19:13
Reddit Image puzzle
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ewjoachim
ewjoachim / Class.js
Last active August 29, 2015 14:02
Base class for Javascript
define(["jq"], function($){
"use strict";
var Class = function(){};
var minimal_class_definition =
{
init: function()
{
}
};
var extend = function (base_class, additionnal_definition)