Skip to content

Instantly share code, notes, and snippets.

View spolu's full-sized avatar

Stanislas Polu spolu

View GitHub Profile
@spolu
spolu / top_mi_female
Created September 22, 2014 21:41
Top hashtags by Mutual Information
TOP MUTUALLY DEPENDENT TERMS
┌───────────────────┬────────────────────────┬─────────────────────┬─────────────────────┬────────────────────────┬────────┐
│feat  │MI │P(F|feat) │P(M|feat)  │P(feat)  │count  │
├───────────────────┼────────────────────────┼─────────────────────┼─────────────────────┼────────────────────────┼────────┤
│ 2013 │ 0.0007369516096940501 │ 0.4390515775552617 │ 0.5609484224447384 │ 0.0007522301748728375 │ 52930 │
├───────────────────┼────────────────────────┼─────────────────────┼─────────────────────┼────────────────────────┼────────┤
│ some │ 0.000736858500749544 │ 0.445240713107673 │ 0.5547592868923271 │ 0.0007238350135390772 │ 50932 │
├───────────────────┼────────────────────────┼─────────────────────┼─────────────────────┼────────────────────────┼────────┤
│ old │ 0.0007365194018360236 │ 0.4566446562018109 │ 0.5433553437981891 │ 0.0007188608861783085
@spolu
spolu / mi.js
Last active August 29, 2015 14:06
/**********************************************************************/
/* count_: the number of occurrences of the feature (n-gram or word) */
/* all_count: training set size */
/* f_count_: the number of occurrences of `feature & female` */
/* m_count_: the number of occurrences of `feature & male` */
/* all_count_f: number of occurrences of `female` */
/* all_count_m: number of occurrences of `male` */
/**********************************************************************/
/* p(feature) */
### Keybase proof
I hereby claim:
* I am spolu on github.
* I am spolu (https://keybase.io/spolu) on keybase.
* I have a public key whose fingerprint is 6DFA 0BAC D550 92AA 07D8 AEC9 907A 38FD AFBB 5163
To claim this, I am signing this object:
TOP:
----
A browser for the HTML5 era
Entirely written in Javascript. Free. Modular. Hackable.
>> Modular <<
Everything in the browser is a module, a web-app running in its own process.
Construct your own browsing experience by selecting the right modules for you.
>> Hackable <<
(function($, cb_) {
var r = {
pay: 0,
insights: 0,
only_one: 0,
total: 0,
morethan5: 0,
betwen2and5: 0
}
@spolu
spolu / gist:6884112
Created October 8, 2013 12:44
Count Just One Insight
(function($, cb_) {
var r = {
pay: 0,
insights: 0,
only_one: 0,
total: 0
}
$.forEach(function(u) {
if(u['Payer ID'].length > 0 && u['Payer ID'].toLowerCase() !== 'free') {
r.pay++;
@spolu
spolu / common.gypi
Created June 21, 2013 09:29
Common gyp Include to embed CEF3
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# IMPORTANT:
# Please don't directly include this file if you are building via gyp_chromium,
# since gyp_chromium is automatically forcing its inclusion.
{
# Variables expected to be overriden on the GYP command line (-D) or by
# ~/.gyp/include.gypi.
@spolu
spolu / gist:5604086
Created May 18, 2013 11:14
vim_scroll.txt
DEBUG: [2013-05-18T11:00:37.805Z] DEBUG: vt#set_cursor_position 0 0
DEBUG: [2013-05-18T11:00:37.806Z] DEBUG: move_to: 0 0 true
DEBUG: [2013-05-18T11:00:37.806Z] DEBUG: \x1b[57;1H
DEBUG: [2013-05-18T11:00:37.806Z] DEBUG: vt#set_cursor_position 0 56
[28834:0518/130037:INFO:CONSOLE(235)] "[2013-05-18T11:00:37.805Z] {set_scroll_region} 0 - 56", source: /home/spolu/src/breach/lib/common.js (235)
DEBUG: [2013-05-18T11:00:37.806Z] DEBUG: move_to: 0 56 true
DEBUG: [2013-05-18T11:00:37.806Z] DEBUG: vt#set_cursor_column 0
DEBUG: [2013-05-18T11:00:37.806Z] DEBUG: move_to: 0 56 true
DEBUG: [2013-05-18T11:00:37.806Z] DEBUG: vt#form_feed
DEBUG: [2013-05-18T11:00:37.806Z] DEBUG: move_to: 0 57 undefined
@spolu
spolu / factory.js
Created November 26, 2012 07:13
Sweet Factory and GrandCentral
var factory = function(spec, my) {
[...]
my.grandcentral = new EventEmitter();
// public
var user; /* user(spec, my); */
// private
var forward; /* forward(obj, type, evt); */
var util = require('util');
var diners = [[[], [], [], []],
[[], [], [], []],
[[], [], [], []],
[[], [], [], []]];
var seen = [];
for(var i = 0; i < 20; i ++)
seen[i] = [];