Skip to content

Instantly share code, notes, and snippets.

View dineshprabu-freshdesk's full-sized avatar

Dineshprabu S dineshprabu-freshdesk

View GitHub Profile
@dineshprabu-freshdesk
dineshprabu-freshdesk / super-tip.txt
Created May 10, 2018 11:52 — forked from ericdouglas/super-tip.txt
Change 4 spaces to 2 spaces indentation and change tab to spaces - Vim tip
// 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
// Tab to 2 spaces
:%s/\t/ /g
@dineshprabu-freshdesk
dineshprabu-freshdesk / thread-pool.rb
Created April 8, 2018 03:39 — forked from rosenfeld/thread-pool.rb
Simple thread pool implementation in Ruby
require 'thread' # for Mutex: Ruby doesn't provide out of the box thread-safe arrays
class ThreadPool
def initialize(max_threads = 10)
@pool = SizedQueue.new(max_threads)
max_threads.times{ @pool << 1 }
@mutex = Mutex.new
@running_threads = []
end
0001 0000 000d 0080 0003 0050 4646 544d
677b a7e4 0001 f8d4 0000 001c 4744 4546
03b6 0006 0001 f8b4 0000 0020 4f53 2f32
2fbe dc40 0000 0158 0000 0056 636d 6170
e71d f3d3 0000 0fd4 0000 0152 6761 7370
ffff 0003 0001 f8ac 0000 0008 676c 7966
ef6a f641 0000 183c 0001 bb84 6865 6164
fccd 45ef 0000 00dc 0000 0036 6868 6561
04a1 03e6 0000 0114 0000 0024 686d 7478
11cb 2e4b 0000 01b0 0000 0e24 6c6f 6361
774f 4646 4f54 544f 0002 75cc 000b 0000
0004 4ef0 0001 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 4346 4620
0000 0108 0002 70f9 0004 3c1b 4c94 d0e3
4646 544d 0002 7204 0000 001a 0000 001c
677b a7e4 4744 4546 0002 7220 0000 001f
0000 0020 03b4 0004 4f53 2f32 0002 7240
0000 004b 0000 0060 2fdf dc61 636d 6170
0002 728c 0000 003e 0000 0152 e71b f2cc
6865 6164 0002 72cc 0000 002e 0000 0036
/* ========================================================
*
* Londinium - premium responsive admin template
*
* ========================================================
*
* File: styles.css;
* Description: General template styles.
* Version: 1.0
@font-face {
font-family: 'icomoon';
src:url('icons/icons.eot');
src:url('icons/icons.eot?#iefix') format('embedded-opentype'),
url('icons/icons.woff') format('woff'),
url('icons/icons.ttf') format('truetype'),
url('icons/icons.svg#icons') format('svg');
font-weight: normal;
font-style: normal;
}
/* ========================================================
*
* Londinium - premium responsive admin template
*
* ========================================================
*
* File: londinium-theme.css;
* Description: Custom template styles for Bootstrap framework.
* Version: 1.0
/*!
* Bootstrap v3.1.1 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.0 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;heigh
function search(tag){
// Considering request returns promise.
return request('http://google.com?q='+tag);
}
search('monard')
.then(function(response){
console.log(response);
})
.catch(function(searchError){
@dineshprabu-freshdesk
dineshprabu-freshdesk / tornado_async_example.py
Last active July 31, 2017 15:43
[Python] Tornado Example
import tornado.web
from tornado.ioloop import IOLoop
from tornado import gen
from tornado.concurrent import run_on_executor
from concurrent.futures import ThreadPoolExecutor
MAX_WORKERS = 16
class TestHandler(tornado.web.RequestHandler):