View admin.py
1 2 3 4 5 6 7 8 9 10
# -*- coding: utf-8 -*-
 
import xlwt
 
from django.contrib import admin
from django.http import HttpResponse
 
from models import (PaymentForm, Order, OrderItem,
Discount, Affiliate)
from forms import DiscountForm
View vm.py
1 2 3 4 5 6 7 8 9 10
class VM(object):
def __init__(self, uuid, name, status):
self.uuid = uuid
self.name = name
self.status = status
 
def __repr__(self):
return '%s - %s (%s)' % (self.uuid, self.name, self.status)
 
def export(self, directory_name=None):
View example.py
1 2 3 4 5 6 7 8 9 10
def can_pipe(command, fastq_file):
'''
bwa-mem handles longer (> 70bp) reads with improved piping.
Randomly samples 5000 reads from the first two million.
Default to no piping if more than 75% of the sampled reads are small.
'''
min_size = 70
thresh = 0.75
head_count = 8000000
tocheck = 5000
View node_digit_dependencies.js
1 2 3 4 5 6 7 8 9 10
var express = require('express')
, routes = require('./routes')
, http = require('http')
, path = require('path')
, fs = require('fs')
, uuid = require('uuid')
, yhat = require('yhat');
var app = express();
var yh = yhat.init("your username", "your apikey");
View digits_deploy.py
1 2 3 4 5 6 7 8 9 10
 
from yhat import BaseModel, Yhat
class DigitModel(BaseModel):
def require(self):
from PIL import Image
from StringIO import StringIO
import base64
View digits_classifier.py
1 2 3 4 5 6 7 8 9 10
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import confusion_matrix
clf = KNeighborsClassifier(n_neighbors=13)
clf.fit(X_train, y_train)
print "done"
print "="*20
print clf
print "Confusion Matrix"
View extract_digit_fetaures.py
1 2 3 4 5 6 7 8 9 10
from sklearn.decomposition import RandomizedPCA
from sklearn.preprocessing import StandardScaler
pca = RandomizedPCA(n_components=10)
std_scaler = StandardScaler()
X_train, X_test, y_train, y_test = train_test_split(data, labels, test_size=0.1)
X_train = pca.fit_transform(X_train)
X_test = pca.transform(X_test)
View get_digits.py
1 2 3 4 5 6 7 8 9 10
import os
from PIL import Image
import numpy as np
files = [f for f in os.listdir("handwriting/numbers/")]
files = ["handwriting/numbers/" + f for f in files]
STANDARD_SIZE = (50, 50)
def get_image_data(filename):
img = Image.open(filename)
View node.js
1 2 3 4 5 6 7 8 9 10
$("#send").click(function(e) {
// convert canvas to data url
var img = canvas.toDataURL();
// make request to server
$.post("/", {img: img, n: n}, function() {
// when request is finished, redirect to homepage
window.location.replace("/");
})
return false;
});
View sequence.pyx
1 2 3 4 5 6 7 8 9
"""
Sequence
--------
String object representing biological sequences with alphabets.
"""
Something went wrong with that request. Please try again.