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
#!/usr/bin/env python3 | |
# | |
# Copyright (c) 2015 Leandro Pereira de Lima e Silva | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
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
# by fcicq <fcicq@fcicq.net>, 2013.4.7, GPLv2 | |
# Tornado 3.0 is required. | |
from tornado.websocket import websocket_connect, WebSocketClientConnection | |
from tornado.ioloop import IOLoop | |
from datetime import timedelta | |
#echo_uri = 'ws://echo.websocket.org' | |
echo_uri = 'ws://ws.blockchain.info/inv' | |
PING_TIMEOUT = 15 | |
class myws(): |
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 web | |
import json | |
urls = ( | |
'/', 'index', | |
'/random', 'random', | |
'/dump', 'dump' | |
) |
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
height = 7 | |
width = 7 | |
board_spaces_occupied = [ | |
[ 1, 0, 1, 1, 1, 0, 0], | |
[ 1, 1, 0, 1, 1, 0, 1], | |
[ 1, 1, 1, 1, 0, 0, 1], | |
[ 1, 0, 1, 0, 1, 1, 1], | |
[ 1, 0, 0, 1, 1, 1, 1], | |
[ 0, 0, 1, 0, 0, 1, 1], | |
[ 0, 1, 1, 0, 1, 1, 1], |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 concurrent.futures | |
import functools | |
import operator | |
import time | |
from pprint import pprint | |
TEXT = """Lorem ipsum dolor sit amet, consectetuer adipiscing elit. | |
Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. | |
Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede. | |
Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris |
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
/* | |
node.js vs Python with Greenlets (say gevent) | |
I don't get why node.js is being so hyped. | |
Sure, the idea of writing things in JavaScript both on the client and server-side is really nice. | |
And JavaScript really fit an event-driven environment with its browser heritage. | |
But why on earth is boomerang code so appealing to write? I don't get. Am I missing something obvious? | |
All examples of node.js I see are littered with callbacks yet Ryan Dahl thinks coroutines suck. It doesn't add up for me. |
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
package web | |
import ( | |
"bytes" | |
"encoding/json" | |
"io" | |
"net/http" | |
) | |
type errorResponse struct { |
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 tensorflow as tf | |
import numpy as np | |
NUM_STATES = 10 | |
NUM_ACTIONS = 2 | |
GAMMA = 0.5 | |
def hot_one_state(index): | |
array = np.zeros(NUM_STATES) |
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 json | |
import hashlib | |
from flask import Flask, request | |
import flask.ext.sqlalchemy | |
import flask.ext.cache | |
import flask.ext.restless | |
from flask.ext.restless import ProcessingException | |
app = Flask(__name__) | |
app.config['DEBUG'] = True |
OlderNewer