Skip to content

Instantly share code, notes, and snippets.

View du2x's full-sized avatar

Eduardo Monteiro du2x

View GitHub Profile
@du2x
du2x / consumeRawBSON.py
Last active February 18, 2016 19:21
Consume Mongo BSON File
import bson
bs = open('filename.bson').read()
b = bson.BSON(bs)
for line in bson.decode_all(b):
# do stuff
#del(line['_id'])
def count_words(s, n):
"""Return the n most frequently occuring words in s ordered by number
of ocurrences and alfabetically."""
ws = {}
for w in s.split():
if w in ws.keys():
ws[w]+=1
else:
ws[w]=1
@du2x
du2x / js2table.js
Created April 18, 2017 14:53
Javascript list to html table
// see http://stackoverflow.com/questions/5180382/convert-json-data-to-a-html-table
// Builds the HTML Table out of myList.
function buildHtmlTable(myList) {
var res = '<table>';
var columns = [];
var headerTr$ = $('<tr/>');
for (var i = 0; i < myList.length; i++) {
var rowHash = myList[i];
@du2x
du2x / js2table.ts
Created April 19, 2017 01:43
typescript list (or a parsed JSON) to html table
// see http://stackoverflow.com/questions/5180382/convert-json-data-to-a-html-table
// Builds the HTML Table out of myList.
export function buildHtmlTable(myList:any[]) {
let columns:string[];
columns=[];
let res = '<table class="table">';
let headerTr = '';
for (var i = 0; i < myList.length; i++) {
var rowHash = myList[i];
@du2x
du2x / capstone-data.ipynb
Created January 27, 2020 12:46
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@du2x
du2x / capstone-final.ipynb
Created January 27, 2020 22:55
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@du2x
du2x / capstone-final.ipynb
Created January 28, 2020 01:33
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@du2x
du2x / capstone-final.ipynb
Created January 28, 2020 01:36
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@du2x
du2x / capstone-final.ipynb
Created January 28, 2020 01:36
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@du2x
du2x / capstone-notebook.ipynb
Created January 28, 2020 01:38
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.