Skip to content

Instantly share code, notes, and snippets.

View moqada's full-sized avatar

Masahiko Okada moqada

View GitHub Profile
@moqada
moqada / fulcrum
Last active December 11, 2015 21:28
init script for fulcrum
# !/bin/sh
#
# chkconfig: 2345 80 30
# processname: fulcrum
# description: Fulcrum Unicorn process
PORT=5000
APP_ROOT=/home/fulcrum/fulcrum
UNICORN_PID=$APP_ROOT/tmp/unicorn.pid
@moqada
moqada / fulcrum.conf
Last active December 11, 2015 21:58
nginx config file for fulcrum
upstream fulcrum {
server 127.0.0.1:5000;
}
server {
listen 443;
server_name <MY_DOMAIN>;
root /home/fulcrum/fulcrum/public;
@moqada
moqada / add_user.py
Created January 30, 2013 09:34
Add LDAP user by csv
# -*- coding: utf-8 -*-
import os
import csv
tmpl = open('user.ldif').read()
fh_csv = open('users.csv')
PASSWD = os.environ['LDAP_PASSWD']
def add_user(row):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
*.rstなファイルを監視してSphinxをbuildするタスク
@see http://kshigeru.blogspot.jp/2013/02/sphinx-livereload.html
"""
import logging
from os import path
from subprocess import Popen, PIPE
from livereload.task import Task
import flask
app = flask.Flask(__name__)
def test_user_agent():
ua = 'MySuperBrowser; 0.1;'
app.test_request_context(
environ_base={'HTTP_USER_AGENT': ua}
)
# -*- coding: utf-8 -*-
import argparse
import csv
import json
import httpagentparser
import os
oss = {}
browsers = {}
#!/usr/bin/env bash
# 対象ホストとポートのリストを指定: ex. ('0.0.0.0:22' '1.1.1.1:22')
HOSTS=('<HOST>:<PORT>' '<HOST>:<PORT>')
RUNNING_HOSTS=()
# HipChat のRoom Notification Tokenを指定
HIPCHAT_TOKEN='<API_TOKEN>'
# HipChat の対象 Room ID を指定
HIPCAHT_ROOM_ID='<ROOM_ID>'
@moqada
moqada / fabfile.py
Last active August 29, 2015 14:02
Elastic Beanstalk 内の EC2 インスタンス一覧を生成する fabfile
# -*- coding: utf-8 -*-
import json
import boto
import boto.beanstalk
import boto.ec2
from fabric.api import task, puts
# Elastic Beanstalk の Applicaton 名
EB_APP_NAME = 'example-app'
# Elastic Beanstalk の リージョン名
@moqada
moqada / file0.txt
Created June 24, 2014 01:59
serverspec で Elastic Beanstalk をテストする ref: http://qiita.com/moqada/items/c62b5852c7654bb972c8
source 'https://rubygems.org'
gem 'serverspec'
gem 'rake'
@moqada
moqada / file2.txt
Created June 26, 2014 04:46
CoffeeScript で AngularJS のテストを書くときに気をつけること ref: http://qiita.com/moqada/items/ebc052415020f178ee76
Error: [ng:areq] Argument 'fn' is not a function, got $HttpProvider
http://errors.angularjs.org/1.3.0-beta.7/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20%24HttpProvider