Skip to content

Instantly share code, notes, and snippets.

View lajunta's full-sized avatar
🌴
On vacation

lajunta lajunta

🌴
On vacation
View GitHub Profile
start on runlevel [2345] or net-device-up IFACE!=lo
stop on runlevel [06]
env PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/rvm/bin
chdir "/data/sites/festival"
script
rvm 2.0.0 exec bundle exec puma -C "/data/sites/festival/config/puma.conf"
end script
respawn
upstream festival {
server unix://tmp/festival.sock fail_timeout=0;
}
server {
listen 80;
server_name festival;
root /data/sites/festival/public;
access_log /var/log/nginx/festival_access.log;
error_log /var/log/nginx/festival_error.log;
location /logos/ {
pid /var/run/nginx.pid;
#user nginx nginx;
user nobody nogroup;
worker_processes 2;
events {
use epoll;
worker_connections 1024;
}
生成命令,/home/howl/.rvm/bin/bootup_puma:
rvm wrapper ruby-1.9.3-p125-perf bootup puma
创建Puma的配置文件,/etc/puma/puma.rb:
bind 'unix:///tmp/puma.sock'
pidfile '/tmp/puma.pid'
rackup '/home/howl/one/config.ru'
创建服务,/etc/init.d/puma:
execute pathogen#infect()
syntax on
filetype plugin indent on
set nu
set autoindent
set tabstop=2
set shiftwidth=2
set softtabstop=2
set smarttab
set expandtab
execute pathogen#infect()
syntax on
filetype plugin indent on
set nu
set autoindent
set tabstop=2
set shiftwidth=2
set softtabstop=2
set smarttab
set expandtab
---
gem: --no-ri --no-rdoc
:backtrace: false
:benchmark: false
:bulk_threshold: 1000
:sources:
- http://ruby.taobao.org/
:update_sources: true
:verbose: true
# This function cleans up messy HTML that was pasted by a user to a WYSIWYG editor.
# Specifically it also handles messy Word\Outlook generated HTML while keeping its original formattings.
require 'rubygems'
require 'sanitize'
def clean_up_document(html)
elements = %w[p b h1 h2 h3 h4 h5 h6 strong li ul ol i br div pre p]
attributes = {
'a' => ['href', 'title'],
@lajunta
lajunta / mongobackup
Created November 12, 2010 07:50
backup daily (rollover 7 days ) and monthly
#!/usr/bin/ruby
Dbpath = "/data/db" # database path
Backpath = "/backup/db" # backup directory
Host = "" # mongo host to connect,empty is for local
Database = "" # database to use. empty is for all
Collection = "" # collection to use
User = ""
Passwd = ""
Now = Time.now
DATE = Now.strftime("%Y-%m-%d")