Skip to content

Instantly share code, notes, and snippets.

View doublemarket's full-sized avatar

Hayato Matsuura doublemarket

View GitHub Profile
@doublemarket
doublemarket / change-notif-host-all.sh
Last active October 10, 2015 12:28
notification stop/start script for nagios (all services on the host)
#!/bin/sh
# enable/disable all notifications for the host
# using Nagios external commands
NOW=`date +%s`
CMDFILE='/var/spool/nagios/cmd/nagios.cmd'
# enable notification for the host
f_enable() {
@doublemarket
doublemarket / change-notif-host-srv.sh
Last active April 19, 2016 17:46
notification stop/start script for nagios (specific service)
#!/bin/sh
# enable/disable specific service notifications for the host
# using Nagios external commands
NOW=`date +%s`
CMDFILE='/var/spool/nagios/cmd/nagios.cmd'
# enable notification for the host
f_enable() {
#!/bin/bash
#END STATUS
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=3
# snmpwalk command
SNMPWALK=/usr/local/net-snmp/bin/snmpwalk
@doublemarket
doublemarket / loadcache.sh
Last active December 15, 2015 18:49
データベース名を引数に渡すと、そのデータベース内のテーブルのインデックスをkey_bufferに読み込むシェルスクリプト。 MyISAMのテーブルでしか使えません。
#!/bin/sh
CMDNAME=$0
if [ $# -le 0 ] ;then
echo "Usage: $CMDNAME database database ..."
fi
shift `expr $OPTIND - 1`
for database in $@ ;do
@doublemarket
doublemarket / change-notif-hostgroup-all.sh
Last active August 11, 2017 21:09
notification stop/start script for nagios (all services on hosts in the hostgroup)
#!/bin/sh
# enable/disable all notifications for hosts
# in the hostgroup
# using Nagios external commands
NOW=`date +%s`
CMDFILE='/var/spool/nagios/cmd/nagios.cmd'
# enable notification for the hostgroup
@doublemarket
doublemarket / check-host-srv.sh
Created June 7, 2013 10:25
Force check specific service for the host
#!/bin/sh
# force check specific service for the host
# using Nagios external commands
NOW=`date +%s`
CMDFILE='/var/spool/nagios/cmd/nagios.cmd'
# check service for the host
f_check() {
@doublemarket
doublemarket / golang-stats-api-metrics.rb
Last active August 29, 2015 14:17
Sensu plugin to collect golang status via golang-stats-api-metrics
#! /usr/bin/env ruby
# encoding: UTF-8
# golang-stats-api-metrics
#
# DESCRIPTION:
# Get golang metrics with golang-stats-api-metrics
# https://github.com/fukata/golang-stats-api-handler
#
# OUTPUT:
# metric data
@doublemarket
doublemarket / chatwork.rb
Created July 10, 2015 12:03
チャットワークに通知(日本語)を投げるSensuハンドラ
#!/usr/bin/env ruby
#
# Sensu Handler: chatwork
#
# This handler script is used to send notifications to Chatwork rooms.
# Chatworkのルームに通知を投げるハンドラです。
#
# Input:
# @event - Event attributes.
# @event['action'] - Property to figure out the event type i.e. whether it is create or resolve.
@doublemarket
doublemarket / wordcount.rb
Last active October 31, 2015 13:53
Counting words in a web page and sorting them in order of frequency
require 'nokogiri'
require 'open-uri'
url = ARGV[0]
doc = Nokogiri::HTML(open(url))
all_words = doc.inner_text.split(/\s*[\W-[[:cntrl:]]]\s*/)
.reject{|w| /^(\d*|\w)$/ =~ w}
.map{|w| w.downcase}
.sort
@doublemarket
doublemarket / abbreviations.csv
Last active June 27, 2024 06:27
チャットなどで使われる略語、間投詞
略語 展開した文 日本語
afa as far as 〜の限り
afaict as far as I can tell 私の言える範囲だと
afaik as far as I know 私の知っている限り
afk away from keyboard 離席中、離席します
aiui as I understand it 私の理解では
ama ask me anything 何でも聞いて
atm at the moment, at this moment 今の所
awol absent without leave 無断欠勤
bbl be back later また戻ります