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
""" | |
Simple worker showing different worker ids sharing/incrementing the same memory region | |
uwsgi --http :9090 --wsgi-file foobar.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191 --sharedarea 2 | |
Then just keep refreshing localhost:9090 | |
""" | |
import uwsgi | |
INT_ORDS = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57} |
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 flask import Flask, jsonify | |
from flask_sqlalchemy import SQLAlchemy | |
app = Flask(__name__) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://test@localhost/test' | |
db = SQLAlchemy(app) | |
db.init_app(app) | |
class User(db.Model): |
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
# -*- coding: utf-8 -*- | |
""" | |
markov_generator_pipeline | |
~~~~~~~~~~~~~~~~~~~~~~~~~ | |
An example markov generator that reads corpus one line at a time | |
and uses numpy for storing / drawing word likelihoods | |
Example source text: | |
http://www.gutenberg.org/cache/epub/28339/pg28339.txt |
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
import random | |
GEORGI_TEXT = """ | |
GEORGI IS HERE!!!! | |
Maybe you should [C]all for help. | |
""" | |
class Scene(object): |
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 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
create materialized view ladder as ( | |
with | |
match_points as ( | |
select | |
case ... end as aff_points, | |
case ... end as neg_points, | |
aff_id, | |
neg_id | |
), |
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 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
""" | |
Demo of using Hogwild algorthim for parallel learning with shared memory | |
Uses sklearn's LogisticRegression for accuracy comparison | |
Output | |
('initial accuracy:', 0.45333333333333331) | |
worker 25974 score 0.93 | |
worker 25975 score 0.92 | |
worker 25976 score 0.88 | |
worker 25974 score 0.94 |
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
""" | |
Implementation of the example from https://inst.eecs.berkeley.edu/~cs61c/fa14/projs/02/ | |
""" | |
import operator | |
class Puzzle(object): | |
"""General game representation""" | |
def solution(self): | |
return Position(0) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer