Skip to content

Instantly share code, notes, and snippets.

@jeevanel
jeevanel / terminal_progressbar.py
Created July 29, 2015 13:12
A python terminal progress bar which can updated as we process something
import sys
class TerminalProgressBar:
def __init__(self,final_value,bar_length=50):
self.length = bar_length
self.final_value = final_value
def update(self,current_value):
@jeevanel
jeevanel / load_files.py
Last active August 29, 2015 14:26
Modified version of sklearn load_files to accept additional parameter 'ignore_list' which accepts list of file names to be omitted from loading. This is useful especially on OS X and POSIX machine where files beginning with '.' For instance on OS X load_files would load even '.DS_Store' file which is not desirable
from os.path import dirname
from os.path import join
from os.path import exists
from os.path import expanduser
from os.path import isdir
from os import listdir
from os import makedirs
from sklearn.datasets.base import Bunch
from sklearn.utils import check_random_state
@jeevanel
jeevanel / xml_parse.js
Created June 29, 2012 07:26 — forked from knkumar/xml_parse.js
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 index=0;index <items.length; index++) {
if(items[index].nodeName == 'link'){
for(var attrIndex=0; attrIndex < items[index].attributes.length; attrIndex++) {
if(items[index].attributes[attrIndex].nodeName == 'rel'){
//do something awesome
alert("found one link with rel attribute");
@jeevanel
jeevanel / xml_parse.js
Created June 29, 2012 07:25 — forked from knkumar/xml_parse.js
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;