Skip to content

Instantly share code, notes, and snippets.

@naoty
naoty / create_snapshot
Created January 4, 2012 06:59
create EBS snapshot
#!/bin/sh
volume="$1"
snapshot=`ec2-create-snapshot $volume | cut -f 2`
status="pending"
while [ "$status" = "pending" ]; do
sleep 300
status=`ec2-describe-snapshots $snapshot | cut -f 4`
done
@naoty
naoty / gist:1562930
Created January 4, 2012 23:58
history on Sakura VPS from OS install to ruby install
# login as root
naoty@local% ssh-keygen -R xxx.xxx.xxx.xxx
naoty@local% ssh [email protected]
# add admin user
root@sakura% useradd naoty
root@sakura% passwd naoty
# limit su, sudo
root@sakura% usermod -G wheel naoty
#!/bin/ruby
require "rubygems"
require "twitter"
Twitter.configure do |config|
config.consumer_key = "CONSUMER KEY"
config.consumer_secret = "CONSUMER SECRET"
config.oauth_token = "ACCESS TOKEN"
config.oauth_token_secret = "ACCESS TOKEN SECRET"
worker_processes 2
listen File.expand_path("tmp/sockets/unicorn.sock", ENV["RAILS_ROOT"])
pid File.expand_path("tmp/pids/unicorn.pid", ENV["RAILS_ROOT"])
stdout_path File.expand_path("log/unicorn.log", ENV["RAILS_ROOT"])
stderr_path File.expand_path("log/unicorn.log", ENV["RAILS_ROOT"])
upstream gitlabhq {
server unix:/home/naoty/gitlabhq/tmp/sockets/unicorn.sock;
}
server {
listen 80;
server_name repo.naoty.jp;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
user naoty naoty;
worker_processes 2;
worker_cpu_affinity 01 10;
events {
multi_accept on;
worker_connections 128;
}
http {
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: 345 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@naoty
naoty / Gemfile
Created February 12, 2012 07:14
Gemfile
source "http://rubygems.org"
gem "rails"
gem "unicorn"
gem "mysql2"
gem "devise"
gem "haml-rails"
gem "jquery-rails"
group :assets do
@naoty
naoty / application.css.scss
Created March 5, 2012 14:29
styles like railscasts
//= require_self
//= require_tree .
html {
background-color: #4B7399;
font-family: Verdana, Helvetica, Arial;
font-size: 14px;
}
body {
# 集合地プログラミングお勉強用コード
# テスト用データセット生成
# k0h3yさんが分身して映画をレビューするお
# データセットの値が毎回変わるし、検算するの面倒
#dataset = Hash.new
#["Kohey", "K0h3y", "Mr. Kohey", "St. Kohey", "Dr. Kohey"].each do |name|
# dataset.store(name, Hash.new)
# ["STAR WARS", "The Matrix", "The Shawshank Redemptation", "Before Sunrise", "The Notebook"].each do |tittle|
# dataset[name].store(tittle, rand(6).to_f)