Skip to content

Instantly share code, notes, and snippets.

Marcel marcelcaraciolo

View GitHub Profile
marcelcaraciolo /
Created Feb 25, 2015
Simple admin example
# -*- 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
class VM(object):
def __init__(self, uuid, name, status):
self.uuid = uuid = name
self.status = status
def __repr__(self):
return '%s - %s (%s)' % (self.uuid,, self.status)
def export(self, directory_name=None):
marcelcaraciolo /
Last active Aug 29, 2015
example command
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
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");
from yhat import BaseModel, Yhat
class DigitModel(BaseModel):
def require(self):
from PIL import Image
from StringIO import StringIO
import base64
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import confusion_matrix
clf = KNeighborsClassifier(n_neighbors=13), y_train)
print "done"
print "="*20
print clf
print "Confusion Matrix"
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)
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 =
View node.js
$("#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
return false;
marcelcaraciolo / sequence.pyx
Created Apr 25, 2014
Sequence example file
View sequence.pyx
String object representing biological sequences with alphabets.
You can’t perform that action at this time.