Skip to content

Instantly share code, notes, and snippets.

View frnsys's full-sized avatar
🏠
Working from home

Francis Tseng frnsys

🏠
Working from home
View GitHub Profile
@frnsys
frnsys / optics.py
Last active August 18, 2017 07:33 — forked from ryangomba/optics.py
OPTICS clustering in Python
# Copyright (c) 2012, Ryan Gomba
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
@frnsys
frnsys / train_doc2vec.py
Last active August 29, 2015 14:25
train and infer with doc2vec
import sys
import logging
import numpy
import gensim
logging.basicConfig(level=logging.INFO)
train_sentences = gensim.models.doc2vec.LabeledLineSentence(sys.argv[1])
model = gensim.models.Doc2Vec(train_sentences, size=400, window=8, min_count=2,
# Adapted from
# http://pytables.github.io/usersguide/libref/homogenous_storage.html#the-carray-class
import os
import numpy
import tables
from itertools import groupby
from operator import itemgetter
from time import time
@frnsys
frnsys / tmux.md
Created January 29, 2014 06:10 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@frnsys
frnsys / (client)controller.js
Created July 28, 2012 00:38 — forked from tresbailey/(client)controller.js
Chat App using nodejs for server, socket.io for passing messages to/from the browser, coffeescript for some server-side files (for now), node-redis for persisting chats, express(node) for http wrapping, and jade for templating (for now), and backbone for
var NodeChatController = {
init: function() {
this.socket = io.connect('http://localhost');
var mysocket = this.socket;
this.model = new models.NodeChatModel();
this.view = new NodeChatView({model: this.model, socket: this.socket, el: $('#content')});
var view = this.view;
this.socket.on('message', function(msg) {