Skip to content

Instantly share code, notes, and snippets.

View deostroll's full-sized avatar
😄
indeed...!

arun.jayapal deostroll

😄
indeed...!
View GitHub Profile
@deostroll
deostroll / time.js
Created October 31, 2014 10:08
javascript print time in hh:mm:ss format - simple way
(function(dt) {
return [dt.getHours(), dt.getMinutes(), dt.getSeconds()].map(function(n) {
return n < 10 ? '0' + n : n
}).join(':');
})(new Date())
@deostroll
deostroll / comb.py
Last active August 29, 2015 14:16 — forked from anonymous/comb.py
Simple combinations using python
from math import factorial as fact
def comb(seq, r):
n = len(seq)
total = fact(n) / (fact(r) * fact(n-r))
pos = range(r)
c= []
i = 0
while i < total:
c.append(map(lambda x: seq[x], pos))
@deostroll
deostroll / comb.py
Last active August 29, 2015 14:16 — forked from anonymous/comb.py
Combinations in python using a generator
from math import factorial as fact
def comb(seq, r):
n = len(seq)
total = fact(n) / (fact(r) * fact(n-r))
pos = range(r)
#c= []
i = 0
while i < total:
#c.append(map(lambda x: seq[x], pos))
@deostroll
deostroll / Combinations.java
Created February 26, 2015 05:53
Generic Combination implementation in java
import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;
public class Combinations<T> implements Iterable<ArrayList<T>> {
private int totalCombinations;
private int n, r;
private int factorial(int n) {
@deostroll
deostroll / input-test10.txt
Last active August 29, 2015 14:16
Sample test input/output of 10 points for Pattern Recognition problem
10
7747 7747
10247 10247
12747 12747
15247 15247
@deostroll
deostroll / localclass.java
Created February 26, 2015 14:23
local class sample in java
public class LocalClassSample {
public static void main(String[] args) {
class Utils {
public void printHello(String name) {
System.out.println("Hello " + name);
}
}
Utils util = new Utils();
@deostroll
deostroll / report.txt
Last active August 29, 2015 14:17
Test report
The following files were submitted:
----------------------------------
total 24K
-rw-r--r-- 1 5.5K Mar 19 20:03 Brute.java
-rw-r--r-- 1 5.7K Mar 19 20:03 Fast.java
-rw-r--r-- 1 2.7K Mar 19 20:03 Point.java
-rw-r--r-- 1 4.0K Mar 19 20:03 studentSubmission.zip
******************************************************************************
RawSmtp Information: 0 : ---Session Started @ 11:59:52 AM
RawSmtp Information: 0 : << 220 BLREQX343539D Service ready
RawSmtp Information: 0 : >> EHLO BLREQX343539D
RawSmtp Information: 0 : << 500 Syntax error, command unrecognized
RawSmtp Information: 0 : >> HELO BLREQX343539D
RawSmtp Information: 0 : << 250 127.0.0.1
RawSmtp Information: 0 : >> MAIL FROM:<arun_jayapal@infosys.com>
RawSmtp Information: 0 : << 250 OK
RawSmtp Information: 0 : >> RCPT TO:<deostroll@hotmail.com>
RawSmtp Information: 0 : << 250 OK
bool listen = true;
TcpListener listener = GetListener();
listener.Start();
while(listen)
{
if(!listener.Pending())
{
Thread.Sleep(500); //why?! and why only 500
continue;
@deostroll
deostroll / kdtree.java
Last active August 29, 2015 14:18
kdtree
import java.util.ArrayList;
import java.util.Comparator;
public class KdTree {
private final static boolean HORIZONTAL = true;
private final static boolean VERTICAL = false;
private Node root;
private int size;