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
var fs = require('fs'), | |
cluster = require('cluster'); | |
var config = JSON.parse(fs.readFileSync(require('path').join(__dirname, 'config.json'))); | |
if (config.cwd && process.cwd() != config.cwd) process.chdir(config.cwd); | |
var workers = config.workers || require('os').cpus().length; | |
// 如有指定 log 檔,則將標準輸出和錯誤輸出寫到 log 檔 | |
if (config.log){ | |
var log_stream = fs.createWriteStream(config.log, {flags: 'a'}); |
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
(function () { | |
var hiresurl, | |
hiresimg; | |
hiresurl = function hiresurl (source) { return source.replace(/\/s\d+\//i, "/s0/"); }; | |
hiresimg = function hiresimg (){ | |
var imgs = document.getElementsByTagName("img"), | |
len = imgs.length, | |
img; |
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
IF "%GOCC_OLD_PATH%" NEQ "" GOTO restorepath | |
:savepath | |
ECHO save PATH to GOCC_OLD_PATH | |
SET GOCC_OLD_PATH=%PATH% | |
GOTO oldpathdone | |
:restorepath | |
ECHO restore PATH from GOCC_OLD_PATH | |
PATH %GOCC_OLD_PATH% |
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
# -*- coding: UTF-8 -*- | |
from flaskext.wtf import Form, TextField, PasswordField, RecaptchaField, \ | |
AnyOf, NoneOf, Regexp, Email, Required, EqualTo, Recaptcha | |
from wtforms.validators import StopValidation | |
from flask import request, session | |
import model | |
# 身份證字號格式驗證 | |
def check_ID(form, field): | |
locations = dict(zip([c for c in 'ABCDEFGHJKLMNPQRSTUVXYWZIO'], range(10,36))) |
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
var b = require('./b') | |
,c = require('./c'); | |
console.log(__filename, ":", c.msg); | |
console.log(__filename, ":", c === b.c); | |
console.log(__filename, ":", "delete require cache, and require c again"); | |
delete require.cache[require.resolve('./c')]; | |
c = require('./c'); |
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
import b, c | |
print __name__, ":", c.msg | |
print __name__, ":", c is b.c | |
print __name__, ":", "reload c" | |
reload(c) | |
print __name__, ":", c.msg | |
print __name__, ":", c is b.c |
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
i[class*="foundicon-"] { | |
font-style: inherit; | |
} | |
i[class*="foundicon-"]:before { | |
font-family: "GeneralFoundicons"; | |
} | |
i[class*="enclosed foundicon-"]:before { | |
font-family: "GeneralEnclosedFoundicons"; |
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
from gevent.monkey import patch_all | |
patch_all() | |
import argparse | |
from wsgidav.fs_dav_provider import FilesystemProvider | |
from wsgidav.version import __version__ | |
from wsgidav.wsgidav_app import DEFAULT_CONFIG, WsgiDAVApp | |
from gevent.pywsgi import WSGIServer | |
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
FROM ubuntu:latest | |
# install nodejs | |
ADD http://nodejs.org/dist/v0.10.20/node-v0.10.20-linux-x64.tar.gz /tmp/ | |
RUN cd /tmp && tar xzf node-v0.10.20-linux-x64.tar.gz --strip-components=1 -C "/usr" | |
# install git | |
RUN apt-get update && apt-get install -y git |
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
# RUN apt-get update && apt-get -y install build-essential | |
FROM mugen/ubuntu-build-essential:latest | |
# install redis | |
ADD http://download.redis.io/redis-stable.tar.gz /tmp/ | |
RUN cd /tmp && tar xzf redis-stable.tar.gz | |
RUN cd /tmp/redis-stable && make | |
RUN cd /tmp/redis-stable/src && cp redis-server /usr/bin/; cp redis-cli /usr/bin/ | |
# run redis server |
OlderNewer