Skip to content

Instantly share code, notes, and snippets.

View chetandhembre's full-sized avatar

Chetan Dhembre chetandhembre

View GitHub Profile
@chetandhembre
chetandhembre / gist:cdeff7f870401eabce66
Last active August 29, 2015 14:06
useful Linux commnad
# find process holding port
sudo netstat -lpn |grep :80
# run nginx command
sudo LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH /opt/nginx/sbin/nginx
#reload nginx
sudo LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH /opt/nginx/sbin/nginx -s reload
#get all nginx process
# mongo.conf
#where to log
logpath=/log/mongod.log
logappend=true
# fork and run in background
fork = true
@chetandhembre
chetandhembre / afterShutdown.json
Created May 22, 2014 13:20
Bug in Kue while shutdowning worker for particular type of job
[ { queue:
{ client: [Object],
promoter: null,
workers: [Circular],
_events: {} },
type: 'abc',
client:
{ stream: [Object],
options: [Object],
connection_id: 1,
@chetandhembre
chetandhembre / mongo error
Last active August 29, 2015 14:01
mongo error
> node index.js
ec2-54-234-201-7.compute-1.amazonaws.com :27017
Error: No valid replicaset instance servers found
at /var/app/current/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/connection/repl_set/repl_set.js:446:45
at null.<anonymous> (/var/app/current/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/connection/server.js:499:7)
at EventEmitter.emit (events.js:95:17)
at null.<anonymous> (/var/app/current/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:178:15)
at EventEmitter.emit (events.js:98:17)
at Socket.<anonymous> (/var/app/current/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/connection/connection.js:501:10)
@chetandhembre
chetandhembre / s3Uploader.js
Created April 14, 2014 13:25
Upload file to s3 using intimidate
var Intimidate = require('intimidate');
var s3Uploader = function(options) {
try {
this.client = new Intimidate(options);
} catch (e) {
return null;
}
};
@chetandhembre
chetandhembre / httpsProxy.js
Last active August 29, 2015 13:56
Create https proxy
var fs = require('fs'),
http = require('http'),
https = require('https'),
httpProxy = require('http-proxy');
var hskey = fs.readFileSync('./***-key.pem' , 'utf8');
var hscert = fs.readFileSync('./***-cert.pem' , 'utf8')
var options = {
https: {

img2boxshadow.rb

a ruby script to convert images to CSS (box-shadows)

Installation

gem install rmagick    # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse
@chetandhembre
chetandhembre / index.html
Created October 26, 2013 14:16
A Pen by Chetan.
<div class = "parent">
<div class="child">
<div class="child1">
<div class="child2">
<div class="child3">
</div>
</div>
</div>
</div>
</div>