Skip to content

Instantly share code, notes, and snippets.

View santoshtechwiz's full-sized avatar

santosh kumar singh santoshtechwiz

View GitHub Profile
@santoshtechwiz
santoshtechwiz / index.html
Created April 19, 2017 17:22 — forked from deltaepsilon/index.html
Firebase 3.0 Authentication Demo
<!--
Install dependencies with Bower:
bower install PolymerElements/paper-elements#^1.0.7
-->
<html>
<head>
<title>Auth Example</title>
<link rel="shortcut icon" href="/favicon.png" type="image/x-icon">
@santoshtechwiz
santoshtechwiz / shell_out.rb
Created April 8, 2017 13:19 — forked from kwilczynski/shell_out.rb
Mixlib::ShellOut live stream reader
# Only for Chef client 11 family!
# Bug was fixed in https://github.com/opscode/chef/commit/d6f6928fd1097709189cd78689e89032d4c9318d
class Chef
module Mixin
module ShellOut
def shell_out(*command_args)
cmd = Mixlib::ShellOut.new(*run_command_compatible_options(command_args))
cmd.live_stream ||= io_for_live_stream
cmd.run_command
public class Solution {
private int[][] dp;
public boolean isInterleave(String s1, String s2, String s3) {
if (s1.length() + s2.length() != s3.length()) {
return false;
}
if (s3.length() == 0) {
return true;
}
dp = new int[s1.length()][s2.length()];
@santoshtechwiz
santoshtechwiz / LeetCode-Spiral Matrix II
Created February 12, 2017 09:23 — forked from luoxiaoxun/LeetCode-Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ]
C++:
class Solution {
public:
vector<vector<int> > generateMatrix(int n) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(n<=0) return vector<vector<int>>();
vector<vector<int>> result(n,vector<int>(n));
int xBeg=0,xEnd=n-1;
int yBeg=0,yEnd=n-1;
@santoshtechwiz
santoshtechwiz / LeetCode-Spiral Matrix II
Created February 12, 2017 09:23 — forked from luoxiaoxun/LeetCode-Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ]
C++:
class Solution {
public:
vector<vector<int> > generateMatrix(int n) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(n<=0) return vector<vector<int>>();
vector<vector<int>> result(n,vector<int>(n));
int xBeg=0,xEnd=n-1;
int yBeg=0,yEnd=n-1;
@santoshtechwiz
santoshtechwiz / tree_html5.html
Created January 15, 2017 10:14 — forked from gsluthra/tree_html5.html
Fractal Tree Generation using HTML5 Canvas and Random Numbers
<html>
<head>
<script type="text/javascript">
window.onload = draw;
function draw(){
namespace Alphabet
{
public class AlphabetTest
{
public static readonly string Alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
public static readonly int Base = Alphabet.Length;
public static string Encode(int i)
{
if (i == 0) return Alphabet[0].ToString();
@santoshtechwiz
santoshtechwiz / gist:1f9806ac3a45c0a4c953342aa33bfba5
Created August 2, 2016 07:59 — forked from nathanjohnson320/gist:7283784
Use the Google Places API with node.js
exports.randeats = function(req, res){
var key = req.query.key;
var location = encodeURIComponent(req.query.location);
var radius = 16000;
var sensor = false;
var types = "restaurant";
var keyword = "fast";
var https = require('https');
var url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?" + "key=" + key + "&location=" + location + "&radius=" + radius + "&sensor=" + sensor + "&types=" + types + "&keyword=" + keyword;
@santoshtechwiz
santoshtechwiz / devops_training.txt
Created June 29, 2016 15:06 — forked from ssmythe/devops_training.txt
Training materials for DevOps
======
Videos
======
DevOps
What is DevOps? by Rackspace - Really great introduction to DevOps
https://www.youtube.com/watch?v=_I94-tJlovg
Sanjeev Sharma series on DevOps (great repetition to really get the DevOps concept)
@santoshtechwiz
santoshtechwiz / html5-video-streamer.js
Created June 17, 2016 05:49 — forked from paolorossi/html5-video-streamer.js
Node.js HTML5 video streamer
/*
* 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';