Skip to content

Instantly share code, notes, and snippets.

@kkurahar
kkurahar / app.js
Last active October 11, 2016 14:24
Node.js + Express(Jade) + MongoDB(mongose + connect-mongo) でログイン認証機能を実装
/**
* Module dependencies.
*/
var express = require('express'),
routes = require('./routes'),
http = require('http'),
path = require('path'),
MongoStore = require('connect-mongo')(express);
@kkurahar
kkurahar / bot
Last active May 24, 2016 13:58
Hubotの自動更新用スクリプト。 foreverの自動起動機能を利用して利用する想定。 $ /path/to/hubot/bin/bot start
#!/bin/sh
export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"
##export HUBOT_LOG_LEVEL="debug"
## HipChat
export HUBOT_HIPCHAT_TOKEN=""
export HUBOT_HIPCHAT_JID=""
export HUBOT_HIPCHAT_PASSWORD=""
##export HUBOT_HIPCHAT_ROOMS=""
@kkurahar
kkurahar / aws_cloudformation.coffee
Last active January 1, 2016 14:19
HipChat + Hubot + CloudFormationで環境構築の自動化
# Dependencies:
# "aws2js": "0.6.12"
# "underscore": "1.3.3"
#
# Configuration:
# HUBOT_AWS_ACCESS_KEY_ID
# HUBOT_AWS_SECRET_ACCESS_KEY
# HUBOT_AWS_REGIONS
# HUBOT_AWS_KEYNAME
# HUBOT_AWS_HOSTZONE
@kkurahar
kkurahar / ec2.php
Last active December 28, 2015 13:29
ssh connect to EC2(AWS) from PHP(FuelPHP) http://kkurahar.github.io/blog/2013/11/16/php-ssh-ec2/
<?php
return array(
'ssh_key' => 'your_keypair_file', // /path/to/key.pem
'ec2_host' => 'your_ec2_ipaddress', // 54.251.xx.xx
'ec2_user' => 'your_ec2_user', // ec2-user
}
@kkurahar
kkurahar / client.php
Last active December 22, 2015 19:39
FuelPHP + Amazon SES マルチバイト対応 http://kkurahar.github.io/blog/2013/09/11/fuelphp-aws-ses/
<?php
// Include the SDK using the Composer autoloader
require_once(APPPATH . "vendor/aws-2.0/autoload.php");
// Include the Mail_MIME
require_once("Mail/mime.php");
use Aws\Common\Aws;
use Aws\Common\Enum\Region;
use Aws\Ses\Exception\SesException;
@kkurahar
kkurahar / default.rb
Created May 14, 2013 02:21
chef recipe for `Jenkins` platforms are supported: `Amazon Linux` [Jenkinsをインストールして 、http 8080で接続確認するところまでのレシピです。]
#
# Cookbook Name:: jenkins
# Recipe:: default
#
# Copyright 2013, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
repo_url = 'http://pkg.jenkins-ci.org/redhat/jenkins.repo'
@kkurahar
kkurahar / td-agent.conf
Created May 9, 2013 15:44
td-agnet + fluent-plugin-filter
<source>
type forward
port 24224
bind 0.0.0.0
</source>
## include
include conf.d/*.conf
<match td.nginx.access>
@kkurahar
kkurahar / default.rb
Created May 9, 2013 15:37
chef recipe for phpmyadmin. platforms are supported: Amazon Linux.
rpmforge_file = "rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm"
execute 'get rpmforge packege' do
cwd '/tmp'
command "wget http://pkgs.repoforge.org/rpmforge-release/#{ rpmforge_file }"
not_if { ::File.exists?("/tmp/#{ rpmforge_file }") }
end
rpm_package "#{ rpmforge_file }" do
action :install