This file contains hidden or 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 express = require('express') | |
| , routes = require('./routes') | |
| , cache = require('connect-cache'); | |
| // all urls contains "cached" will be cached for 1min. e.g. /services/cached/list.json | |
| var app = module.exports = express.createServer( | |
| cache({rules: [ | |
| {regex: /\/cached\/.*/, ttl: 60 * 1000} | |
| ]}) |
This file contains hidden or 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
| mongodb 0.9.7 dependency break the "npm install connect-mongodb" installation on win32 platform. | |
| newer mongodb like 1.0.2 will fix this problem | |
| thanks | |
| npm ERR! error rolling back connect-mongodb@1.1.3 Error: ENOTEMPTY, rmdir 'C:\project\node_modules\connect-mongodb' | |
| npm ERR! Unsupported | |
| npm ERR! Not compatible with your operating system or architecture: mongodb@0.9.7 | |
| npm ERR! Valid OS: linux,darwin,freebsd | |
| npm ERR! Valid Arch: any |
This file contains hidden or 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
| @echo off | |
| set path=C:\Program Files (x86)\Git\bin;%path% | |
| git pull | |
| pause |
This file contains hidden or 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
| //中文字型 | |
| BaseFont.createFont('MHei-Medium', 'UniCNS-UCS2-H', BaseFont.NOT_EMBEDDED) | |
| //檔案加密 | |
| def stamper = new PdfStamper(reader, response.outputStream) | |
| stamper.setEncryption(null, OWNER, ~(PdfWriter.ALLOW_PRINTING|PdfWriter.ALLOW_COPY|PdfWriter.ALLOW_MODIFY_CONTENTS|PdfWriter.ALLOW_MODIFY_ANNOTATIONS), PdfWriter.ENCRYPTION_AES_128 | PdfWriter.DO_NOT_ENCRYPT_METADATA) |
This file contains hidden or 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 java.security.* | |
| import javax.crypto.* | |
| import javax.crypto.spec.* | |
| def source = new File('input.dat').text | |
| def cipher = Cipher.getInstance('DES') | |
| cipher.init(Cipher.ENCRYPT_MODE, SecretKeyFactory.getInstance('DES').generateSecret(new DESKeySpec('secret12'.getBytes('UTF-8')))) | |
| def target = cipher.doFinal(source.bytes).encodeBase64() |
This file contains hidden or 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
| println "Hello" |
This file contains hidden or 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
| #define TRIGPIN 10 | |
| #define ECHOPIN 13 | |
| #define LED1 8 | |
| #define LED2 9 | |
| long ping() { | |
| digitalWrite(TRIGPIN, LOW); | |
| delayMicroseconds(2); | |
| digitalWrite(TRIGPIN, HIGH); | |
| delayMicroseconds(10); |
This file contains hidden or 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
| <!-- | |
| Solve the PayPal error: | |
| paypal Data does not match input character set or default encoding. | |
| --> | |
| <input type="hidden" name="charset" value="UTF-8"> |
This file contains hidden or 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
| @Grab('net.sourceforge.nekohtml:nekohtml:1.9.16') | |
| def parser = new org.cyberneko.html.parsers.SAXParser() | |
| def page = new XmlParser(parser).parse('https://news.google.com/nwshp?hl=zh-TW&tab=wn') | |
| page.depthFirst().DIV.grep{ it.'@class'=='title' }.each { | |
| println it.A.SPAN.text() | |
| } |
This file contains hidden or 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
| n02.jpg 0.052 | |
| s10.jpg 0.037 | |
| n05.jpg 0.099 | |
| b02.jpg 0.110 | |
| b04.jpg 0.085 | |
| n04.jpg 0.088 | |
| n10.jpg 0.064 | |
| s04.jpg 0.028 | |
| n03.jpg 0.064 | |
| b03.jpg 0.066 |