Skip to content

Instantly share code, notes, and snippets.

View jjasghar's full-sized avatar

JJ Asghar jjasghar

View GitHub Profile
# Description:
# Anyone can have voice or op
#
# Commands:
# hubot make me an op
# hubot make <name> an op
# hubot give me voice
# hubot give <name> voice
module.exports = (robot) ->
{
"chef_type": "environment",
"cookbook_versions": {},
"default_attributes": {
},
"description": "The 1+N environment",
"json_class": "Chef::Environment",
"name": "1+n environment",
"override_attributes": {
"openstack": {
#!/bin/bash
# collectd plugin to monitor passenger
# has better memory-requirement than a ruby script
# TODO: try writing it in c - if it makes a difference
HOSTNAME=`hostname -s`
PASSENGER_STATUS="/usr/local/bin/passenger-status"
PASSENGER_MEMORY_STATS="/usr/local/bin/passenger-memory-stats"
INTERVAL="${COLLECTD_INTERVAL:-10}"
PLUGIN_NAME="passenger_status"

This was a bit of a trick to get set up, so here it is for anyone who comes across it in search results.

ZNC User Account

  • Set up the account as usual (note the username and password)
  • Set the defualt buffer size to 0. Every time the bot reconnects after a crash, it would try to respond to the commands it hear or respond in the buffer, and might crash it again.
  • Go ahead and define a network and channel for your bot. Note the network name.
  • You should now see a "ghost" for your hubot connected.
  • Look at the ZNC user list. The hubot user will show 1 network, but 0 clients.
# Usage:
# 1. Drop this file into lib/capistrano/submodule_strategy.rb
# 2. Add the following to your Capfile:
# require 'capistrano/git'
# require './lib/capistrano/submodule_strategy'
# 3. Add the following to your config/deploy.rb
# set :git_strategy, SubmoduleStrategy
# 4. Add .capignore file and list each file or directory to exclude from deployment on a separate line. Example:
# .capignore
# lib
#!/bin/zsh
let num=${1%d*}
let die=${1#*d}
let result="$num*($[$RANDOM % $die]+1)"
print $result

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"

npm adduser

@jjasghar
jjasghar / evills
Created April 1, 2014 22:26 — forked from Eugeny/evills
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
__all__ = ["transform"]
__version__ = '0.3'
__author__ = 'Christoph Burgmer <[email protected]>'
__url__ = 'http://github.com/cburgmer/upsidedown'
namespace :roles do
desc 'dump roles defined in the Ruby DSL to json'
task :dump do
destination_dir = File.join(TOPDIR, '.chef', 'chef_server_backup')
files_paths = Dir["#{TOPDIR}/roles/*.rb"]
files_paths.each do |filename|
role_name = File.basename(filename, '.rb')
role = Chef::Role.new
[root@testing-sensu01 ~]# /opt/sensu/embedded/bin/ruby campfire_test.rb
/opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Faraday::Error::ConnectionFailed)
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:917:in `block in connect'
from /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:51:in `timeout'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:917:in `connect'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:861:in `do_start'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:850:in `start'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:1366:in `request'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:1125:in `get'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:73:in `perform_request'