Skip to content

Instantly share code, notes, and snippets.

@kimukou
Created July 3, 2011 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimukou/1062256 to your computer and use it in GitHub Desktop.
Save kimukou/1062256 to your computer and use it in GitHub Desktop.
ghello選外
@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)
//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))
@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