Skip to content

Instantly share code, notes, and snippets.

1:
2: // includes from the plugin
3: // [[Rcpp::plugins(cpp14)]]
4:
5: // user includes
6: #define STAN__SERVICES__COMMAND_HPP// Code generated by Stan version 2.19.1
7:
8: #include <stan/model/model_header.hpp>
9:
10: namespace model3bf038e124f5_att_model1_namespace {
@knkumar
knkumar / timing.srt
Created December 1, 2012 13:57
Timing through subtitles
1
00:00:0,000 --> 00:00:0,099
1
2
00:00:1,000 --> 00:00:1,099
2
3
00:00:2,000 --> 00:00:2,099
@knkumar
knkumar / gist:3022633
Created June 30, 2012 06:24
matlab profiler example
function foo
profile on
% ---
% code to profile
% ---
stats = profile('info');
%save the statistics data for future use
save('run_stats','stats');
% save the html report generated - saves as a folder
profsave(stats,'run_stats');
@knkumar
knkumar / xml_parse.js
Created June 29, 2012 05:55
javascript iterate nodeList XML
var doc = xhreq.responseText;
var parser = new DOMParser();
var link = parser.parseFromString(doc, 'text/xml');
var items = link.documentElement.childNodes;
for (var item in items) {
if(item.nodeName == 'link'){
for(var attr in item.attributes.name) {
if(item.attr.name == 'rel'){
//do something awesome
return;
@knkumar
knkumar / tf_idf_final.py
Created June 26, 2012 18:21 — forked from anhpt379/tf_idf_final.py
tf-idf example
#-*- coding: utf-8 -*-
import re
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk import bigrams, trigrams
import math
stopwords = nltk.corpus.stopwords.words('portuguese')
@knkumar
knkumar / gist:2981717
Created June 24, 2012 05:06
oauth2 not happening
//in popup.js
var google = new OAuth2('google', {
client_id: '17755888930840',
client_secret: 'b4a5741bd3d6de6ac591c7b0e279c9f',
api_scope: 'https://www.googleapis.com/auth/tasks'
});
function authorize() {
google.authorize(checkAuthorized);
@knkumar
knkumar / loadtimes
Created May 17, 2012 20:08 — forked from sajith/loadtimes.m
silly function to show load times of .mat files under a directory
function loadtimes ( dirname )
if isempty ( dirname ), return, end
x = '$(NF)","$5';
cmd = sprintf ( 'find %s -iname *.mat | xargs -I {} sh -c "ls -lh {}" | awk ''{print $NF","$5}'' > loadtimes.csv', dirname );
system ( cmd );
fhandle = fopen('loadtimes.csv','rt');
csv_cell = textscan(fhandle,'%s %s','Delimiter',',');