Skip to content

Instantly share code, notes, and snippets.

@mdtareque
mdtareque / Test.java
Created April 1, 2012 20:47
Testing
public class Test {
public static void main(String[] args){
System.out.println("Hello, World !");
}
}
@mdtareque
mdtareque / gist:6176284
Last active December 20, 2015 18:29
Sample json test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mdtareque
mdtareque / ThreadCreationTimeIncreasesWithNumberOfThreads.java
Last active January 1, 2016 18:39
Java Thread creation time increases with the number of Threads created. Little more description can be found at http://mtktechiecode.blogspot.in/2014/01/java-analyzing-thread-creation-time.html
public class ThreadCreationTimeIncreasesWithNumberOfThreads {
public static void main(String[] args) {
long threadCreationTime = 0, noOfThreadsCreated=1;
while (true) {
long time = System.currentTimeMillis();
new Thread() {
public void run() {}
}.start();
time = System.currentTimeMillis() - time;
if (time > threadCreationTime) {
@mdtareque
mdtareque / ProblemA.java
Last active August 29, 2015 14:19
google codejam 15 - qualification round - problemA - standing ovation
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @author mtk - Mohammed Tareque Khan
* More details: http://mtktechiecode.blogspot.in/2015/04/google-codejam-15-standing-ovation.html
*
* Algo description:
* if number of people for next shynesslevel is not zero then:
@mdtareque
mdtareque / stdc++.h
Created October 24, 2015 19:20 — forked from velicast/stdc++.h
Linux GCC 4.8.0 /bits/stdc++.h header definition.
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@mdtareque
mdtareque / python_deep_n_shallow_copy.py
Created November 5, 2015 22:11
Code to show difference between shallow and deep copy of list in python
In [1]: L1=[ 1, 2, 3, 4, [11, 22, 33, 44] ]
In [2]: L2=L1
In [3]: L3=L1[:]
In [4]: L1, L2, L3
Out[4]:
([1, 2, 3, 4, [11, 22, 33, 44]],
@mdtareque
mdtareque / example1.py
Created March 30, 2016 12:11 — forked from onyxfish/example1.py
Basic example of using NLTK for name entity extraction.
import nltk
with open('sample.txt', 'r') as f:
sample = f.read()
sentences = nltk.sent_tokenize(sample)
tokenized_sentences = [nltk.word_tokenize(sentence) for sentence in sentences]
tagged_sentences = [nltk.pos_tag(sentence) for sentence in tokenized_sentences]
chunked_sentences = nltk.batch_ne_chunk(tagged_sentences, binary=True)
@mdtareque
mdtareque / attribute_flattener.py
Created April 8, 2016 23:00
Kaggle input data fromatter for Home Depot Product Search Relevance
import sys
"""
usage: python attribute_flattener.py [include-keys=yes] [override filename]
generates <file_name>.out file
contents are all attributes are flattened to single line per key
NOte: Keep attributes.csv in current folder and run
python attribute_flattener.py
"""
@mdtareque
mdtareque / master.vim
Created May 4, 2016 03:15 — forked from gmccreight/master.vim
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
set ts=4
set sw=4
set et
set ai
set hls
so ~/.vim/Align.vim
" https://github.com/tpope/vim-pathogen To install vim plugins