Skip to content

Instantly share code, notes, and snippets.

View abhishekkr's full-sized avatar
:octocat:
update your licenses

AbhishekKr abhishekkr

:octocat:
update your licenses
View GitHub Profile
@abhishekkr
abhishekkr / geek.game
Created January 3, 2011 14:42
re-visiting github random repo link: https://github.com/repositories/random
github's random repo : https://github.com/repositories/random
loving playing this game
every re-visit gets you a new idea/project
GEEK.GAME
I.AM.LOVING.IT->LINK
@abhishekkr
abhishekkr / gist:2479100
Created April 24, 2012 11:59
just a quick PuppetMaster Service Script for gem installed puppet set-up
#!/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")
@abhishekkr
abhishekkr / puppet-module-sample.rb
Created July 8, 2012 12:33
Puppet Module ~ Code Sample Describing usage of manifests, templates, files, lib, specs, tests
http://justfewtuts.blogspot.com/2012/07/puppet-beginners-concept-guide-part-2.html
<tomcat-module>/manifests/install.pp
class <tomcat-module>::install {
package { 'tomcat6': ensure => 'installed', }
}
<tomcat-module>/manifests/configure.pp
class <tomcat-module>::configure {
<tomcat-module>::configure::war {
@abhishekkr
abhishekkr / term_color.rb
Created September 3, 2012 15:46
Making Terminal Ruby Apps ~ have a colored terminal output adding to verbosity
# get colored terminal output using these String methods
class String
def colortxt(txt, term_color_code)
"\e[#{term_color_code}m#{txt}\e[0m"
end
def bold; colortxt(self, 1); end
def thin; colortxt(self, 2); end
@abhishekkr
abhishekkr / git.pp
Created September 9, 2012 11:49
Puppet Module : No Code In Data ~ Externalize into Params Manifest
# $MODULEPATH/httpd/manifests/git.pp
class httpd::git {
include httpd::params
$is_cgi = $httpd::params::is_cgi
$path = $httpd::params::path
$url = $httpd::params::url
file {
@abhishekkr
abhishekkr / common.csv
Created September 9, 2012 12:07
Puppet Module : No Code In Data ~ Externalize Data into separately managed CSV files
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2. in line 1.
# $MANIFESTPATH/extdatadir/common.csv
httpd_conf_dir,/etc/httpd/conf.d
httpd_is_cgi,true
httpd_git_path,/var/www/git
httpd_git_url,/mygit
@abhishekkr
abhishekkr / git.pp
Created September 9, 2012 15:16
Puppet Module : No Code In Data ~ create Facts using URL, File or any System Computation
# $MODULEPATH/httpd/manifests/git.pp
class httpd::git {
file {
"${::conf_dir}/git.conf":
ensure => 'present',
content => template('httpd/mynode.conf.erb'),
}
}
@abhishekkr
abhishekkr / gist:3881708
Created October 12, 2012 21:44
linux service script for resque-scheduler
#!/bin/sh
#
# chkconfig: - 85 15
# description: resque-scheduler service script
#
app_name=$MY_APP_NAME
pidfile_sched="/var/run/$MY_APP_NAME-resque-sched.pid"
app_dir="/opt/$MY_APP_NAME"
@abhishekkr
abhishekkr / gist:4078239
Created November 15, 2012 11:44
foodcritic RakeTask that worked for me
require 'bundler/setup'
require 'foodcritic'
task :default => [:foodcritic]
task :foodcritic do
cookbooks = File.absolute_path(File.join File.dirname(__FILE__), 'cookbooks')
puts 'FoodCritic running...
would criticize if finds anything, not cycnical to blabber otherwise.'
@abhishekkr
abhishekkr / gist:4137843
Created November 24, 2012 00:39
shell.func-download-all-videos-of-any-event-on-CONFREAKS
# Usage Example: $ ddl-confreaks rubyconf2012 ~/Downloads/
# save it as /etc/profiles/ddl.confreaks.sh
##
## currently it checks for lowest resolution video mostly {640x360} and downloads it
function ddl-confreaks(){
if [ $# -ne 2 ];
then
echo 'Failed. Syntax: $> ddl-confreaks EVENT_NAME DOWNLOAD_PATH'
return