This file contains hidden or 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
Traceback (most recent call last): | |
File "/u/wardefar/miniconda/lib/python3.4/site-packages/IPython/core/history.py", line 85, in catch_corrupt_db | |
return f(self, *a, **kw) | |
File "/u/wardefar/miniconda/lib/python3.4/site-packages/IPython/core/history.py", line 227, in init_db | |
end timestamp, num_cmds integer, remark text)""") | |
sqlite3.OperationalError: disk I/O error | |
During handling of the above exception, another exception occurred: | |
Traceback (most recent call last): |
This file contains hidden or 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
\documentclass[12pt]{article} | |
\usepackage{amsmath} | |
\begin{document} | |
\begin{eqnarray*} | |
CE(a, t) & = & -t\log\left(\sigma(a)\right) - (1 - t)\log\left(1 - \sigma(a)\right) \\ | |
& = & -t \log \left(\frac{1}{1 + \exp(a)}\right) - (1 - t)\log\left(1 - \frac{1}{1 + \exp(a)}\right) \\ | |
& = & -t \log \left(\frac{1}{1 + \exp(a)}\right) - (1 - t)\log\left(\frac{\exp(a)}{1 + \exp(a)}\right) \\ | |
& = & t \log \left(1 + \exp(a)\right) - \left[(1 - t)\log(\exp(a)) - \log(1 + \exp(a))\right] \\ | |
&= & t \log \left(1 + \exp(a)\right) - (1 - t)\log(\exp(a)) + (1 - t)\log(1 + \exp(a)) \\ |
This file contains hidden or 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
"""A reverse Polish notation calculator. Supports float and int literals.""" | |
from __future__ import print_function | |
import operator | |
import sys | |
OPERATORS = {'+': operator.add, '-': operator.sub, '%': operator.mod, '/': | |
operator.truediv, '//': operator.floordiv, '*': operator.mul, | |
'**': operator.pow} | |
This file contains hidden or 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 functools | |
class partial_last(functools.partial): | |
"""Like functools.partial, but fill positionals from the end. | |
Useful for builtin C functions where you *can't* pass later args as | |
keywords because CPython is stupid about that. | |
Examples | |
-------- |
This file contains hidden or 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 io | |
from blocks.bricks import Rectifier, MLP, Sequence, Logistic | |
from blocks.select import Selector | |
from theano import tensor | |
from theano.printing import debugprint | |
def wtf(call_b): | |
sub_mlp = MLP([Rectifier(), Rectifier()], [5, 4, 3]) | |
a = Sequence([sub_mlp.apply, Logistic().apply]) |
This file contains hidden or 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
"""Very simple PUSH-PULL reusable producer-consumer with ZeroMQ.""" | |
# By David Warde-Farley. Released under the 3-clause BSD license. | |
import time | |
from multiprocessing import Process | |
import zmq | |
def _producer_wrapper(f, port, addr='tcp://127.0.0.1'): |
This file contains hidden or 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
class MobileShellMousefix < Formula | |
homepage "http://mosh.mit.edu/" | |
revision 2 | |
head do | |
url "https://github.com/lpkruger/mosh.git", :revision => "d5f75ec54a" | |
depends_on "autoconf" => :build | |
depends_on "automake" => :build | |
end |
This file contains hidden or 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
# Copyright (c) 2015 David Warde-Farley. | |
# | |
# Permission is granted to use this code under the MIT license: | |
# http://opensource.org/licenses/mit-license.php | |
import logging | |
import progressbar | |
import time | |
This file contains hidden or 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
try: | |
from queue import Queue, Empty | |
except ImportError: | |
from Queue import Queue, Empty | |
import threading | |
import numpy | |
from numpy.lib.format import read_magic, read_array_header_1_0 | |
class BufferedChunkedNPY(object): |
This file contains hidden or 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 functools import wraps | |
import sys | |
# Goddamnit Python 2/3 differences. | |
str_type = str if sys.version_info[0] >= '3' else basestring | |
def filename_or_file_like(mode): | |
"""Decorator that checks if the first argument to a function is |