Thursday, December 15, 2016

steps to add project to git repo locally

Note: In the below step , I have used a project named "my_project"  . Install git and create a account in github before follow the below steps.

Github Link : https://github.com/

In Ubuntu flavoured system :

sudo apt-get install git

My project directory is :

/home/cision/project/my_project>



  1.  cd /home/cision/project/my_project>
  2. git config --global user.name 'username'
  3. git config --global user.email 'your registered emails id in github'
  4. git init
  5. git add -A
  6. git status 
  7. git commit -m "initialize repository'
safeguard : In case any damage in local project directory ( not the git repository ) use th ebelow command to restore from git to project directory 

Ex: remove any file from project directory , then 

# git checkout -f

Now you can see the same deleted file again in the project directory.








Wednesday, August 10, 2016

Arangodb3 basic shell tutorials:

Hope arangodb is already installed !

1) check if the arangodb is already installed ?

curl http://localhost:8529/_api/version   => here it will give the details of the arangodb version in json format.

2) login to arangodb shell

arangosh    =>  provide the arangodb root password

3) create a user

require ("org/arangodb/users").save("khirod","khirod");

4) Grant _system access to user khirod

require("org/arangodb/users").grantDatabase("khirod","_system");


next  coming soon ....



Monday, August 8, 2016

Some Ruby tips :

1) use literal array instead of ['test', 'test1']

ex :  %w(test test1)

2) check with multiple values

ex: %w(val1 val2 val3).include?(check_val)


Monday, May 9, 2016

How to Start Juniper VPN through firefox in 64 bit Ubuntu OS

Unless you need 64bit firefox , try the below steps

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
sudo apt-get install firefox:i386 openjdk-6-jdk:i386 icedtea-6-plugin:i386
sudo apt-get install xterm

OR

1) download and install 32bit java
2) Then install 32bit java through update-alternatives .

Ex:
sudo update-alternatives --install /usr/bin/java java /home/user/programs/java/jdk1.7.0_75/bin/java 10

3) restart firefox
 

else

follow the below link
https://www.java.com/en/download/help/enable_browser_ubuntu.xml

Tuesday, December 29, 2015

secured wifi disconnect in mint

Please create the below file with below content and reboot the system to overcome from regular disconnection of secured wifi connection.  I have tried in mint 17.3 and it works. Please let me know if it fail with proper log.


echo "options rtl8723be fwlps=N ips=N" | sudo tee /etc/modprobe.d/rtl8723be.conf


Tuesday, September 15, 2015

Rest service to get the name node Host ID from thousand of node from cloudera hadoop cluster


1) get the cluster name

clustername = HttpClient(http://:7180/api/v10/clusters)

2) now get the  HostID

host_id=HttpClient(http://:7180/api/v10/clusters/${clustername}/services/hdfs/roles)

3) Now get the Hostname which is on with Namenode

host_name=HttpClient(http://:7180/api/v10/hosts/fb50e775-33b7-4f38-b268-2bb3220695e1)

Now you have the host name which is on with name node .

NOTE : Here I just used HttpClient as a sample method which will get the details from rest service and parse as per the requirements.




-Khirod

Saturday, July 4, 2015

Hello Juby with warbler

Lets have a Hello world program through jruby and prepare a executable jar through warbler.

Let's assume jruby already installed . In my case I used jruby 1.7.8

Please create the below directory structure :

HelloWorld---|
                       |--bin--main.rb
                       |--lib--hello--hello.rb
                       |--Gemfile                      -------File
                       |--helloworld.gemspec   -------File

copy the below content to the respective file, then execute the below steps through terminal. at the end you should have a HelloWorld.jar in your project directory and follow the step number (5) to get the output.

  1. install bundler gem : gem install bundler
  2. change to the directory HelloWorld 
  3. execute bundle : $> bundle
  4. warble compiled jar
  5. java -jar HelloWorld.jar


helloworld.gemspec :

Gem::Specification.new do |s|  s.name             = 'helloworld'  s.version          = '1.0.0'  s.authors          = ['Khirod Patra']
  s.date             = '2013-07-03'  s.description      = 'Hello World'  s.email            = ['khirodpatra@gmail.com']
  s.homepage         ='khirodblog.blogspot.com/'
  s.require_paths    = ['lib','bin']
  s.files            = Dir.glob("{bin,lib}/**/*")
  s.executables   = s.files.select { |f| f =~ /^bin\// }.map{ |f| File.basename(f) }
  s.default_executable = 'bin/main.rb'  end

GemFile :

source 'https://rubygems.org'

gem 'warbler'

hello.rb :

module Hello
  class SayHello
    def hello
      puts "hello World"    end  endend

main.rb :

#!/usr/bin/env ruby
require 'rubygems'

require 'java'
my_lib = File.expand_path(File.dirname(__FILE__) + "/../lib")$LOAD_PATH.unshift(my_lib) unless $LOAD_PATH.include?(my_lib)
require 'hello/hello'
module Hello
  class Main    SayHello.new.hello
  endend