Skip to content

Instantly share code, notes, and snippets.

View sawanoboly's full-sized avatar
🤷‍♂️
🙃

Yukihiko SAWANOBORI sawanoboly

🤷‍♂️
🙃
View GitHub Profile
@sawanoboly
sawanoboly / .mongorc.js
Created November 14, 2011 09:41
Sample .mongorc.js for replicaSets.
prompt = function() {
// set version
version = db.version();
// case mongos
if (rs.status().info == 'mongos') {
return rs.status().info + ':[' + version + '] > ';
}
// config or replica
@sawanoboly
sawanoboly / haproxy.cfg
Created November 15, 2011 10:28
mongos behind haproxy configuration.
global
daemon
user haproxy
group haproxy
log /dev/log daemon info
maxconn 4096
defaults
log global
option dontlognull
@sawanoboly
sawanoboly / repo.rb
Created December 9, 2011 01:19
add nagios-ppa | Chef-recipe
#
# Cookbook Name:: nagios
# Recipe:: repo
#
# Copyright 2011, sawanoboly
#
package "python-software-properties" do
#version ""
action :install
@sawanoboly
sawanoboly / compare_yaml_hash.rb
Created February 17, 2012 10:28
Compare keys in yaml files
def compare_yaml_hash(cf1, cf2, context = [])
case
when cf1.is_a?(Hash)
cf1.each do |key, value|
unless cf2.key?(key)
puts "Missing key : #{key} in path #{context.join(".")}"
next
end
@sawanoboly
sawanoboly / def_compare_yaml_hash.rb
Created February 20, 2012 07:03
config check for jenkins auto test.
def compare_yaml_hash(cf1, cf2, context = [])
case
when cf1.is_a?(Hash)
cf1.each do |key, value|
unless cf2.key?(key)
puts "Missing key : #{key} in path #{context.join(".")}"
raise "format error" #=> RuntimeError: format error
next
end
@sawanoboly
sawanoboly / install_pkg_func.sh
Created February 23, 2012 08:00
insatll packeage wrapper for SmartOS
# insatll packeage wrapper for SmartOS
# install function
install_pkg ()
{
echo -n "Installing $1... "
# RESULT=`pkgin -y install $1 | grep -xv "$1 is not available on the repository"`
RESULT=`pkgin -y install $1`
echo "$RESULT" | grep -x "$1 is not available on the repository" > /dev/null
if [ $? -eq 0 ]
#!/bin/bash
HOST=example.com
echo / | tr '\n' '\0' > httperf_list
wget -nv -r -l 1 http://$HOST/
find $HOST -type f | sed s@$HOST@@g | grep -v 'html$' | tr '\n' '\0' >> httperf_list
rm -rf $HOST
@sawanoboly
sawanoboly / etc_init.d_redis-server.sh
Created April 6, 2012 05:57
redis 2.4.x install
#!/bin/bash
cat >/etc/init.d/redis-server<<'EOFEOF'
#!/bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
@sawanoboly
sawanoboly / github_toepoch.sh
Created April 9, 2012 02:27
Check last commit on Github.
#!/bin/bash
date -d `curl -s -f https://github.com/hissy/kobe-it-fes/commits/master.atom | grep -o -m 1 -E '<updated>.+</updated>' | sed s@\</*updated\>@@g | cut -c1-19` +%s
@sawanoboly
sawanoboly / install.sh
Created April 12, 2012 02:10
Munin Plugin. "Check Number of Nagios3."
#!/usr/bin/env bash
curl -f -s https://raw.github.com/gist/2364272/f9a2cfd9bad80455d30ba5c9250db2a4aab6c8ea/monitoring_processes.sh -o /usr/local/bin/monitoring_processes
chmod +x /usr/local/bin/monitoring_processes
ln -f -s /usr/local/bin/monitoring_processes /etc/munin/plugins/
service munin-node reload