View gist:88686477789bcd05385c73605ab3780e
def domain = model(com.foo.Bar)
domain.className == "FooBar"
domain.fullName == "com.foo.FooBar"
domain.packageName == "com.foo"
domain.packagePath == "com/foo"
domain.propertyName == "fooBar"
domain.lowerCaseName == "foo-bar"
View Grails 3 utf8mb4
applaction.yml
dataSource:
url: jdbc:mysql://127.0.0.1:3306/databases?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
my.cnf
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
View context.xml druid in Tomcat jndi
<Resource name="jdbc/druid-test"
auth="Container"
type="javax.sql.DataSource"
username="sa"
password="password"
driverClassName="net.sourceforge.jtds.jdbc.Driver"
factory="com.alibaba.druid.pool.DruidDataSourceFactory"
maxActive="3"
maxIdle="3"
maxWait="10000"
View druid monitor in Grails3
import com.alibaba.druid.support.http.StatViewServlet
import grails.boot.GrailsApp
import grails.boot.config.GrailsAutoConfiguration
import org.springframework.boot.context.embedded.ServletRegistrationBean
import org.springframework.context.annotation.Bean
class Application extends GrailsAutoConfiguration {
@Bean
View DruidDataSource in Grails3
// Place your Spring DSL code here
beans = {
dataSource(com.alibaba.druid.pool.DruidDataSource) {
url = "${grailsApplication.config.dataSource.url}"
username = "${grailsApplication.config.dataSource.username}"
password = "${grailsApplication.config.dataSource.password}"
maxActive = "${grailsApplication.config.dataSource.maxActive ? grailsApplication.config.dataSource.maxActive : "2"}"
filters = "stat"
validationQuery = "select 1"
View resources.groovy
import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
// Place your Spring DSL code here
beans = {
def config = application.config
println config
def dataSources = config.findAll {
pritnln it.key.toString()
it.key.toString().contains("dataSource")
View gist:293ddcc279051c1585d5
#!/bin/bash
date=`date +%Y-%m-%d`
RETENTION_PERIOD="7"
HEADER="Backup data"
remove_oldfiles(){
echo "Removing directory $1 files older than $RETENTION_PERIOD days" | wall
find $1 -type f -mtime +$2 -exec rm '{}' \;
}
BACKUPDIR="/disk0/svn_backup/001/"
View vagrant_coreos_docker.md

Vagrant + CoreOS + Dockerを利用した開発環境セットアップ

MacOSX + Vagrant + CoreOS + Docker + Ubuntuの環境。

2014年6月11日時点での情報。

  • Version: CoreOS 343.0.0
  • Kernel: 3.14.5
  • Docker: 1.0
View gist:8347351
set nocompatible
filetype off
filetype plugin indent off
set runtimepath+=$GOROOT/misc/vim
set encoding=utf-8
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
set tabstop=4
set shiftwidth=4
View benchmark.sh
#!/bin/bash
echo -e "\nbenchmark.sh -n<number of requests> -c<number of concurrency> <URL1> <URL2> ..."
echo -e "\nEx: benchmark.sh -n100 -c10 http://www.google.com/ http://www.bing.com/ \n"
## Gnuplot settings
echo "set terminal png
set output 'benchmark_${1}_${2}.png'
set title 'ab ${1} ${2}'