Skip to content

Instantly share code, notes, and snippets.

View tyama's full-sized avatar
💤

Tsuyoshi Yamamoto tyama

💤
  • newcast inc.
  • Tajimi,Japan
  • 17:46 (UTC +09:00)
View GitHub Profile
@Grab('pircbot:pircbot:1.4.2')
import org.jibble.pircbot.*;
def (host, port, channel) = ['<Server>', <Port>, '<Channel>']
def bot = [:] as PircBot
bot.name = 'groovy_bot'
bot.encoding = 'ISO-2022-JP'
bot.connect host, port
bot.joinChannel channel
@tyama
tyama / gist:624129
Created October 13, 2010 14:29 — forked from nobeans/gist:619325
// g100pon *9 Jakarta POI のGroovyサンプル
//
// usage: groovy sampleOfGExcelAPI.groovy <入力Excelファイル>
// 入力用に適当なExcelファイルを用意してください
// ----------------------------
// Grapeによるライブラリ取得
@GrabResolver(name="kobo-repo", root="http://github.com/kobo/maven-repo/raw/master/snapshot")
@GrabConfig(systemClassLoader=true) // for workaround a permgen problem with GroovyServ
@Grab("org.jggug.kobo:gexcelapi:0.2-SNAPSHOT")
/*
original "Translation IF/ELSE´s to Portuguese"
http://groovyconsole.appspot.com/script/278001
Translation IF/ELSE´s to Japanese
*/
/* DSL to conditional expressions in japanese */
もし = { exp, c ->
if (exp){
/*
original "Translation IF/ELSE´s to Portuguese"
http://groovyconsole.appspot.com/script/278001
Translation IF/ELSE´s to Japanese
*/
/* DSL to conditional expressions in japanese */
モシ = { exp, c ->
if (exp){
/*
Kiwanuji on JVM
http://kihwanujish.jottit.com/
*/
バブン = {println it}
シココケ = {a,b-> assert a==b}
バブン "オグモ ハイジ"
ラダ = "ゲボ"
シココケ(ラダ,"ゲボ")
def version = '1.3.7' //target version
def released = false
def sock
int interval = 120
for(;;){
if(!released){
sock = new Socket('dist.springframework.org.s3.amazonaws.com',80)
sock.withStreams{input,output->
output << "GET /release/GRAILS/grails-${version}.zip HTTP/1.1\r\n"
output << "Host: dist.springframework.org.s3.amazonaws.com\r\n"
@tyama
tyama / Example.groovy
Created September 22, 2011 10:59
load config in grails script
includeTargets << grailsScript("Init")
includeTargets << grailsScript("_GrailsPackage")
target(main: "The description of the script goes here!") {
compile()
createConfig()
println config
}
setDefaultTarget(main)
@tyama
tyama / readchat.groovy
Created September 23, 2011 09:15
pircbotx groovy example.
@Grab(group='org.pircbotx', module='pircbotx', version='1.5')
import org.pircbotx.PircBotX
import org.pircbotx.hooks.ListenerAdapter
def botName = "your_bot_name"
def serverName = "your.servername.com"
def channel = "#channel"
def bot = new PircBotX()
bot.name = bot.nick = bot.login = botName
@tyama
tyama / jggug_camp2011_tyama.groovy
Created November 5, 2011 05:31
自己紹介スクリプト(tyama)
def 自己紹介を= {a,b->println "それは \"@${b}\" だっ\n\n"},コードでやれと,無茶を言う人がいる='kazuchika'
def 致し方ないので自己紹介={a->println "こんばんわ tyamaです\ngrails.jp よろしくです";return ['頑張る':1]}
//code
自己紹介を コードでやれと, 無茶を言う人がいる
致し方ないので自己紹介 '*_*' 頑張る
@tyama
tyama / rentaro.groovy
Created November 5, 2011 09:12
きのくにやPiano
import javax.sound.midi.*
//thx to https://gist.github.com/250489
int ticks = 16
def addNote(track, pitch, start, duration=ticks, velocity=64) {
message = new ShortMessage()
message.setMessage(ShortMessage.NOTE_ON, pitch, velocity)
track.add(new MidiEvent(message, start))
message = new ShortMessage()
message.setMessage(ShortMessage.NOTE_OFF, pitch, velocity)