Skip to content

Instantly share code, notes, and snippets.

View yuyalush's full-sized avatar

Yuya Yoshida yuyalush

View GitHub Profile
@yuyalush
yuyalush / iptables_setting
Created May 10, 2011 10:04
Build rails3-server in 15 minutes at NiftyCloud
# Generated by iptables-save v1.3.5 on Wed Apr 20 22:21:15 2011
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [82:10073]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j DROP
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
@yuyalush
yuyalush / mailSender
Created May 22, 2011 18:05
GoogleAppsSCript mailSender
function send() {
var EMAIL_SENT = "EMAIL_SENT";
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('setting');
var guests = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('list').getDataRange().getValues();
var title = sheet.getRange('B2').getValue();
var emailTemplate = sheet.getRange('B4').getValue();
@yuyalush
yuyalush / app.rb
Created June 20, 2011 10:33
Sinatra+Haml+Omniauth sample
# -*- encoding: UTF-8 -*-
require 'rubygems'
require 'sinatra'
require 'haml'
require 'omniauth'
set :haml, {:format => :html5}
enable :sessions, :logging
use OmniAuth::Builder do
@yuyalush
yuyalush / ReadMe
Created June 28, 2011 16:14
CrossDomain xhr test
Deploy
------------------------------
server1
app / controller / crosstest_controller.rb
app / view / crosstest / index.html.erb
app / view / crosstest / test.json.erb
server2
app / controller / application_controller.rb
app / controller / sample_controller.rb
@yuyalush
yuyalush / gist:1122101
Created August 3, 2011 07:30
Nginx install to NiftyCloud
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
yum install -y yum-utils pcre-devel libxslt-devel GeoIP-devel gd-devel rpm-build
yumdownloader --source nginx
rpm -ivh nginx-0.8.54-1.el5.src.rpm
sed -i 's/--with-file-aio/ /' /usr/src/redhat/SPECS/nginx.spec
rpmbuild -ba /usr/src/redhat/SPECS/nginx.spec
rpm -ivh /usr/src/redhat/RPMS/x86_64/nginx-0.8.54-1.x86_64.rpm
chkconfig nginx on
@yuyalush
yuyalush / nif_create.rb
Created August 28, 2011 01:50
Ruby1.9.2, Rails3, Sqlite3 and Create TestApp for CentOS
#!/usr/bin/env ruby
require 'rubygems'
require 'nifty'
require 'dozens'
require 'net/ssh'
NIFTY_ACCESS_KEY = "-----"
NIFTY_SECRET_KEY = "-----"
DOZENS_API_KEY = "-----"
@yuyalush
yuyalush / install_ab.sh
Created September 18, 2011 15:08
Install ApacheBench to CentOS5.6
yum -y install apr apr-util yum-utils
mkdir ~/httpd
cd ~/httpd
yumdownloader httpd
rpm2cpio httpd-2.2.3-53.el5.centos.1.x86_64.rpm | cpio -idmv
mv usr/bin/ab /usr/bin/ab
cd ~
rm -rf ~/httpd
ab http://google.ru/
@yuyalush
yuyalush / install_LNMP.sh
Created September 18, 2011 15:15
Install Nginx + php-fm + MySQL to CentOS5.6
#!/bin/bash
##################
# disable apache #
##################
service httpd stop
chkconfig httpd off
service xinetd stop
chkconfig xinetd off
service saslauthd stop
@yuyalush
yuyalush / setup_wordpress.sh
Created September 18, 2011 15:17
Install Wordpress3.2.1 on CentOS5.6
wget http://ja.wordpress.org/wordpress-3.2.1-ja.tar.gz
tar zxvf wordpress-3.2.1-ja.tar.gz
mv wordpress /var/www/html
cd /var/www/html/wordpress
mv wp-config-sample.php wp-config.php
echo "fix wp-config.php"
echo "mysql"
echo 'create database wordpress;'
#! /usr/bin/env ruby
# NIFTY Cloud API - DescribeInstances
# Author:: Kei HAMANAKA <kei.hamanaka (at) gmail.com>
# License:: Distributes under the same terms as Ruby
require 'uri'
require 'time'
require 'net/https'
require 'cgi'
require 'openssl'