Skip to content

Instantly share code, notes, and snippets.

@kazu634
kazu634 / gist:11399514
Created April 29, 2014 12:56
fluentd configuration file for LTSV format log file
####
## Output descriptions:
##
# Treasure Data (http://www.treasure-data.com/) provides cloud based data
# analytics platform, which easily stores and processes data from td-agent.
# FREE plan is also provided.
# @see http://docs.fluentd.org/articles/http-to-td
#
# This section matches events whose tag is td.DATABASE.TABLE
@kazu634
kazu634 / dstat.conf
Created May 31, 2014 04:08
Fluentd x Growthforecast
<source>
type dstat
tag dstat
option -cmln
delay 3
</source>
# GrowthForecast用にメッセージを加工する
<match dstat>
type copy
@kazu634
kazu634 / growthforecast-handler.rb
Last active August 29, 2015 14:11
sensu scripts
#!/opt/sensu/embedded/bin/ruby
require 'rubygems'
require 'json'
require 'growthforecast'
# constants
COLORS = {
"cpu" => {
"user" => "#FFBB7F",
@kazu634
kazu634 / gist:4616791afa459768ac1f
Created December 20, 2014 13:09
`peco` + `git ls-files`
# check whether `peco` exists
if which peco > /dev/null; then
function gim () {
# check whether the current directory is under `git` repository.
if git rev-parse 2> /dev/null; then
local selected_file=$(git ls-files . | peco)
if [ -n "${selected_file}" ]; then
vi ${selected_file}
fi
@kazu634
kazu634 / delete_graph.rb
Created January 15, 2015 14:19
Growthforecastで引数で与えた文字列と合致するservice_nameのグラフを一括削除するスクリプト
#!/opt/sensu/embedded/bin/ruby
require 'growthforecast'
# abort unless one argument is given:
abort unless ARGV.length == 1
str = ARGV[0]
# Create `Growthforecast` instance:
@kazu634
kazu634 / serf_agent.json
Created January 18, 2015 05:30
Serf Configuration File
{
"retry_join": [ "sensu.kazu634.lan" ],
"retry_interval": "30s",
"retry_max_attempts": 10,
"snapshot_path": "/home/kazu634/src/serf_snapshot.dat",
"rejoin_after_leave": true,
"leave_on_terminate": true,
"skip_leave_on_interrupt": true,
@kazu634
kazu634 / delete_graphs.rb
Last active August 29, 2015 14:15
`Serf`で管理していないノードのグラフを削除する
#!/opt/sensu/embedded/bin/ruby
require 'growthforecast'
# Create `Growthforecast` instance:
gf = GrowthForecast.new('localhost', 5125)
glist = gf.graphs()
glist.each do |graph|
#!/opt/sensu/embedded/bin/ruby
require 'open-uri'
require 'json'
END_POINT = 'http://localhost:4567/clients'
BASIC_AUTH = {:http_basic_authentication => ['admin', 'supersecret']}
response = open(END_POINT, BASIC_AUTH)
@kazu634
kazu634 / AutoUnattend.xml
Created August 31, 2015 15:05
AutoUnattend.xml for Windows2008r2.
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>en-US</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
;; 第1回 Scheme コードバトン
;;
;; ■ これは何か?
;; Scheme のコードをバトンのように回していき面白い物ができあがるのを楽しむ遊びです。
;; 次回 Shibuya.lisp で成果を発表します。
;; Scheme 初心者のコードを書くきっかけに、中級者には他人のコードを読む機会になればと思います。
;;
;; ■ 2 つのルール
;;
;; (1)自分がこれだと思える変更をコードに加えて2日以内に次の人にまわしてください。