Skip to content

Instantly share code, notes, and snippets.

View ravibhure's full-sized avatar

Ravi ravibhure

View GitHub Profile
@ravibhure
ravibhure / install_elasticsearch.sh
Last active August 29, 2015 14:14
Installing elasticsearch from source
#!/bin/bash
# Installing elasticsearch from source
# https://gist.github.com/rajraj/1556657#file-es-sh
# https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.2.tar.gz
cd ~
sudo yum -y install java-1.7.0-openjdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.1.zip
unzip elasticsearch-0.90.1.zip
@ravibhure
ravibhure / gibench.sh
Created January 29, 2015 10:03
A very crude and brutish disk benchmark running mkdir and git init 5,000 times.
# time sh gibench.sh
dir=gitemp
rm -rf $dir &> /dev/null
mkdir $dir
cd $dir
for (( c=1; c<=5000; c++ ))
do
mkdir $c
cd $c
@ravibhure
ravibhure / post.md
Last active August 29, 2015 14:15 — forked from jkeiser/post.md

Chef Metal and LXC: Best Friends!

Chef Metal now supports LXC! All the benefits of Metal, including idempotent, versioned, reusable cluster definitions can be realized. You can use LXC containers for testing, or you can use them as a part of your application stack. You can now write a Metal recipe like so:

chef-metal is still alpha software. People are experimenting with it and contributing to it, but it is still evolving.

require 'chef_metal_lxc'
@ravibhure
ravibhure / Chef Metal_Configuration_and_Drivers.md
Created February 19, 2015 04:42
Chef Metal, Configuration and Drivers

Chef Metal, Configuration and Drivers

As Chef Metal approaches 1.0, we've landed a huge configuration and driver interface improvement intended to enable:

  • A standard way to specify credentials and keys that keeps them out of recipes and allows them to be used in multiple places
  • External commands (like "metal execute") that can look up information and manage a node independent of the original Metal recipe
  • Environmental and directory-specific configuration
  • Make the drivers easily usable in test-kitchen and knife

Herein I want to talk about the Driver interface and how it is used by provisioning programs like the machine resource or kitchen, and driver implementors.

@ravibhure
ravibhure / README.md
Last active August 29, 2015 14:16 — forked from fnichol/README.md
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

#!/usr/bin/perl
# HAProxy Performance Statistics
# by Steve Kamerman
#
# To use, pipe your HAProxy log with timing information (like "0/0/1/1/3 200") to
# this script. It will output min, max, med, avg and a latency distribution graph.
#
# Info on timing logging in HAProxy: http://code.google.com/p/haproxy-docs/wiki/TimingEvents
#
@ravibhure
ravibhure / curl.md
Last active August 29, 2015 14:18 — forked from btoone/curl.md

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@ravibhure
ravibhure / jenkins.sh
Created July 10, 2015 04:40
Install Jenkins
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
# exit 0
@ravibhure
ravibhure / java_version.sh
Last active August 29, 2015 14:27
How to retrieve java version
#!/bin/sh
JAVA_VERSION=`echo "$(java -version 2>&1)" | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'`
echo $JAVA_VERSION
@ravibhure
ravibhure / newrelic_python.sh
Last active September 8, 2015 05:43
Install newrelic system daemon for python app
#!/bin/bash
# Ref: https://docs.newrelic.com/docs/servers/new-relic-servers-linux/installation-configuration/servers-installation-ubuntu-debian
# https://docs.newrelic.com/docs/agents/python-agent/installation-configuration/python-agent-integration
# Usage: $0 <your key>
YOUR_LICENSE_KEY=$1
# define spinner function for slow tasks
spinner()
{