Calculate Stats of github ( git ) project

Lets say we want stats of ORC project

git clone https://github.com/apache/orc.git

Clone gitstats project also

git clone https://github.com/hoxu/gitstats.git
cd gitstats/

Calculate stats

./gitstats /Users/jagatsingh/dev/code/open/orc /Users/jagatsingh/dev/code/open/gitstats/orc_stats
open '/Users/jagatsingh/dev/code/open/gitstats/orc_stats/index.html'

You need following installed on your machine

* Git
* Python
* Gnuplot

XSD to SVG

XSD to SVG converter

Download xsdvi from http://sourceforge.net/projects/xsdvi/

Execute the sample command as below.


java -jar /Users/jagatsingh/Desktop/xsdvi/dist/lib/xsdvi.jar email-action-0.2.xsd -embodyStyle

skype message keeps on (not) sending

If you see that Skype message is not getting send then check that you are online.

I was accidentally offline and all messages were just waiting and waiting to be sent.


Remove Boot2docker from mac

Follow the steps below

Delete and stop boot2docker vms

$ VBoxManage list vms

It will show

"default" {7cc6538c-e5ac-447e-90ac-6cb043deffdd}
"boot2docker-vm" {ffff35a9-71ec-4e72-bf82-09f02c3949e2}

Delete the vm
$VBoxManage unregistervm default --delete
$VBoxManage unregistervm ffff35a9-71ec-4e72-bf82-09f02c3949e2 --delete

Verify again
$VBoxManage list vms

Delete and uninstall boot2docker by following steps

https://github.com/boot2docker/osx-installer/blob/master/uninstall.sh



Mount windows share on Linux

mount -t cifs -o sec=ntlm,username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt

Source

http://askubuntu.com/questions/491297/permanent-windows-share-mounting

https://access.redhat.com/solutions/448263

Without

sec=ntlm

It gives error below.

mount error(5): Input/output error
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Using Hive from R

Using Hive from R

We need to install following packages

R CMD INSTALL rJava
R CMD INSTALL RHive

rm(list=ls())
options( java.parameters = "-Xmx8g" )

library(RJDBC)
if (Sys.getenv("JAVA_HOME")!="") Sys.setenv(JAVA_HOME="")
.jinit()
for(l in list.files('/usr/phd/3.0.0.0-249/hadoop',pattern="*.jar",recursive=TRUE)){ .jaddClassPath(paste("/usr/phd/3.0.0.0-249/hadoop/",l,sep=""))}


hivedrv <- JDBC("org.apache.hive.jdbc.HiveDriver", "/usr/phd/3.0.0.0-249/hive/lib/hive-jdbc.jar")
conn <- dbConnect(hivedrv, "jdbc:hive2://hive:10000/default", "myusername")

counter <- dbGetQuery(conn, "select count(*) from default.tablename")

counter

Change the paths for jar above as per your Hadoop distribution

Openstack Heat template with anti affinity group example

Example of using heat template which allows us to keep virtual machines on different physical hosts.

Example heat template

######

heat_template_version: 2014-10-16

description: Haproxy hosts

parameters:
service-flavour:
type: string
default: rhel6-cloud.1.2
image:
type: string
default: redhat6
key_name:
type: string
default: mykey

resources:
haproxy-svrgrp:
type: OS::Nova::ServerGroup
properties:
name: haproxy-svrgrp
policies: [ 'anti-affinity' ]

haproxy-01:
type: OS::Nova::Server
properties:
name: haproxy-01
flavor: { get_param: service-flavour }
image: { get_param: image }
key_name: { get_param: key_name }
admin_user: cloud-user
networks:
- port: { get_resource: haproxy-01-port }
scheduler_hints:
group: haproxy-svrgrp

haproxy-02:
type: OS::Nova::Server
properties:
name: haproxy-02
flavor: { get_param: service-flavour }
image: { get_param: image }
key_name: { get_param: key_name }
admin_user: cloud-user
networks:
- port: { get_resource: haproxy-02-port }
scheduler_hints:
group: haproxy-svrgrp


######


Further readings

http://docs.openstack.org/developer/heat/template_guide/hot_spec.html

http://docs.openstack.org/icehouse/config-reference/content/section_compute-scheduler.html