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 rm () { | |
local path | |
for path in "$@"; do | |
# ignore any arguments | |
if [[ "$path" = -* ]]; then : | |
else | |
local dst=${path##*/} | |
# append the time if necessary | |
while [ -e ~/.Trash/"$dst" ]; do | |
dst="$dst "$(date +%H-%M-%S) |
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 com.jcraft.jsch.Channel | |
import com.jcraft.jsch.ChannelSftp | |
import com.jcraft.jsch.JSch | |
import com.jcraft.jsch.Session | |
import java.util.concurrent.TimeUnit | |
class Ssh { | |
JSch jsch = new JSch() |
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
def withAutoTimestampSuppression(entity, closure) { | |
toggleAutoTimestamp(entity, false) | |
try { | |
def result = closure() | |
return result | |
} finally { | |
toggleAutoTimestamp(entity, true) | |
} | |
} |
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 org.springframework.core.io.ByteArrayResource | |
def s = new File('/Users/ben/Documents/foo/index.gsp').withReader { reader -> | |
return reader.text | |
} | |
def resource = new ByteArrayResource(s.bytes) | |
def renderer = ctx.groovyPagesTemplateEngine | |
def template = renderer.createTemplate(resource, false) |
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 rm () { | |
local path | |
for path in "$@"; do | |
# ignore any arguments | |
if [[ "$path" = -* ]]; then : | |
else | |
local dst=${path##*/} | |
# append the time if necessary | |
while [ -e ~/.Trash/"$dst" ]; do | |
dst="$dst "$(date +%H-%M-%S) |
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
task runVertx(type: Exec, dependsOn: ['compileGroovy']) { | |
if (System.getProperty('debug')) { | |
environment 'VERTX_OPTS', '-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005' | |
} | |
ext.vertxClasspath = (sourceSets.main.runtimeClasspath.filter { !it.path.contains('groovy') }).asPath | |
def configFile = 'etc/conf.json' | |
commandLine 'vertx', 'run', 'src/MyVertxModule.groovy', '-conf', configFile, '-cp', "src/:$vertxClasspath" | |
} |
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.apache.kafka:kafka_2.10:0.8.1") | |
@GrabExclude("com.sun.jmx:jmxri") | |
@GrabExclude("javax.jms:jms") | |
@GrabExclude("com.sun.jdmk:jmxtools") | |
@GrabExclude("junit:junit") | |
import kafka.consumer.ConsumerConfig; | |
import kafka.consumer.ConsumerIterator; | |
import kafka.consumer.KafkaStream; | |
import kafka.javaapi.consumer.ConsumerConnector; |
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
package foo | |
@Grab('org.spockframework:spock-core:1.0-groovy-2.3') | |
import org.junit.runner.* | |
import spock.lang.Specification | |
import spock.util.EmbeddedSpecRunner | |
/* |
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 org.codehaus.groovy.runtime.StringGroovyMethods | |
use(EnumUtils1) { | |
println Foo.ONE.toString() | |
println "THREE" as Foo | |
println "123" as int | |
println "Three" as Foo | |
println "T" as Foo | |
} |
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
// grails -debug -DFOO=bar -Djava.awt.headless=true -Dapp.context=/ run-app | |
run { | |
if (project.hasProperty('debug') && project.property('debug') == 'true') { | |
def debugPort = project.hasProperty('debug.port') ? project.property('debug.port') : 5005 | |
def suspend = project.hasProperty('debug.suspend') ? project.property('debug.suspend') : 'y' | |
jvmArgs '-Xdebug', "-Xrunjdwp:transport=dt_socket,server=y,suspend=${suspend},address=${debugPort}" | |
} | |
} |
OlderNewer