Skip to content

Instantly share code, notes, and snippets.

# How to install Ruby on Rails on Ubuntu 10.04 (Server) Lucid Lynx
# ---
# Disclaimer: This are my own install of ruby env / rails steps. They work in my setups.
# Tested on x32 & x64 fresh copies of Ubuntu 10.04 server.
# ---
# TODO: add rvm/rails3 version of this steps
# ---
# you definitely want git installed ;)
sudo apt-get install git-core
# install ruby env
@alvin2ye
alvin2ye / nginx.sh
Created December 17, 2010 14:08 — forked from marshluca/nginx.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@alvin2ye
alvin2ye / backup.rake
Last active September 24, 2015 19:58 — forked from RobinWu/backup.rake
backup.rake for rails 1.2.x
require 'fileutils'
require 'enumerator' # support rails 1.2.5
require 'date'
namespace :backup do
desc 'crontab -e'
task :crontab do
puts <<-CRONTAB
m(0-59) h(0-23) d(1-31) m(1-12) w(0-6 0=Sunday) command
0 3 * * * cd /var/www/<project> && /usr/bin/rake backup:log:analyze APIKEY=* RAILS_ENV=production > /dev/null 2>&1
@alvin2ye
alvin2ye / .bashrc
Created February 22, 2011 06:34 — forked from julienXX/.bashrc
# Colors ----------------------------------------------------------
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
alias ls='ls -G' # OS-X SPECIFIC - the -G command in OS-X is for colors, in Linux it's no groups
#alias ls='ls --color=auto' # For linux, etc
@alvin2ye
alvin2ye / pptpd.sh
Created May 31, 2011 04:38 — forked from yinhm/pptpd.sh
Automaticlly install pptpd on Amazon EC2 Amazon Linux
# Automaticlly install pptpd on Amazon EC2 Amazon Linux
#
# Ripped from http://blog.diahosting.com/linux-tutorial/pptpd/
# pptpd source rpm packing by it's authors
#
# WARNING:
# first ms-dns setting to 172.16.0.23, 172.16.0.23 was showing on my
# /etc/resolv.conf, I'm not sure this is the same on all Amazon AWS zones.
#
# You need to adjust your "Security Groups" which you are using too.
#!/bin/bash
sudo apt-get -y install dialog
DIALOG=${DIALOG=dialog}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
$DIALOG --backtitle "请选择您要安装的选项" \
--title "专业系统安装" --clear \
@alvin2ye
alvin2ye / rails_template_for_mongoid.rb
Created June 11, 2012 01:40 — forked from huacnlee/rails_template_for_mongoid.rb
A custom Rails template for Mongoid.
# coding: utf-8
# This is a Rails init template with MongoDB projects
#
# Mongoid, Devise, Bootstrap, jQuery, Redis, Cells, will_paginate, Carrierwave, simple_form, Settingslogic, Thin
#
# Usage
#
# $ rails new app_name -m https://raw.github.com/gist/2168014
#
# run with: god -c /path/to/config.god [add -D if you want to not-deamonize god]
# This is the actual config file used to keep the delayed_job running
APPLICATION_ROOT = "/var/www/application"
RAILS_ENV = "production"
God.watch do |w|
w.name = "delayed_job_production"
w.interval = 15.seconds
w.start = "/bin/bash -c 'cd #{APPLICATION_ROOT}/current; /usr/bin/env RAILS_ENV=#{RAILS_ENV} #{APPLICATION_ROOT}/current/script/delayed_job start > /tmp/delay_job.out'"
@alvin2ye
alvin2ye / .gemrc
Last active December 19, 2015 23:49 — forked from hamakn/.gemrc
# curl -sL https://gist.github.com/alvin2ye/6037403/raw/.gemrc > ~/.gemrc
gem: --no-ri --no-rdoc
:sources:
#- http://rubygems.org/
- http://production.s3.rubygems.org/
; Summary: Proxy Switchy! Exported Rule List
; Date: Sunday, May 15, 2011
; Website: http://bit.ly/proxyswitchy
#BEGIN
[wildcard]
*://192.168.1.*
*://www.amazon.com/*
*://www.bbc.co.uk/*