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 print_tree(base_dir) | |
base_dir = base_dir + '/' unless base_dir.end_with? '/' | |
size = 0 | |
Dir.glob("#{base_dir}*/") do |dir| | |
#puts "entering #{dir}" | |
size += print_tree dir | |
end | |
Dir.glob("#{base_dir}*") do |file| | |
real_size = File.size file | |
size += compute_actual_size real_size |
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
//Dump from mysql | |
/* dump ファイルが文字化けしたので コマンドラインから sqldump したほうがよさそう | |
def mysqldump_process = "/path/to/mysqldump -u redmine -psecret redmine".execute() | |
new File("redmine.dump").withWriter { writer -> | |
writer << mysqldump_process.text | |
} | |
*/ | |
//Archive dump and attachedfiles | |
new AntBuilder().zip(destfile: "path/to/backup/redmine-backup." + new Date().format("yyyyMMddHHmmss") + ".zip", |
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
// 日付とカウンタが入ったドキュメントのうち 2012/10/21 のみを時間別に count を集計するクエリ | |
db.journal.group( | |
{ | |
//集計対象のドキュメント条件 | |
cond: { | |
created: {$gte: ISODate("2012-10-21 00:00:00"), $lt: ISODate("2012-10-22 00:00:00")} | |
}, | |
//集合キーを生成するための関数 | |
keyf: function(doc) { | |
var time = doc.created.getHours(); |
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
# アップデート | |
yum -y update | |
# Japanese Locale の設定 | |
yum -y groupinstall "Japanese Support" | |
sed -i.org -e "s/en_US.UTF-8/ja_JP.UTF-8/g" /etc/sysconfig/i18n | |
# JST タイムゾーンに変更 | |
rm -f /etc/localtime | |
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime |
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
var http = require('http'); | |
var fs = require('fs'); | |
var js2xmlparser = require('js2xmlparser'); | |
var search_url = 'http://search.maven.org/solrsearch/select?rows=20&wt=json&q=1:'; | |
// コマンドライン引数チェック | |
if (process.argv.length != 3) { | |
log("Usage `node mkmvn path/to/jar_list`"); | |
log("jar_list is required fciv output format"); |
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
require 'win32ole' | |
def each_meeting | |
ol = WIN32OLE.connect("Outlook.Application") | |
myNameSpace = ol.getNameSpace("MAPI") | |
folder = myNameSpace.GetDefaultFolder(9) # 9 は予定表 | |
#folder.Display | |
folder.Items.each do |meeting| | |
GC.start | |
yield meeting |
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
# usage: | |
# python jenkins.py jobname1, jobname2 | |
import sys, httplib | |
JENKINS_HOST = 'localhost:8080' | |
URL = '/jenkins/job/%s/build?token=%s&cause=%s' | |
JENKINS_AUTH_TOKEN = 'token' | |
CAUSE='Requested%20by%20Python' | |
jenkins_job_ids = sys.argv |
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
# usase: | |
# python redmine.py projectname1, projectname2 | |
import sys, httplib | |
REDMINE_HOST = 'localhost:3000' | |
URL = '/redmine/sys/fetch_changesets?id=%s&key=%s' | |
REDMINE_API_KEY = 'token' | |
redmine_project_ids = sys.argv | |
redmine_project_ids.pop(0) # shift operation to reduce this command |
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
// Proxy 設定は %USERPROFILE%\.groovy\preinit.bat に JAVA_OPTS として記述する。 | |
// ex.) | |
// set JAVA_OPTS=%JAVA_OPTS% -Dhttp.proxyHost=proxyserver -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username -Dhttp.proxyPassword=secret | |
// set JAVA_OPTS=%JAVA_OPTS% -Dhttps.proxyHost=proxyserver -Dhttps.proxyPort=8080 -Dhttps.proxyUser=username -Dhttps.proxyPassword=secret | |
@GrabResolver(name="kobo", root="https://repository-kobo.forge.cloudbees.com/release") | |
@Grab("org.jggug.kobo:gexcelapi:0.3") | |
import org.jggug.kobo.gexcelapi.GExcel | |
def book = GExcel.open(args[0]) |
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
# encoding: utf-8 | |
# | |
# Prerequisite: | |
# gem install ruby-oci8 | |
require 'oci8' | |
def log(message) | |
puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} #{message}" | |
end |