Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

"""
Examples:
>>> a = lock_array(np.zeros((5, 5))) # locked array
>>> b = np.zeros((5, 5)) # default array
# >>> a[:, 3] = 1. # You can't update locked arrays
>>> b[:, 3] = 1.
>>> with unlocked(a, b):
def format(st, *args, **kwds):
""" Format with string interpolation
String interpolation for python version < 3.6
See also
- https://www.python.org/dev/peps/pep-0498/
- http://stackoverflow.com/questions/6618795/get-locals-from-calling-namespace-in-python
"""
>>> a = 1
>>> b = 2
@m1m0r1
m1m0r1 / tweetclass.py
Created July 25, 2011 20:48
Text classification using Twitter, MeCab, TokyoCabinet and nltk.
#!/usr/bin/env python2.6
# coding: utf-8
# Twitter
import twitter
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN_KEY = ''
ACCESS_TOKEN_SECRET = ''
@m1m0r1
m1m0r1 / deferred-hack.html
Created November 30, 2010 15:31
a hack in jsdeferred and some tests.
<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>jsDeferred</title>
<script type="text/javascript" src="/js/lib/jsdeferred.js"></script>
<script type="text/javascript">
/*
Some tests of deferred using jsdeferred ver 0.3.4. (http://github.com/cho45/jsdeferred)