Skip to content

Instantly share code, notes, and snippets.

View kirankumaramruthaluri's full-sized avatar

Kiran kirankumaramruthaluri

  • Hyderabad
  • India
  • 13:48 (UTC +05:30)
View GitHub Profile
@kirankumaramruthaluri
kirankumaramruthaluri / Regex for Special Characters
Created March 10, 2016 12:25
Regular Expression used for finding / replacing special characters for the input
// Regular Expression of Special Characters
isSpecialCharRegex = /[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi;
@kirankumaramruthaluri
kirankumaramruthaluri / Bresenham's Line Drawing Algorithm
Created February 22, 2015 10:15
Bresenham's Line Drawing Algorithm
function bline(x0, y0, x1, y1) {
var dx = Math.abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
var dy = Math.abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
var err = (dx>dy ? dx : -dy)/2;
while (true) {
setPixel(x0,y0);
if (x0 === x1 && y0 === y1) break;
var e2 = err;
@kirankumaramruthaluri
kirankumaramruthaluri / linearSearch.py
Last active January 25, 2017 20:57
Linear search implementation - Python
#!/usr/bin/python
#=======================================================================
# Author: Amruthaluri Kiran Kumar ([email protected])
# Title: Linear Search implementation
#=======================================================================
def linearSearch(list, item):
for j in list:
if item == j:
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
@kirankumaramruthaluri
kirankumaramruthaluri / micaudio.js
Created December 8, 2013 18:41
Microphone Input Web Audio
window.AudioContext = window.AudioContext ||
window.webkitAudioContext;
var context = new AudioContext();
navigator.getUserMedia({audio: true}, function(stream) {
var microphone = context.createMediaStreamSource(stream);
var filter = context.createBiquadFilter();
// microphone -> filter -> destination.
function onVideoFail(e) {
console.log('webcam fail!', e);
};
function hasGetUserMedia() {
// Note: Opera is unprefixed.
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia || navigator.msGetUserMedia);
}
@kirankumaramruthaluri
kirankumaramruthaluri / video-node.js
Created December 6, 2013 17:16
HTML5 VIdeo Streaming via Node
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
var stat = fs.statSync(path);
var total = stat.size;
if (req.headers['range']) {
var range = req.headers.range;
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@kirankumaramruthaluri
kirankumaramruthaluri / index.html
Created November 20, 2013 19:51
HTML5 Blob Data Script
<!DOCTYPE html>
<html>
<head><title>BASE 64 Data</title></head>
<body>
<canvas width="500" height="200"></canvas>
<script>
window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder ||
window.MozBlobBuilder || window.MSBlobBuilder;
window.URL = window.URL || window.webkitURL;
window.onload = function(){
<!DOCTYPE html>
<html>
<head>
<title>D3 Symbols</title>
</head>
<body>
<div id="wrapper">
</div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script>