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
java.io.InputStream inputStream = getClass().getClassLoader().getResourceAsStream("relative-path"); |
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 unittest | |
class FooTests(unittest.TestCase): | |
def testFoo(self): | |
self.failUnless(False) | |
def main(): | |
unittest.main() |
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
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import unittest | |
class simpleTest(unittest.TestCase): | |
def setUp(self): | |
pass | |
def tearDown(self): |
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
from openpyxl.workbook import Workbook | |
from openpyxl.writer.excel import ExcelWriter | |
from openpyxl.cell import get_column_letter | |
class XlsLogger(object): | |
""" | |
Save something to a Excel spreadsheet | |
""" | |
def __init__(self): |
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 time | |
start = time.time() | |
end = time.time() | |
elapsed = end - start | |
print "Time taken: ", elapsed, "seconds." |
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
%matplotlib inline | |
import numpy as np | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
import seaborn as sns |
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
from nose.tools import * | |
def test_ |
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 tensorflow as tf | |
sess = tf.Session() | |
writer = tf.summary.FileWriter('./my_graph', sess.graph) |
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 datetime | |
def date_range(start_date, end_date): | |
start = datetime.datetime.strptime(start_date, "%Y-%m-%d") | |
end = datetime.datetime.strptime(end_date, "%Y-%m-%d") | |
return [start + datetime.timedelta(days=x) for x in range(0, (end-start).days)] |
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
from collections import namedtuple | |
Animal = namedtuple('Animal', 'name age type') | |
big_yellow = Animal(name="big_yellow", age=3, type="dog") |