Skip to content

Instantly share code, notes, and snippets.

View yyuu's full-sized avatar
👽
Working from home

YAMASHITA, Yuu yyuu

👽
Working from home
View GitHub Profile
@yyuu
yyuu / core.clj
Created April 20, 2012 08:59
create route53 resource record with clojure and aws-sdk-java
(ns route53-create-record.core)
(import '(com.amazonaws.auth BasicAWSCredentials)
'(com.amazonaws.services.route53 AmazonRoute53Client)
'(com.amazonaws.services.route53.model GetHostedZoneRequest
ChangeResourceRecordSetsRequest
ChangeBatch
Change
ListResourceRecordSetsRequest
ResourceRecordSet
@yyuu
yyuu / copy_subdir.rb
Created April 18, 2012 09:42
a capistrano strategy to deploy sub-directory in repository with "copy" strategy
#!/usr/bin/env ruby
#
# a capistrano strategy to deploy sub-directory in the repository.
# this is a stuff like "remote_cache_subdir" strategy described in following page,
# but based on "copy" strategy of capistrano deploy recipe.
#
# http://stackoverflow.com/questions/29168/deploying-a-git-subdirectory-in-capistrano
#
require 'capistrano'
@yyuu
yyuu / pymysql.monitor.py
Created April 17, 2012 09:27
mon monitor plugin to test mysql services
#!/usr/bin/env python
from __future__ import with_statement
import contextlib
import logging
import MySQLdb
import optparse
import os
import sys
@yyuu
yyuu / pyfreespace.monitor.py
Created April 17, 2012 08:58
mon monitor plugin to free blocks/i-node on block devices
#!/usr/bin/env python
from __future__ import with_statement
import logging
import optparse
import os
import sys
def main(args):
parser = optparse.OptionParser("usage %prog [OPTIONS]", add_help_option=False)
@yyuu
yyuu / pyamqp.monitor.py
Created April 16, 2012 15:44
mon monitor plugin to test amqp server
#!/usr/bin/env python
from __future__ import with_statement
import logging
import optparse
import pika
import sys
import timeouts
import traceback
@yyuu
yyuu / pyhttp.monitor.py
Created April 6, 2012 16:00
mon monitor plugin to test http service
#!/usr/bin/env python
#
# pyhttp.monitor - mon monitor plugin to test http service
#
from __future__ import with_statement
import inspect
import logging
import optparse
import os
@yyuu
yyuu / pymemcached.monitor.py
Created April 6, 2012 15:35
mon monitor plugin to test memcached service
#!/usr/bin/env python
#
# pymemcached.monitor - mon monitor plugin to test memcached service
#
from __future__ import with_statement
import logging
import optparse
import os
import pylibmc
@yyuu
yyuu / pymsgpack-rpc.monitor.py
Created April 6, 2012 09:10
mon monitor plugin to test msgpack-rpc services
#!/usr/bin/env python
#
# pymsgpack-rpc.monitor - mon monitor plugin to test msgpack-rpc services
#
from __future__ import with_statement
import logging
import msgpack
import optparse
import os
@yyuu
yyuu / pyirc2.alert.py
Created April 5, 2012 16:59
mon alert plugin to send notice to irc
#!/usr/bin/env python
#
# pyirc2.alert - mon alert plugin to send alerts to irc server
#
from __future__ import with_statement
import contextlib
import irclib
import optparse
import os
@yyuu
yyuu / service2.alert.py
Created April 4, 2012 09:39
a mon's alert plugin to manage syvinit/upstart/daemontools services
#!/usr/bin/env python
#
# service2.alert - a mon's alert plugin to manage syvinit/upstart/daemontools services
#
# you have to permit mon user to run following commands via sudo without password.
#
# * /usr/sbin/service (for sysvinit)
# * /sbin/initctl (for upstart)
# * /usr/bin/svc (for daemontools)
# * /usr/bin/svstat (for daemontools)