This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/ruby/bin/ruby -w | |
Dbpath = "/data/db" # database path | |
Backpath = "/data/dbbackup" # 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -F | |
# 允许包从22端口进入 | |
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
# 允许从22端口进入的包返回 | |
iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT | |
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT | |
iptables -A INPUT -p udp --sport 53 -j ACCEPT | |
#允许本机访问本机 | |
iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT | |
iptables -A OUTPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
iptables -F | |
iptables -X | |
iptables -P INPUT DROP | |
iptables -P FORWARD DROP | |
iptables -P OUTPUT DROP | |
iptables -t nat -F | |
iptables -t nat -P PREROUTING ACCEPT | |
iptables -t nat -P POSTROUTING ACCEPT | |
iptables -t nat -P OUTPUT ACCEPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
Backpath = "/backup/apps/dljy" | |
Now = Time.now | |
DATE = Now.strftime("%Y-%m-%d") | |
Dom = Now.mday # Day of month | |
Dow = Now.wday # Day of week | |
M = Now.month # Month of the year | |
W = Now.strftime("%W") # Week of the year | |
Doweekly = 6 # Saturday |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PATH=/var/lib/gems/1.9.1/bin:/usr/local/mongodb/bin:/usr/bin | |
cd /usr/local/railsites/zcms | |
unicorn_rails -p 80 -E production -D | |
exit 0 | |
#stop | |
#!/bin/bash | |
pkill unicorn_rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
gem: --no-ri --no-rdoc | |
:backtrace: false | |
:benchmark: false | |
:bulk_threshold: 1000 | |
:sources: | |
- http://ruby.taobao.org/ | |
:update_sources: true | |
:verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer