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
[{"start_time":1397201400,"end_time":1397206800,"title":"Breakfast"},{"start_time":1397206800,"end_time":1397208600,"title":"Opening Statements: Diana Clarke"},{"start_time":1397208600,"end_time":1397211000,"title":"Keynote: John Perry Barlow"},{"start_time":1397211000,"end_time":1397213400,"title":"Break"},{"description":"Why are Python programmers crazy about lists and dictionaries, when\r\nother languages tout bitmaps, linked lists, and B+\u00c2\u00a0trees? Are we missing\r\nout? Come learn how data structures are implemented on bare metal, how\r\nto select the right data structure, how the list and dictionary cover a\r\nwide swath of use cases, and when to dip into the Standard Library or a\r\nthird-party package for an alternative.","title":"All Your Ducks In A Row: Data Structures in the Standard Library and Beyond","track":1,"start_time":1397213400,"speaker":"Brandon Rhodes","end_time":1397215800,"link":"https:\/\/us.pycon.org\/\/2014\/schedule\/presentation\/211\/"},{"description":"Many developers, in |
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 functools import total_ordering | |
@total_ordering | |
class SuperNone(object): | |
# general properties / methods | |
def __getattr__(self, *args, **kwargs): | |
return self | |
def __call__(self, *args, **kwargs): | |
return self | |
def __setattr__(self, *args, **kwargs): |
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
# Why does this work | |
def split_chars(words, chars): | |
itr = (words,) | |
for c in chars: | |
itr = tuple(chunk for word in itr for chunk in word.split(c)) | |
return list(itr) | |
# but this not work | |
def split_chars_broken(words, chars): | |
itr = (words,) |
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
[ | |
{ | |
"name": "Lower East Side", | |
"center": [ | |
-73.9836180698, | |
40.7155233255 | |
] | |
}, | |
{ | |
"name": "Marble Hill", |
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
$ # Fails on port 80 | |
$ curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: XXX.fastforwardlabs.com" -H "Origin: http://XXX.fastforwardlabs.com" http://XXX.fastforwardlabs.com/XXXX | |
HTTP/1.1 400 Bad Request | |
Server: nginx/1.4.6 (Ubuntu) | |
Date: Mon, 20 Oct 2014 23:22:48 GMT | |
Content-Type: text/html; charset=UTF-8 | |
Content-Length: 34 | |
Can "Upgrade" only to "WebSocket". |
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 python2.7 | |
""" | |
>>> import multigram_search | |
>>> mgs = multigram_search.MultigramSearch([("a", "b", "c"), ("o", "c", "z"), | |
('z','y')]) | |
>>> list(mgs.intersection("hello world you a b c foo".split(" "))) | |
[['a', 'b', '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
#include <stdio.h> | |
#include <functional> | |
double any_op(double, double, std::function<double(double,double)>); | |
int main() | |
{ | |
std::function<double(double,double)> add = [](double a, double b) -> double { return a+b; }; | |
std::function<double(double,double)> sub = [](double a, double b) -> double { return a-b; }; |
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 [21]: a = np.zeros( (20) ) | |
In [22]: b = np.asarray( [2, 5, 7, 15] ) | |
In [23]: a | |
Out[23]: | |
array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., | |
0., 0., 0., 0., 0., 0., 0.]) | |
In [24]: a[b] = 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
$ # First we set the correct python path and compilation flags | |
$ export vi_cv_path_python_plibs="-L/bitly/local/lib/python2.7/config/ -lpython2.7 -lpthread -lutil -Xlinker -export-dynamic" | |
$ # Configure will all the options we love the most | |
$ ./configure --with-features=huge --enable-pythoninterp --with-python-config-dir=/bitly/local/lib/python2.7/config/ | |
$ # Make & install | |
$ make -j & sudo make install |
OlderNewer