Skip to content

Instantly share code, notes, and snippets.

@ravibhure
ravibhure / ruby.1.9.3-setup.sh
Created May 2, 2013
Install ruby 1.9.3 on CentOS
View ruby.1.9.3-setup.sh
#!/usr/bin/env bash
# repository
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
rpm -Uvh epel-release-6-7.noarch.rpm
# system update
yum -y update
yum -y groupinstall "Development Tools"
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick
@ravibhure
ravibhure / python.2.7.3-setup.sh
Last active Dec 16, 2015
Install python 2.7.3 on CentOS
View python.2.7.3-setup.sh
#!/bin/bash
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
yum -y groupinstall "Development tools"
yum -y install zlib-devel
yum -y install bzip2-devel openssl-devel ncurses-devel sqlite-devel mysql-devel
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
if [ ! -f Python-2.7.3.tar.bz2 ] ;then
echo "Python-2.7.3.tar.bz2 not found"
@ravibhure
ravibhure / create_mysql_user.sh
Created May 2, 2013
create user in mysql database
View create_mysql_user.sh
#!/bin/bash
#Ask user to enter database name and save input to dbname variable
read -p "Please Enter Database Name:" dbname
#checking if database exist
mysql -Bse "USE $dbname" 2> /dev/null
#if database exist:
if [ $? -eq 0 ]; then
@ravibhure
ravibhure / gist:5540093
Created May 8, 2013
Install RMagick ruby gem
View gist:5540093
# http://stackoverflow.com/questions/1254366/problem-installing-rmagick-rubygem-on-centos-5/7766705#7766705
# Uninstalled ImageMagick 6.5.4-9 and the delegate libraries that I had installed from source
yum install ImageMagick
yum install ImageMagick-devel
curl -O http://www.zacharywhitley.com/linux/rpms/fedora/core/6/i386/msttcorefonts-2.0-1.noarch.rpm
rpm -ivh msttcorefonts-2.0-1.noarch.rpm
ln -s /usr/share/fonts/msttcorefonts/ /usr/share/fonts/default/TrueType
gem install rmagick -v 1.15.17 --no-rdoc --no-ri
@ravibhure
ravibhure / table_view
Created Sep 27, 2013
table view on terminal from json output
View table_view
#!/usr/bin/env ruby
require 'rubygems'
require 'terminal-table'
require 'json'
rows = []
data = JSON.parse(ARGF.read)
@ravibhure
ravibhure / chef_server_install.sh
Created Oct 24, 2013
Hands off installation of chef server + nginx https proxy on ubuntu
View chef_server_install.sh
#!/bin/bash
CHEF_SERVER_WEBUI_PASS=webui_admin_pass
CHEF_AMQP_PASS=amqp_pass
CHEF_FQDN=chef.yourdomain.com
CHEF_URL=https://${CHEF_FQDN}
export DEBIAN_FRONTEND=noninteractive
echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | tee /etc/apt/sources.list.d/opscode.list
mkdir -p /etc/apt/trusted.gpg.d
@ravibhure
ravibhure / gist:7523642
Created Nov 18, 2013
HAProxy config for wordpress
View gist:7523642
# HAProxy config to block /wp-login.php and wp-admin POST method on wordpress webserver
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 25000
#debug
#quiet
user prod
group prod
View pedantically_commented_playbook.yml
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
View encrypted-git-repo.md

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang (geek@cerias.net). It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].

Description

When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

View ansible_approach.md

My ansible approach

Per service playbooks

Playbooks are written per service : a playbook is a collection of tasks, and eventually associated handers, templates, and files, that are required to properly install and setup a service.

Each playbook has a setup.yml entry point, which is responsible of including various necessary tasks to get the service up and running. Typically, this