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
def local_difference(p, data, constrain_metric, change_metric, walk_length=10): | |
"""Identify difference from local smoothing | |
p is an x declaration of dataset data | |
""" | |
p = int(p) | |
constrain_data = functools.reduce(getattr, | |
[data] + constrain_metric.split('.')) | |
change_data = functools.reduce(getattr, | |
[data] + change_metric.split('.')) |
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 PyPDF2 as PDF | |
import os | |
f = "C:\\User Data\\Nikon\\4_12_2016\\Multi Dimensional Acquisition Summar.pdf" | |
pdf_obj = PDF.PdfFileReader(open(f, 'rb')) | |
pdf_text = pdf_obj.getPage(0).extractText() | |
description = pdf_text.split('\n')[-1].split('Description')[-1].split('Printed on')[0] | |
# OR | |
descriptions = dict() |
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
# ver a | |
def anagram(str_a, str_b): | |
return sorted([ord(x) for x in str_a]) == sorted([ord(y) for y in str_b]) | |
# ver b | |
def anagram(str_a, str_b): | |
if len(str_a) == len(str_b): | |
return sorted(str_a) == sorted(str_b) | |
return False |
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
We'll begin with a box, and the plural is boxes; | |
but the plural of ox became oxen not oxes. | |
One fowl is a goose, but two are called geese, | |
yet the plural of moose should never be meese. | |
You may find a lone mouse or a nest full of mice; | |
yet the plural of house is houses, not hice. | |
If the plural of man is always called men, | |
why shouldn't the plural of pan be called pen? | |
If I spoke of my foot and show you my feet, | |
and I give you a boot, would a pair be called beet? |
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
% Filter dataMatrix to eliminate elements which contain fewer than 50 subelements | |
% i.e. subthresholding dataMatrix | |
dataMatrix(find(cellfun('size', dataMatrix, 1) < 50)) = cell(1); |
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
wget -q -O- http://feeds.serialpodcast.org/serialpodcast | grep -o "<enclosure[ -~][^>]*" | grep -o "http://[ -~][^\"]*" | xargs wget -c |
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
desktop ~ $ cat .conkyrc | |
# conky configuration | |
# | |
# The list of variables has been removed from this file in favour | |
# of keeping the documentation more maintainable. | |
# Check http://conky.sf.net for an up-to-date-list. | |
# | |
# For ideas about how to modify conky, please see: | |
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/ | |
# |
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
# Trying to filter on a hybrid_property | |
# This should return all but one of them (12 out of 13) | |
In [590]: active = db.session.query(db.Trade).filter(db.Trade.active == True).all() | |
# Nope | |
In [591]: active | |
Out[591]: [] | |
# Try this? | |
In [592]: active = db.session.query(db.Trade).filter(db.Trade.active).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
javascript: ( | |
function () { | |
var data = document.getElementsByClassName("review-price"); | |
for (var i = 0; i < data.length; i++) { | |
if (data[i].innerHTML.indexOf("£") != -1) { | |
data[i].innerHTML = '$' + Math.round(data[i].innerText.replace('£', '') * 1.6479 * 100) / 100; | |
} | |
} | |
}()) |
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
In [1]: # Cadence measured by count ~10x during ride | |
In [2]: # Averaged 102 rpm (with a range of 96-122) | |
In [3]: 102 * 30 # rpm * min | |
Out[3]: 3060 | |
In [4]: 17 + 133 + 89 # steps measured by fitbit intervals | |
Out[4]: 239 |