Created
July 3, 2011 14:18
-
-
Save kimukou/1062256 to your computer and use it in GitHub Desktop.
ghello選外
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
@GrabResolver(name='msgpack',root='http://msgpack.org/maven2/') | |
@Grab("org.msgpack:msgpack:0.5.1-devel") | |
import org.msgpack.MessagePack | |
import static org.msgpack.Templates.* | |
src = 'Hello World' | |
//pack | |
raw = MessagePack.pack(src) | |
println raw | |
//unpack1 | |
println MessagePack.unpack(raw, TString) | |
//unpack2 | |
def dynamic = MessagePack.unpack(raw) | |
println dynamic.convert(TString) |
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
//enc | |
cipher = javax.crypto.Cipher.getInstance("Blowfish") | |
cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, new javax.crypto.spec.SecretKeySpec('groovybook' as byte[], "Blowfish")) | |
def encrypted =cipher.doFinal('Hello World' as byte[]) | |
println encrypted | |
//dec | |
cipher = javax.crypto.Cipher.getInstance("Blowfish") | |
cipher.init(javax.crypto.Cipher.DECRYPT_MODE, new javax.crypto.spec.SecretKeySpec('groovybook' as byte[], "Blowfish")) | |
println new String(cipher.doFinal(encrypted)) |
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
@Grab('org.seleniumhq.webdriver:webdriver-htmlunit:0.9.7376') | |
driver = new org.openqa.selenium.htmlunit.HtmlUnitDriver(); | |
driver.get("http://goo.gl/ICVRP"); | |
println driver.getTitle() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment