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.gperfutils:gbench:0.4.2-groovy-2.3') | |
def r = benchmark { | |
def vs = [ 1, 2, 3, 4, 5, 6, 7, 8 ] | |
'Parallel Assignment' { | |
def (a, b, c, d, e, f, g, h) = vs | |
} | |
'Sequential Assignment' { | |
def a = vs[0] | |
def b = vs[1] |
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
111111111111111111111111111111111111111111111111111111111111100001111111111111111111 | |
111111111111111111111111111111111111111111111111111111111111000000011111111111111111 | |
111111111111111111111111111111111111111111111111111111111110000000011111111111111111 | |
111111111111111111111111111111111111111111111111111111111110000000001111111111100011 | |
111111111111111111111111111111111111111111111111111111111110000000001111111110000001 | |
111111111111111111111111111111111111111111111111111111111110000000001111111100000000 | |
111111111111111111111111111111111111111111111111111111111110000000001111111000000000 | |
111111111111111111111111111111111111111111111111110000111110000000001111111000000000 | |
111111111111111111111111111111111111111111111111000000011110000000000111110000000000 | |
111111111111111111111111111111111111111111111111000000011110000000000111110000000001 |
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
111111111111111111111111111111111111111111111111111111111111100001111111111111111111 | |
111111111111111111111111111111111111111111111111111111111111000000011111111111111111 | |
111111111111111111111111111111111111111111111111111111111110000000011111111111111111 | |
111111111111111111111111111111111111111111111111111111111110000000001111111111100011 | |
111111111111111111111111111111111111111111111111111111111110000000001111111110000001 | |
111111111111111111111111111111111111111111111111111111111110000000001111111100000000 | |
111111111111111111111111111111111111111111111111111111111110000000001111111000000000 | |
111111111111111111111111111111111111111111111111110000111110000000001111111000000000 | |
111111111111111111111111111111111111111111111111000000011110000000000111110000000000 | |
111111111111111111111111111111111111111111111111000000011110000000000111110000000001 |
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 static java.nio.ByteOrder.* | |
def bo = { | |
try { | |
// get the host byte order but not the jvm byte order | |
nativeOrder() == BIG_ENDIAN ? | |
'big endian' : 'little endian' | |
} catch (Error e) { | |
'unknown' | |
} | |
}() |
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
class Greeter { | |
def greet(who) { | |
"Hi, $who" | |
} | |
} |
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 repos() { | |
"""https://oss.sonatype.org/${ | |
project.version =~/.+SNAPSHOT/ ? | |
'content/repositories/snapshots' | |
: 'service/local/staging/deploy/maven2' }""" | |
} | |
project = [ version: '0.1.0' ] | |
assert repos() == 'https://oss.sonatype.org/service/local/staging/deploy/maven2' |
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
# key bindings | |
set-option -g prefix C-t | |
unbind-key C-b | |
bind-key C-t send-prefix | |
bind t select-window -n | |
bind T select-window -p | |
bind s split-window -v | |
bind v split-window -h |
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='snapshots', root='https://oss.sonatype.org/content/repositories/snapshots/') | |
@Grab('org.gperfutils:gprof:0.3.0-SNAPSHOT') | |
class Fib { | |
static def num(nth) { | |
nth < 2 ? nth : num(nth - 1) + num(nth - 2) | |
} | |
static void main(args) { |
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
#!/bin/bash | |
# OS specific support (must be 'true' or 'false'). | |
cygwin=false; | |
darwin=false; | |
solaris=false; | |
freebsd=false; | |
case "$(uname)" in | |
CYGWIN*) | |
cygwin=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
#!/bin/bash | |
source ~/.gvm/bin/gvm-init.sh | |
versions=(1.7.11 1.8.9 2.0.8 2.1.3) | |
for version in ${versions[*]} | |
do | |
echo -n "Install groovy v${version}" | |
gvm install groovy $version | |
done |