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}'
View gist:6237795
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/srv/java
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/srv/tomcat
View jedi-daemon
#!/usr/bin/env perl
use 5.10.0;
use utf8;
use LWP::Simple;
use Encode 'encode';
use Encode::MIME::Header;
use File::Slurp 'slurp';
use Email::MIME;
use Email::Sender::Simple qw(sendmail);