Skip to content

Instantly share code, notes, and snippets.

View fayimora's full-sized avatar
🕺

Fayi FB fayimora

🕺
  • London, England
View GitHub Profile
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
/* global google */
var GoogleMapComponent = Ember.Component.extend({
places: [],
width: 500,
height: 500,
attributeBindings: ['style'],
style: function () {
return 'width:'+this.width+'px; height:'+this.height+'px';
.hll { background-color: #ffffcc }
.c { color: #586E75 } /* Comment */
.err { color: #93A1A1 } /* Error */
.g { color: #93A1A1 } /* Generic */
.k { color: #859900 } /* Keyword */
.l { color: #93A1A1 } /* Literal */
.n { color: #93A1A1 } /* Name */
.o { color: #859900 } /* Operator */
.x { color: #CB4B16 } /* Other */
.p { color: #93A1A1 } /* Punctuation */
/**
The MIT License (MIT)
Copyright (c) 2013 Jean Helou
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
import pandas as pd
from ggplot import *
from sklearn.datasets import fetch_20newsgroups
from sklearn.metrics import roc_curve
# vectorizer
from sklearn.feature_extraction.text import HashingVectorizer
# our classifiers
from sklearn.naive_bayes import BernoulliNB, MultinomialNB
@fayimora
fayimora / HMM.jl
Last active August 29, 2015 14:12 — forked from sbos/HMM.jl
module HMM
using Distributions
import Distributions.rand
import Distributions.fit
immutable HiddenMarkovModel{TP, K}
theta::Vector{TP}
A::Matrix{Float64}
def stochastic_linear_gradient_descent(X, y, theta, alpha, tolerance):
converged = False
prev_cost = 0
n_samples = X.shape[0]
while not converged:
# use xrange so you dont have to generate the entire range of numbers
for i in xrange(n_samples):
# you have to sample x and y together
# FYI, using one example at a time can be super slow.
# you might want to consider using batches which should converge quicker
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
{
import javax.sound.midi._
val synth = MidiSystem.getSynthesizer()
synth.open()
def note(i: Int) = {
val channels = synth.getChannels()
channels(0).noteOn(i, 100)
Thread.sleep(250)
channels(0).noteOff(i)
}
@fayimora
fayimora / android_lexer.rb
Created February 18, 2016 10:54 — forked from maxlinc/android_lexer.rb
Workaround for java vs android in slate
require 'rouge'
module Rouge
module Lexers
class Android < Rouge::Lexers::Java
tag 'android'
end
end
end