Skip to content

Instantly share code, notes, and snippets.

View santoshtechwiz's full-sized avatar

santosh kumar singh santoshtechwiz

View GitHub Profile
@santoshtechwiz
santoshtechwiz / trace.py
Created November 17, 2018 12:59
A simple python program for tracing function execution
level = 0
def trace(f):
def g(*args):
global level
indent = '| ' * level + '|-- '
argstr = ", ".join([repr(a) for a in args])
print indent + f.__name__ + argstr
level += 1
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: Consolas, "Courier New", Courier, Monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
@santoshtechwiz
santoshtechwiz / PhysicalLatLonToPixelXY.html
Created September 19, 2018 10:23 — forked from iamjpg/PhysicalLatLonToPixelXY.html
Google Maps v3 – Translate Physical Latitude/Longitude into Screen Pixel X/Y
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>google_maps_custom_point</title>
<style>
body {
margin: 0;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ConsoleApp27
{
public static void DrawRuler(int nInches, int majorLength)
{
DrawLine(majorLength, 0);
for (int j = 1; j <= nInches; j++)
{
DrawInterval(majorLength - 1);
DrawLine(majorLength, j);
}
}
private static void DrawInterval(int centerLength)
@santoshtechwiz
santoshtechwiz / PriorityQueue.cs
Created September 26, 2017 17:40
PriorityQueue implementation in C#
/// <summary>
/// A collection that returns the highest priority item first and lowest priority item last.
/// </summary>
/// <typeparam name="T">The type of data stored in the collection</typeparam>
public class PriorityQueue<T> : IEnumerable<T> where T : IComparable<T>
{
LinkedList<T> _items = new LinkedList<T>();
/// <summary>
/// Adds an item to the queue in priority order
@santoshtechwiz
santoshtechwiz / longestCommonSubstring3.cs
Created September 14, 2017 19:40 — forked from jianminchen/longestCommonSubstring3.cs
longest common substring - brute force solution - O(n^3) - code after reviewing.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace longestCommonSubstring
{
class Program
{
@santoshtechwiz
santoshtechwiz / get-permutations.cs
Created September 11, 2017 19:15 — forked from mbenford/get-permutations.cs
Generates all permutations of a set by using LINQ and a recursive approach
public static class Permutations
{
public static IEnumerable<IEnumerable<T>> Get<T>(IEnumerable<T> set, IEnumerable<T> subset = null)
{
if (subset == null) subset = new T[] { };
if (!set.Any()) yield return subset;
for (var i = 0; i < set.Count(); i++)
{
var newSubset = set.Take(i).Concat(set.Skip(i + 1));
@santoshtechwiz
santoshtechwiz / QueueJakes.java
Created August 30, 2017 18:52 — forked from jakswa/QueueJakes.java
circular queue in java
import java.util.Scanner;
public class QueueJakes {
public static void main (String [] args) {
Scanner myscan = new Scanner(System.in);
System.out.print("Enter max queue size: ");
int qSize = myscan.nextInt(), choice;
Queue q = new Queue(qSize);
@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">