Skip to content

Instantly share code, notes, and snippets.

Daisuke Takeuchi daicham

  • Tokyo, Japan
Block or report user

Report or block daicham

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
daicham / Vagrantfile
Created Jul 15, 2014
Vagrantfile for ec2
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "dummy"
config.vm.provider :aws do |aws, override|
daicham / gist:10253947
Last active May 31, 2019
SSH config for connecting to github and bitbucket over proxy
View gist:10253947
ProxyCommand "C:\Program Files\git\bin\connect.exe" -H %h %p
Port 443
IdentityFile C:\Users\hoge\.ssh\id_rsa
Port 443
IdentityFile C:\Users\hoge\.ssh\id_rsa
View gist:5596593
// 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="")
import org.jggug.kobo.gexcelapi.GExcel
def book =[0])
daicham / gist:4528511
Last active Jan 9, 2019
zip/unzip on Powershell (depends on Ionic.Zip.dll)
View gist:4528511
function zip ($zipFilePath, $targetDir) {
# load Ionic.Zip.dll
$encoding = [System.Text.Encoding]::GetEncoding("shift_jis") # 日本語のファイルを扱うために必要
$zipfile = new-object Ionic.Zip.ZipFile($encoding)
if (!(test-path (split-path $zipFilePath -parent))) {
mkdir (split-path $zipFilePath -parent)
daicham /
Last active Dec 10, 2015
Request Redmine SCM fetching by http on Python (Tested for Mercurial)
# usase:
# python projectname1, projectname2
import sys, httplib
REDMINE_HOST = 'localhost:3000'
URL = '/redmine/sys/fetch_changesets?id=%s&key=%s'
redmine_project_ids = sys.argv
redmine_project_ids.pop(0) # shift operation to reduce this command
daicham /
Created Jan 11, 2013
Request jenkins job by http on Python (Tested for Mercurial)
# usage:
# python jobname1, jobname2
import sys, httplib
JENKINS_HOST = 'localhost:8080'
URL = '/jenkins/job/%s/build?token=%s&cause=%s'
jenkins_job_ids = sys.argv
daicham / gist:4109527
Created Nov 19, 2012
A sample ruby code of executing SQL for Oracle
View gist:4109527
# encoding: utf-8
# Prerequisite:
# gem install ruby-oci8
require 'oci8'
def log(message)
puts "#{"%Y-%m-%d %H:%M:%S")} #{message}"
daicham / gist:3926165
Created Oct 21, 2012
Sample code of MongoDB Aggregtion query
View gist:3926165
// 日付とカウンタが入ったドキュメントのうち 2012/10/21 のみを時間別に count を集計するクエリ
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();
daicham / gist:2934926
Last active Oct 6, 2015
Redmine Backup Script by Groovy
View gist:2934926
//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",
daicham / gist:2145516
Created Mar 21, 2012
Print the directory structure and its actual size
View gist:2145516
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
Dir.glob("#{base_dir}*") do |file|
real_size = File.size file
size += compute_actual_size real_size
You can’t perform that action at this time.