Skip to content

Instantly share code, notes, and snippets.

View chetandhembre's full-sized avatar

Chetan Dhembre chetandhembre

View GitHub Profile
#!/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 / 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
@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 / rabbitmq-env.conf
Created February 2, 2015 10:39
configuration for rabbitmq
MNESIA_BASE=/data/rabbitmq_data
LOG_BASE=/data/rabbitmq_log
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 / 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
@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
# 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 / gambler.py
Created September 25, 2016 20:25
Gambler's Problem: Reinforcement Learning
#resultant graphs are here: https://dl.dropboxusercontent.com/u/47591917/demo.png
import numpy as np
import math
from matplotlib import pyplot as plt
class State(object):
def __init__(self, capital):
self.capital = capital
def staked(self, stake):
@chetandhembre
chetandhembre / mc.py
Last active October 8, 2016 18:24
Easy21
#!#/usr/bin/python2
#plot link: https://dl.dropboxusercontent.com/u/47591917/easy21_mc.png
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
RED = 0
BLACK = 1