Skip to content

Instantly share code, notes, and snippets.

View MichinobuMaeda's full-sized avatar

Michinobu Maeda MichinobuMaeda

View GitHub Profile
@MichinobuMaeda
MichinobuMaeda / bunyan-mongoose.js
Last active June 25, 2017 03:39
how to store bunyan log stream into mongoose
const bunyan = require('bunyan')
const mongoose = require('mongoose')
const Schema = mongoose.Schema;
const Log = mongoose.model('Log', new Schema({
name: String,
hostname: String,
pid: Number,
level: Number,
msg: String,
@MichinobuMaeda
MichinobuMaeda / 15puzzle.html
Last active August 29, 2015 14:07
15 Puzzle
<!DOCTYPE html>
<!--
Copyright 2014 Michinobu Maeda.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@MichinobuMaeda
MichinobuMaeda / check_smtp_all.sh
Last active December 23, 2015 10:29
Nagios: check all smtp servers. If one of them is ok, return ok. Usage: check_smtp_all.sh host1 [host2 [...]]
#!/bin/bash
for TRG in $@
do
STT=`/usr/local/nagios/libexec/check_smtp -H $TRG`
if echo $STT | grep -q "SMTP OK"
then
echo $STT
exit 0
<!DOCTYPE html>
<!--
Copyright 2013 Michinobu Maeda.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>RGB Colors 2</title>
<script>
function onload() {
var c = document.getElementById("pane");
pane(c);
}
var notice = '\n' +
' Copyright 2013 Michinobu Maeda\n' +
'\n' +
' Licensed under the Apache License, Version 2.0 (the "License");\n' +
' you may not use this file except in compliance with the License.\n' +
' You may obtain a copy of the License at\n' +
'\n' +
' http://www.apache.org/licenses/LICENSE-2.0\n' +
'\n' +
' Unless required by applicable law or agreed to in writing, software\n' +
#!/bin/sh
set -e
ssh='ssh'
ec2din="ec2-describe-instances"
while [ $# -gt 0 ]; do
case $1 in
-*)
if [ -z "$2" ]; then
break