This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Max Consecutive Sum</title> | |
</head> | |
<body> | |
Enter some integers: | |
<input type="text" id="txtInput" value="-1 5 6 -2 20 -50 4"></input> | |
<button onClick="btnOnClick();">Calculate</button> | |
<p> | |
Max consecutive sum is: <span id="divResult"></span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codecs | |
import logging | |
import os | |
import os.path as P | |
from gensim.models import FastText | |
from gensim.models.callbacks import CallbackAny2Vec | |
class EpochSaver(CallbackAny2Vec): | |
'''Callback to save model after each epoch and show training parameters ''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS=-ggdb -Wall | |
all: quicksort.out | |
# $< the dependencies | |
# $@ the target | |
quicksort.out: quicksort.o | |
gcc -Wall -ggdb $< -o $@ | |
clean: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Check whether each line contains tab-separated decodable JSON.""" | |
import sys | |
import json | |
import logging | |
logging.basicConfig(level=logging.ERROR) | |
for i, line in enumerate(sys.stdin, 1): | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Check if a file contains a set of chars | |
# | |
import argparse | |
import logging | |
import sys | |
import time | |
import collections | |
import unittest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Adapted from: http://sunilkumarkopparapu.wordpress.com/2012/09/11/using-google-asr/ | |
# | |
LANGUAGE="en-US" | |
echo "1 SoX Sound Exchange -- Convert $1.wav to $1.flacC with 16000" | |
sox $1.wav $1.flac rate 16k | |
echo "2 Submit to Google Voice Recognition $1.flac" | |
wget -q -U "Mozilla/5.0" --no-proxy --post-file $1.flac --header="Content-Type: audio/x-flac; rate=16000" -O $1.ret "http://www.google.com/speech-api/v1/recognize?lang=${LANGUAGE}&client=chromium" | |
echo "3 SED Extract recognized text" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<p>Decimal: <input type="text" id="txtDecimal" value="5"><input type="submit" id="btnGoDecimal" value="Go"></p> | |
<p>Binary (MSB first): <input type="text" id="txtBinary" value="101"><input type="submit" id="btnGoBinary" value="Go"></p> | |
<p> | |
Bit position (LSB is zero): <input type="number" id="numBit" value="0" min="0" max="128"><input type="submit" id="btnGet" value="Get"> | |
<input type="submit" id="btnSet0" value="Set to 0"><input type="submit" id="btnSet1" value="Set to 1"> | |
</p> | |
<p id="pResult"></p> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license | |
//@ sourceMappingURL=jquery-1.10.2.min.map | |
*/ | |
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bfs(root): | |
nodes = [(0,root)] | |
prev_level = 0 | |
while nodes: | |
level, node = nodes.pop(0) | |
if level > prev_level: | |
print node.value, | |
prev_level = level | |
for c in node.children: |
NewerOlder