Skip to content

Instantly share code, notes, and snippets.

View kiy0taka's full-sized avatar
🔒

Kiyotaka Oku kiy0taka

🔒
View GitHub Profile
@orrsella
orrsella / init.d-script.sh
Last active August 2, 2020 05:43
Init.d Script
#!/bin/bash
START_SCRIPT={{ start_script }}
PID_FILE={{ pid_file }}
# ***********************************************
# ***********************************************
ARGS="" # optional start script arguments
DAEMON=$START_SCRIPT
@uehaj
uehaj / static typed markup builder
Created January 18, 2013 08:44
@DelegatesToを使った静的型チェックされるMarkupBuilderのようなものです。
import groovy.transform.*
class HtmlBuilder {
def html(@DelegatesTo(Html) Closure c) {
c.delegate = new Html()
println "<html>"; c(); println "</html>"
}
}
class Html {
def head(@DelegatesTo(Head) Closure c) {
c.delegate = new Head()
@mike-neck
mike-neck / gradleb.groovy
Last active December 10, 2015 10:09
gradleb - gradle builder for easy creating gradle build script
import groovy.transform.*
@ToString (includeNames = true)
class BuildGradle {
final StringWriter w = new StringWriter()
def plugins = []
void apply () {
plugins.each {
w << "apply plugin : '${it}'\n"
@irof
irof / 1.groovy
Created August 20, 2012 12:32
GStringの評価が遅延されてるように見えるケースの
// プログラミングGROOVY P69
list = ['x']
def gs = "$list ${list[0]}"
assert gs instanceof GString
assert gs == '[x] x'
list[0]='y'
assert gs == '[y] x'
@ohtake
ohtake / gist:3217143
Created July 31, 2012 13:44
JUC2012 slides

スライドと Togetter と日本語訳へのリンクは http://build-shokunin.org/juc2012/sessions/ にも載るようになったのでこの Gist はもうメンテナンスされないかも。

スライド

@Dierk
Dierk / build.gradle
Created October 7, 2011 22:43
build.gradle for setting up a new gradle-based project
apply plugin:'groovy'
apply plugin:'idea'
repositories { mavenCentral() }
dependencies {
groovy 'org.codehaus.groovy:groovy-all:1.8.2'
}
task makeDirs(description:'make all dirs for project setup') << {
@karmi
karmi / tagcloud.sh
Last active September 4, 2017 02:01
Simple tag cloud with ElasticSearch `terms` facet
# (Re)create the index
curl -X DELETE "http://localhost:9200/tagcloud"
curl -X PUT "http://localhost:9200/tagcloud"-d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'
@founddrama
founddrama / VersionComparator.groovy
Last active April 20, 2023 12:55
a version comparator (e.g., "1.0.2" < "1.0.10")
def versions = []
def f = new File('mock-version-tags.txt')
f.eachLine { versions << it }
def versionComparator = { a, b ->
def VALID_TOKENS = /._/
a = a.tokenize(VALID_TOKENS)
b = b.tokenize(VALID_TOKENS)
for (i in 0..<Math.max(a.size(), b.size())) {
import com.softsynth.jsyn.*
//groovy script for phone call
class DualToneMultiFrequency{
def num
def buf
SineOscillator high
SineOscillator low
AddUnit mixer
LineOut out