Skip to content

Instantly share code, notes, and snippets.

View lsartran's full-sized avatar

Laurent Sartran lsartran

View GitHub Profile

Keybase proof

I hereby claim:

  • I am lsartran on github.
  • I am lsartran (https://keybase.io/lsartran) on keybase.
  • I have a public key ASBN9Rc0ZjHcBlC6X9H2F75vz5MW_W3imF-u2q_ucdlt0wo

To claim this, I am signing this object:

@lsartran
lsartran / nbstripout
Last active August 29, 2015 14:06 — forked from minrk/nbstripout
#!/usr/bin/env python
"""strip outputs from an IPython Notebook
Opens a notebook, strips its output, and writes the outputless version to the original file.
Useful mainly as a git pre-commit hook for users who don't want to track output in VCS.
This does mostly the same thing as the `Clear All Output` command in the notebook UI.
"""
@lsartran
lsartran / totalspent.js
Created December 23, 2013 23:47
Get the total amount spent on Amazon(.com/.co.uk/.fr/etc.) from a single Your Account > Your Orders page. To be pasted in the JavaScript console.
var total = 0.
var prices = document.querySelectorAll('#cs-orders > div.action-box > div.order-level > ul.order-details > li > span.price');
for (var i = 0; i<prices.length; i++) {
total += parseFloat(prices[i].textContent.replace('$','USD ').replace('£','GBP ').split(' ')[1].replace(',','.'),10);
}