Skip to content

Instantly share code, notes, and snippets.

View vkhatri's full-sized avatar

Virender Khatri vkhatri

  • Planet Earth
View GitHub Profile
@vkhatri
vkhatri / j
Created March 4, 2014 05:14
dummy json syntax check wrapper
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'optparse'
o = {}
OptionParser.new do |opts|
opts.on("-h", "--help", "help") { |h| o[:help] = true }
@vkhatri
vkhatri / gist:9502043
Created March 12, 2014 06:45
Chef git Error - Failed to create timer thread
* git[/opt/git_sync] action sync
================================================================================
Error executing action `sync` on resource 'git[/opt/git_sync]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of git ls-remote "git@github.com:GITHUB_ACCOUNT/REPOSITORY.git" GITHUB_TAG* ----
@vkhatri
vkhatri / .vimrc
Last active August 29, 2015 14:05
.vimrc
syntax enable
set encoding=utf-8
filetype plugin indent on " load file type plugins + indentation
set nowrap " don't wrap lines
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
set nocompatible " Use vim defaults
set ls=2 " Always show status line
@vkhatri
vkhatri / chef-sysctl
Created September 2, 2014 17:20
chef role sysctl config
{
"default_attributes": {
"sysctl": {
"params": {
"fs": {
"file-max": "100000"
},
"net": {
"ipv4": {
"ip_local_port_range": "11000 65000",
@vkhatri
vkhatri / haproxy.cfg
Last active August 29, 2015 14:17
HAProxy SSL Termination
global
log 127.0.0.1 local1
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 350000
user haproxy
group haproxy
nbproc 2
cpu-map 1 0
cpu-map 2 1
@vkhatri
vkhatri / ffmpeg
Created April 6, 2015 09:16
FFmpeg x264 multimedia toolkit setup
# Install Packages
yum install kernel-headers kernel-devel # reboot instance if possible
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel patch telnet mdadm nfs-utils openssl-devel git libxml2 libxml2-devel libxslt libxslt-devel wget libtool pkgconfig nasm
# Set ENV Variables
export PATH=$PATH:/usr/local/bin
export FMP=/usr/local
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
@vkhatri
vkhatri / elasticsearch-indice-purge.rb
Created September 20, 2015 09:38
ElasticSearch Indice Purge Script
#!/usr/bin/env ruby
require 'net/http'
require 'json'
require 'date'
enable = true # set to false for dry run
retention_days = 30 # retention period
today_date = Date.today
deleted_any = false
@vkhatri
vkhatri / mesos-app-ip-port-env.sh
Created July 31, 2016 09:50
Shell Script to Create Environment Variables for Marathon Application Dynamic IP and Port
#!/bin/bash
# Info: Shell Wrapper to populate Marathon Application
# Containers IP & Port ENV Variables.
#
# Variables:
# MARATHON_GROUP: marathon group name
# e.g. Marathon APP - /group0/app
# MARATHON_GROUP=group0
# e.g. Marathon APP - /group0/group1/app
#!/bin/bash
set -e
if [ -f "/usr/bin/docker" ]; then
exited=$(docker ps -a -q -f status=exited | wc -l)
if [ $exited == "0" ]; then
echo "No exited container to Remove"
else
echo "Removing exited docker containers..."
---
exhibitor_storage_backend: static
oauth_enabled: false
telemetry_enabled: false
bootstrap_url: http://192.168.1.100:80
cluster_name: dev
master_discovery: static
master_list:
- 192.168.1.1
- 192.168.1.2