Archive for ruby

[tekwalk] make rvmsudo use running user’s ENV var

Posted in Blogroll, tutorial with tags , , , , , , on April 30, 2013 by abhishekkr

tekwalk.blogspot.com [8/Mar/2013]

http://tekwalk.blogspot.in/2013/03/make-rvmsudo-using-running-users-env.html

…..

While running ‘rvmsudo chef-solo ….’, it picks desired user but because of $HOME inference in the ‘nvm/install.sh’ still the HOME value got picked for ‘/root’. It messed up the situation.

To fix it, and any certain issues around permission which might occur… using

rvmsudo USER=$USER HOME=$HOME chef-solo -j….

it’s working with desired output.

Though…..

…click here to read full post

Advertisements

[just.few.tuts] MessQ : message queue for quickly trying any idea

Posted in Blogroll, tutorial with tags , , , , , , , , on April 30, 2013 by abhishekkr

justfewtuts.blogspot.com [3/Feb/2013]

http://justfewtuts.blogspot.in/2013/02/messq-message-queue-for-quickly-trying.html

Past some time while trying up some set-up based on Message Queue at infrastructure… needed a quick to set-up, localhost friendly, network available Message Queue service to try out ideas.
So here is Mess(age)Q(ueue). Something quickly thrown together. Would work later to get it more performance oriented, good to go with smaller projects.

@GitHub:       https://github.com/abhishekkr/messQ
@RubyGems: https://rubygems.org/gems/messQ
_________________________

A Quick Tryout

[+] Install
$ gem install messQ –no-ri –no-rdoc
[+] Start Server (starts at 0.0.0.0 on port#5566)

$ messQ –start
[+] Enqueue user-id & home value to the Queue
$ messQ -enq $USER
$ messQ –enqueue $HOME

[+] Dequeue 2 values from Queue

$ messQ -deq
$ messq –dequeue
[+] Stop Server
$ messQ –stop
_________________________

Via Code….

…click here to read full post

[a.Bionic] auto-download all videos of any Event at Confreaks.com

Posted in ABK Labs with tags , , , , , , , , , on November 28, 2012 by abhishekkr

@ abionic.blogspot.in [27/Nov/2012]

http://abionic.blogspot.in/2012/11/auto-download-all-videos-of-any-event.html

Auto-Download all smallest size Videos of any provided Event in Confreaks.com

to install it either run
$ sudo curl -L -o /etc/profile.d/ddl-confreaks.sh https://gist.github.com/raw/4137843/e6c6c93ef1c4cbf4cb735de821b74fcec467c170/gistfile1.sh

or copy+paste the shell function below in your shell-load-conf file.

suppose the event resides at URL:
http://confreaks.com/events/rubyconf2012

and you just need to run
$ ddl-confreaks rubyconf2012 ~/Downloads

and it will download all Talk Videos from Ruby Conference 2012 at your ~/Downloads directory…

…..click here full post

[just.few.tuts] ci-go-nfo v0.0.1 : console util for ThoughtWorks’ Go CI Server

Posted in AbhishekKr, tutorial with tags , , , , , , , , , , , on October 5, 2012 by abhishekkr

justfewtuts.blogspot.in [19/Sep/2012]

http://justfewtuts.blogspot.in/2012/09/ci-go-nfo-v001-console-util-for.html

Just a rubygem console utility to get focussed INFO about your Go Continuous Integration pipeline easily, no more switching again to browsers.

@RubyGemshttps://rubygems.org/gems/ci-go-nfo

@GitHub:  https://github.com/abhishekkr/ci-go-nfo

Installation 
$ gem install ci-go-nfo

Usage Ci-Go-Nfo ver.0.0.1
to set-up credential config for your go-ci
ci-go-nfo setup
it asks for
(a.) the location where you want to store your configuration file
(b.) the URL for your Go Server like http://my.go.server:8153
(c.) then username and password (create a read-only a/c for it)

to show go-ci info of all runs
ci-go-nfo

to show go-ci info of failed runs
ci-go-nfo fail

to show go-ci info of passed runs
ci-go-nfo pass

…..click here for full post

[tekwalk] Creating RPM of MCollective for Ruby1.9

Posted in AbhishekKr, Blogroll, tutorial with tags , , , , , , , , , on July 10, 2012 by abhishekkr

tekwalk.blogspot.in [11/June/2012]

http://tekwalk.blogspot.in/2012/06/mcollective-creating-rpm-for-ruby19.html

Clone the latest branch from GitHub repo for MCollective
$ git clone git://github.com/puppetlabs/marionette-collective.git

Removing Ruby 1.8 version specification from RedHat Spec
$ sed -i ‘s/.*ruby.abi.*//g’ ext/redhat/mcollective.spec

from the changes 11/Jun/2011 : marionette-collective/commit/ba86f7762d
the lines removed by above command are
BuildRequires: ruby(abi) = 1.8
Requires: ruby(abi) = 1.8

Removing Rubygem…..

…..click here to read full post

[just.few.tuts] rss-motor v0.0.4 ~ a rubygem to ease up your RSS interactions

Posted in AbhishekKr, Blogroll, tutorial with tags , , , , , , , , on July 10, 2012 by abhishekkr

@ justfewtuts.blogspot.in [8/June/2012]

http://justfewtuts.blogspot.in/2012/06/rss-motor-v004-rubygem-to-ease-up-your.html

started a new rubygem project ‘rss-motor’ (http://rubygems.org/gems/rss-motor) to aid all RSS consuming code by providing the entire (or filtered as per choice) of feeds as Array of Hash values per Feed Item…..

 

Here is just a mini HowTo easily power you code with rss-motor:
First, obviously you’ll need to install the gem

$  gem install rss-motor

or if luckily you…..

…..click here to read full post

[tekwalk] [puppet] quick PuppetMaster Service Script

Posted in Uncategorized with tags , , , , , , , , , , , on July 3, 2012 by abhishekkr

tekwalk.blogspot.com [25-April-2012]

http://tekwalk.blogspot.in/2012/04/quick-puppetmaster-service-script-for.html

#!/usr/bin/env ruby
module PuppetMaster
  def self.puppetmaster_cmd
   ‘puppet master –debug –verbose’
  end
  def self.start
    puts “Starting Puppet Master in Debug+Verbose+Daemon mode logging to /var/log/puppet/a.log”
    puts “Started.” if system(“#{puppetmaster_cmd} >> /var/log/puppet/a.log”)
  end
  def self.stop
    puppet_master_ps = %x{ps aux | grep -e ‘#{puppetmaster_cmd}’ | grep -v grep}
    puppet_master_pid = puppet_master_ps.split[1]
    if system(“kill -9 #{puppet_master_pid}”)
      puts “PuppetMaster with pid:#{puppet_master_pid} has been killed.”
    else
      puts “Failure killing PuppetMaster with pid:#{puppet_master_pid}.”
    end
  end
  def self.status
    puppet_master_ps = %x{ps aux | grep -e ‘#{puppetmaster_cmd}’ | grep -v grep}
    puppet_master_pid = puppet_master_ps.split[1]
    if puppet_master_pid.nil?
      puts “No PuppetMaster found.”
    else
      puts “Running @ #{puppet_master_ps}”
    end
  end
end
case ARGV.first
when ‘start’
  PuppetMaster.start
when ‘stop’
  PuppetMaster.stop
when ‘restart’
  PuppetMaster.stop
  PuppetMaster.start
when ‘status’
  PuppetMaster.status
else
  puts <<-PMUSAGE
$service puppetmaster (start|stop|restart|status)
PMUSAGE
end