Skip to content

Instantly share code, notes, and snippets.

View clarle's full-sized avatar

Clarence Leung clarle

  • Netflix
  • Los Gatos, CA
  • 19:46 (UTC -07:00)
  • X @clarler
View GitHub Profile
@clarle
clarle / Standa.cpp
Created May 9, 2013 14:39
Standa device adapter for Micro-Manager
///////////////////////////////////////////////////////////////////////////////
// FILE: Standa.cpp
// PROJECT: Micro-Manager
// SUBSYSTEM: DeviceAdapters
//-----------------------------------------------------------------------------
// DESCRIPTION: Standa device adapters: 8SMC1-USBhF Microstep Driver
//
// COPYRIGHT: Leslie Lab, McGill University, Montreal, 2013
//
// LICENSE: This file is distributed under the BSD license.
@clarle
clarle / MMCore.h
Created January 28, 2013 15:57
Micro-Manager Core header file - rights belong to associated authors
///////////////////////////////////////////////////////////////////////////////
// FILE: MMCore.h
// PROJECT: Micro-Manager
// SUBSYSTEM: MMCore
//-----------------------------------------------------------------------------
// DESCRIPTION: The interface to the MM core services.
//
// COPYRIGHT: University of California, San Francisco, 2006,
// 100X Imaging Inc, www.100ximaging.com, 2008
// All Rights reserved
@clarle
clarle / manage.py
Created November 29, 2012 03:29
Compiler/Runner for COMP 512
import os
from time import sleep
from optparse import OptionParser
# Remember to add the trailing slash!
SERVER_FOLDER = "/home/2010/cleung24/comp512/a3/servercode/"
CLIENT_FOLDER = "/home/2010/cleung24/comp512/a3/clientsrc/"
MIDDLEWARE_PORT = 5678
@clarle
clarle / consensus.py
Created November 27, 2012 14:18
Algorithm to find a target consensus motif in FASTA sequences
import re
import operator
from math import sqrt
from itertools import product
ALPHABET = ["A", "C", "G", "T", "[AC]", "[AG]",
"[AT]", "[CG]", "[CT]", "[GT]", "[ACGT]"]
NUC_PROBS = {
"A": 0.25,
@clarle
clarle / nj.r
Last active October 12, 2015 05:58
Neighbor joining script
library(ape)
m = c(0, 13, 8, 20, 21, 13, 0, 9, 16, 17, 8, 9, 0, 15, 16, 20, 16, 15, 0, 13, 21, 17, 16, 13, 0)
dim(m) = c(5, 5)
colnames(m) = c('A', 'B', 'C', 'D', 'E')
rownames(m) = colnames(m)
d = as.dist(m)
tr = nj(d)
plot(tr, cex=2, tip.color=rainbow(6))
axisPhylo()
@clarle
clarle / NI100X.cpp
Created October 12, 2012 14:59
NI100X adapter example extension (Analog Input only)
///////////////////////////////////////////////////////////////////////////////
// FILE: NI100X.cpp
// PROJECT: 100X micro-manager extensions
// SUBSYSTEM: DeviceAdapters
//-----------------------------------------------------------------------------
// DESCRIPTION: NI control with multiple devices
//
// AUTHOR: Nenad Amodaj, January 2010
//
// COPYRIGHT: 100X Imaging Inc, 2010
@clarle
clarle / forget-the-past.tex
Created October 9, 2012 13:36
LinearSpaceAlignment pseudocode
\begin{algorithm}
\caption{Calculates the optimal alignment using ForgetThePast-NW}
\begin{algorithmic}
\Procedure{LinearSpaceAlignment}{$S$, $T$}
\State m = \textbf{length}(S)
\State n = \textbf{length}(T)
\If {$m <= 1$ \textbf{or} $n <= 1$}
\State \textbf{return} NW(S, T) \Comment Use the regular NW algorithm
\Else \Comment Divide and conquer with recursion
\State Middle = \textbf{round}(m/2)
@clarle
clarle / app.coffee
Created September 20, 2012 16:18
YUI TodoMVC and CoffeeScript???
YUI.add "todo-app", ((Y) ->
"use strict"
# Dependencies from MVC namespace.
TodoList = Y.TodoMVC.TodoList
TodoView = Y.TodoMVC.TodoView
TodoApp = undefined
# -- Main Application --------------
TodoApp = Y.Base.create("todoApp", Y.App, [],
@clarle
clarle / js-frameworks.md
Created August 19, 2012 16:54
Mojito/Derby/Meteor comparison (Public WIP)

Next-generation JavaScript frameworks

Web application frameworks have been developing fast in the past few years, and as the technologies that they're built on top of get more advanced, each of these frameworks is able to provide newer features to help developers build more complex applications. This year, we've seen the release of a new class of application frameworks that takes advantage of JavaScript's ability to be both on the client and the server. What this allows these frameworks to do is provide both a new level of abstraction by sharing code between client and server, as well as embrace the benefits of both client-side rendering and server-side rendering.

For the end user, they get smooth, desktop-like responsiveness from client-side rendering, while still being able to maintain the SEO and accessbility benefits of server-side rendering. For developers, that means writing less boilerplate code, and being able to focus more on writing the application logic.

Today, there are three main framew

@clarle
clarle / index.html
Created August 15, 2012 00:47
Y.Cache as a quick in-memory database
<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#user-submit').click(function () {
var payload = {
name: $('#user-name').val(),
msg: $('#user-msg').val()