Skip to content

Instantly share code, notes, and snippets.

foo.split("").reverse().join("").split(/:(?!([\\]))/).map(function(_){if (_) {return _.split("").reverse().join("")} else {return _ }}).reverse().filter(function(_) {return (_)})
============================= test session starts ==============================
platform linux2 -- Python 2.7.6 -- pytest-2.4.2
plugins: cov, xdist
collected 788 items / 1 errors / 2 skipped
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/utils_test.py ...
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_likelihood_jeff_test.py ...ss..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_likelihood_test.py .............
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_test.py ............
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/cells4_test.py
@oxtopus
oxtopus / README.md
Last active August 29, 2015 14:21
issue #2115
$ pip install --upgrade pip --user
You are using pip version 6.1.1, however version 7.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/Users/amarshall/Library/Python/2.7/lib/python/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting pip
Downloading pip-7.0.1-py2.py3-none-any.whl (1.1MB)
100% |████████████████████████████████| 1.1MB 160kB/s
Installing collected packages: pip
Found existing installation: pip 6.1.1
core@core-01 ~ $ docker run \
> --name nupic-mysql \
> -e MYSQL_ROOT_PASSWORD=nupic \
> -p 3306:3306 \
> -d \
> mysql:5.6
Unable to find image 'mysql:5.6' locally
5.6: Pulling from mysql
9d3ceacde91b: Pull complete
@oxtopus
oxtopus / gist:1227445
Created September 19, 2011 20:04
lambda : list :: % : str
>>> (lambda s: ['a', s, 'c'])('b')
['a', 'b', 'c']
>>> 'a %s c' % 'b'
'a b c'
@oxtopus
oxtopus / gist:1242678
Created September 26, 2011 16:38
map(itemgetter(n), iterable) == [i[n] for i in iterable]
>>> from operator import itemgetter
>>> iterable=[('foo', 'bar', 'baz'), ('apple', 'banana', 'orange')]
>>> [i[1] for i in foo]
['bar', 'banana']
>>> map(itemgetter(1),foo)
['bar', 'banana']
@oxtopus
oxtopus / gist:2476625
Created April 24, 2012 05:10
dictify/tuplify
>>> dictify = lambda t:dict(zip(*[iter(t)]*2))
>>> dictify(('a', 'A', 'c', 'C', 'b', 'B'))
{'a': 'A', 'c': 'C', 'b': 'B'}
>>>
>>> tuplify = lambda d:tuple(chain(*d.iteritems()))
>>> tuplify({'a': 'A', 'c': 'C', 'b': 'B'})
('a', 'A', 'c', 'C', 'b', 'B')
>>>
>>> assert (lambda d:dictify(tuplify(d))==d)({'a': 'A', 'c': 'C', 'b': 'B'})
>>> assert (lambda t:tuplify(dictify(t))==t)(('a', 'A', 'c', 'C', 'b', 'B'))
@oxtopus
oxtopus / webapp.py
Created March 17, 2013 19:18
Quick hack to define web.py routes and handlers via decorators.
import types
import web
urls = []
def GET(route):
def decorate(fn):
clsName = '%s_%s' % (fn.__name__, 'GET')
from nupic.frameworks.opf.clamodel import CLAModel
params = \
{'clParams': {'alpha': 0.0001,
'clVerbosity': 0,
'regionName': 'CLAClassifierRegion',
'steps': '1,5'},
'inferenceType': 'TemporalMultiStep',
'sensorParams': {'encoders': {'consumption': {'clipInput': True,
'fieldname': u'consumption',
'n': 100,