Skip to content

Instantly share code, notes, and snippets.

# View list of connections and their states
netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# List all connections and timers
ss -rota | less
@chetandhembre
chetandhembre / React Native: Animated - Code
Created September 22, 2015 18:01 — forked from sahrens/React Native: Animated - Code
Example code from ReactEurope 2015 talk - React Native: Animated
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@chetandhembre
chetandhembre / output.txt
Created April 29, 2015 18:30
openssl s_client output
$ openssl s_client -connect 127.0.0.1:8000 -ssl3
CONNECTED(00000003)
depth=0 /C=IN/ST=Maharashtra/L=vashi/O=Codigami Inc/OU=develop/CN=chetan/[email protected]
verify error:num=18:self signed certificate
verify return:1
depth=0 /C=IN/ST=Maharashtra/L=vashi/O=Codigami Inc/OU=develop/CN=chetan/[email protected]
verify return:1
---
Certificate chain
var fs = require('fs');
var tls = require('tls');
var constants = require('constants');
var options = {
key: fs.readFileSync('tlsVsSslve-private.pem'),
cert: fs.readFileSync('tlsVsSslv3-cert.pem'),
secureProtocol: 'TLSv1_method',
secureOptions: constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_SSLv2,
@chetandhembre
chetandhembre / rabbitmq-env.conf
Created February 2, 2015 10:39
configuration for rabbitmq
MNESIA_BASE=/data/rabbitmq_data
LOG_BASE=/data/rabbitmq_log
@chetandhembre
chetandhembre / install_rabbitmq.sh
Created February 2, 2015 10:12
install rabbitmq
#!/bin/sh
cat <<EOF > /etc/apt/sources.list.d/rabbitmq.list
deb http://www.rabbitmq.com/debian/ testing main
EOF
curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc -o /tmp/rabbitmq-signing-key-public.asc
apt-key add /tmp/rabbitmq-signing-key-public.asc
rm /tmp/rabbitmq-signing-key-public.asc
apt-get -qy update
@chetandhembre
chetandhembre / 1.Rabbitmq Installation
Last active December 19, 2016 10:33
RabbitMq setup tips
this is hack so that i can get proper git file header name.
You should start it by reading steps from https://gist.github.com/chetandhembre/bca6767e76dd756b93af#file-setup-steps file
#!/bin/sh
policy=${HOME}/.jstatd.all.policy
[ -r ${policy} ] || cat >${policy} <<'POLICY'
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
POLICY
jstatd -J-Djava.security.policy=${policy} &
@chetandhembre
chetandhembre / best.txt
Last active August 29, 2015 14:07
best practicess while writing javascript
1. No anonymous function give function name even in callback..V8 optimized hot function if your function do not have name then each time it get calls V8 think it is new function and tend optimize it or may not consider as hot function
2. Declare your object (initialized it). Adding and removing attribute on the fly is not optimized way to do things. See how V8's hidden call concept. And always initialize variable in same sequence.
3. use prototype to bind function to your object.
4. use buffer more often. Converting to 'utf8' string is costly
5. use 'dezalgo' module, You can find more reason behind it in link to blog post from readme of module
6. do not string concatenate using '+' operator create array of all string an use join method.
7. do not create function inside closure .. write atomic function (named function )
8. assign static constant value to varible in class using prototype
9. Do not use delete reason hidden class optimization assign null or let GC to it's job
10. try to avoid number more than 31
@chetandhembre
chetandhembre / named.js
Last active August 29, 2015 14:06
Performace of node.js and GC working
var globalTime = new Date().getTime();
var obj;
var a = function(){
var i;
for(i=0;i<=12000;i++){
obj = {};
obj = null;
}
}