Skip to content

Instantly share code, notes, and snippets.

View byteshiva's full-sized avatar
🎯
Focusing

Siva byteshiva

🎯
Focusing
View GitHub Profile

How to install PhantomJS on Ubuntu

Version: 1.9.7

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
@byteshiva
byteshiva / rails-vagrant-provision.sh
Created January 14, 2016 08:45 — forked from johanneswuerbach/rails-vagrant-provision.sh
Provision a vagrant box with ruby stable (using rvm), postgres, redis and node (using nvm)
#!/usr/bin/env bash
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8
sudo apt-get update
sudo apt-get install -y build-essential git curl libxslt1-dev libxml2-dev libssl-dev
# postgres
@byteshiva
byteshiva / Dockerfile
Created February 16, 2016 04:52 — forked from benschw/Dockerfile
MySQL Docker Container
FROM ubuntu
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install mysql-client mysql-server
# -*- mode: ruby -*-
# vi: set ft=ruby :
=begin
ModernIE VMs
config.vm.box = "modernIE/vista-ie7"
config.vm.box = "modernIE/w7-ie8"
config.vm.box = "modernIE/w7-ie9"
config.vm.box = "modernIE/w7-ie10"
@byteshiva
byteshiva / ZSPLIT.lua
Created March 18, 2016 10:37 — forked from alexanderscott/ZSPLIT.lua
Redis Lua script to split a ZSET in two (round-robin)
-- @desc: Split a ZSET in two via round-robin
-- @usage: redis-cli eval "$(cat ZSPLIT)" 2 <originalZset> <newZset>
-- @return: list of moved members
local function ZSPLIT(zset1, zset2)
local zset1size = redis.call("ZCARD", zset1)
if zset1size == 0 then return {} end
local members = redis.call("ZREVRANGEBYSCORE", zset1, "+INF", "-INF", "WITHSCORES")
@byteshiva
byteshiva / _helpers.js
Created June 2, 2016 14:22 — forked from elclanrs/_helpers.js
Monads in JavaScript
var extend = function(a, b) {
for (var i in b)
a[i] = b[i];
return a;
};
var fluent = function(f) {
return function() {
var clone = extend(Object.create(null), this);
f.apply(clone, arguments);
@byteshiva
byteshiva / deployment-tool-ansible-puppet-chef-salt.md
Created July 4, 2016 05:35 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@byteshiva
byteshiva / Vhostman-nginx.bash
Created August 22, 2016 11:03 — forked from willwade/Vhostman-nginx.bash
VhostMan-Nginx. A small script (and other bits) for creating virtual hosts with Nginx. Use as you wish. Download all the components - put in your path somewhere and run with vhostman-nginx.sh create domain.com app name. It doesn't need the gunicorn_start file if you don't need that.
#!/bin/bash
### Set default parameters
# somewhat follows the conventions from: http://michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/
# designed to run on a debian symbiosis box if your interested why its /srv
action=$1
domain=$2
appname=$3
owner=$(who am i | awk '{print $1}')
sitesEnable='/etc/nginx/sites-enabled/'
sitesAvailable='/etc/nginx/sites-available/'
{
"acl_datacenter": "test-1",
"acl_default_policy": "deny",
"acl_down_policy": "deny",
"acl_master_token": "1234",
"acl_ttl": "30s",
"bootstrap_expect": 3,
"check_update_interval": "5m",
"datacenter": "test-1",
"data_dir": "/etc/consul.d/data",
- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions
numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Centralized locking can be based on this K/V store.