Skip to content

Instantly share code, notes, and snippets.

View vgoklani's full-sized avatar

Vishal Goklani vgoklani

View GitHub Profile

The INSTALL instructions that come with Vowpal Wabbit appear not to work on Mac OS X Lion. Here's what I did to get it to compile. You will need the developer tools that come with the XCode installation.

The only dependency VW has is the boost C++ library. So first, download and install Boost

To install Boost, do the following:

$ cp ~/Downloads/boost_1_48_0.tar.bz2 ./
#!/bin/bash
# Requires vw (https://github.com/JohnLangford/vowpal_wabbit/wiki/) and
# the IMDB dataset (http://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz)
cat aclImdb/train/labeledBow.feat | \
sed -n 's/^\([7-9]\|10\)\s/&/p' | \
sed -e "s/^\([7-9]\|10\)\s//" | \
awk '{ print "1 '"'"'pos_" (NR-1) " |features " $0}' > train.vw
cat aclImdb/train/labeledBow.feat | \
#!/usr/bin/env python
import sys
Dict = []
with open('aclImdb/imdb.vocab','r') as f:
for line in f:
Dict.append(line.strip())
with open('audit.log','r') as f:
f.readline()
@vgoklani
vgoklani / app.py
Last active December 19, 2022 09:13
Using Flask to output Python data to High Charts
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350):
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,}
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}]
title = {"text": 'My Title'}
[program:mongodb]
directory=/home/username/webapps/appname
command=/home/username/webapps/mongodb-appname/mongodb-linux-i686-2.0.1/bin/mongod --dbpath /home/username/webapps/mongodb-appname/data --logpath /home/username/webapps/mongodb-appname/log/corsdb.log --logappend --port 34006
#!/usr/bin/env python
### Requires latest boto (cuz I checked in code to boto a moment ago)
import uuid
from boto.mturk.connection import MTurkConnection
from boto.mturk.question import Question, QuestionForm, QuestionContent
from boto.mturk.question import AnswerSpecification, FreeTextAnswer
from boto.mturk.question import Overview
#from boto.mturk.qualification import Qualifications # these exist!
<html>
<head>
<title>Line Graph with Dual-scaled Axes using SVG and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke-width: 1;
fill: none;
}
# Copyright 2011 10gen
#
# Modified by Antonin Amand <[email protected]> to work with gevent.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@vgoklani
vgoklani / checkbox.js
Created June 24, 2013 14:31
Javascript checkbox notes
// http://stackoverflow.com/questions/10436764/how-to-set-default-checkbox-status-with-javascript
// javascript to check if checkbox is checked / unchecked
// To change checkbox state try this:
document.getElementById("RememberMe").checked = true;
// If you need to change the value of checkbox as an input element use:
document.getElementById("RememberMe").value = "New Value";
// However, you can set default value and state in HTML markup: