Skip to content

Instantly share code, notes, and snippets.

View tkatochin's full-sized avatar

かとちん tkatochin

View GitHub Profile
@tkatochin
tkatochin / gdata-deploy.sh
Created March 18, 2011 07:08
gdata-java-clientをダウンロードして全てのライブラリをデプロイするシェル。
#!/bin/sh
if [ $# -ne 3 ]; then
echo "usage...: $0 gdata-version repository-url repository-id"
echo "ex.) $0 1.43.0 http://mylocal-nexus/content/repositories/thirdparty deploy-thirdparty"
exit 1
fi
curl -O http://gdata-java-client.googlecode.com/files/gdata-src.java-$1.zip
unzip gdata-src.java-$1.zip
cd gdata/java/src
zip -r ../lib/sources.jar com
@tkatochin
tkatochin / working-summary.py
Last active September 30, 2015 03:43
Macのキーとマウスのログから日々の稼働開始〜終了時間を出力する
#!/usr/bin/python
# -*- coding: utf-8 -*-
# こちら↓の成果のログから稼働開始〜終了時間を出力する
# http://qiita.com/edvakf@github/items/721afa8d2e69c556ba64
import sys
import os
import glob
import datetime
from datetime import datetime, timedelta
@tkatochin
tkatochin / testgadget.xml
Created February 24, 2012 10:34
Googleカレンダーで使用すると週・月以外で落ちるサンプルガジェット
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="CanvasAndPrefSetSample" author="katochin">
<Require feature="setprefs"/>
<Require feature="views"/>
</ModulePrefs>
<UserPref datatype="hidden" display_name="test" name="testPref" />
<Content type="html" view="canvas">
<![CDATA[<!DOCTYPE html>
<head>
@tkatochin
tkatochin / __deploy_back.sh
Created February 24, 2012 10:45
自動的に認証しつつappgngineにGAE/Javaアプリをmvnビルド後にデプロイするシェル。詳細→ http://tkatochin.hatenablog.com/entry/2012/02/24/173853
#!/bin/sh
echo mvn -P $1 $2 $3 $4 $5 -DdownloadSources=true -Dgwt.compile.skip=true eclipse:eclipse package
mvn -P $1 $2 $3 $4 $5 -DdownloadSources=true -Dgwt.compiler.skip=true eclipse:eclipse package
RETVAL=$?
if [ $RETVAL -eq 0 ]
then(
expect -c "
set timeout -1
spawn appcfg.sh --email=$GAE_USER --passin backends update war
expect Password\ for\ $GAE_USER:\ ; send \"$GAE_PASS\r\"
@tkatochin
tkatochin / mvn
Created October 8, 2015 07:09
プロジェクトごとにローカルリポジトリを切り替えられることができるようにしたmvn
#!/bin/sh
export repo_path=
export ancestor=.
while [ "/" != "`cd $ancestor;pwd`" -a ! -d $ancestor/.m2/repository ]; do
export ancestor=../${ancestor}
done
if [ -d $ancestor/.m2/repository ]; then
export repo_path=`cd $ancestor/.m2/repository;pwd`
else
@tkatochin
tkatochin / isUsingMultiAccounts.js
Created September 4, 2013 10:26
Googleアプリにスクリプトレットなどで流し込んで、マルチアカウントユーザーか否かを判断する
// to be loaded AddToStringPrototypeStartsWithAndEndsWith.js
isMultiLogoned = function () {
tags = document.getElementsByTagName("a");
for (var i = 0; i < tags.length; i++) {
if (tags[i].rel == "noreferrer") {
if (tags[i].href != "" && (tags[i].href.indexOf("&authUser=") || tags[i].href.indexOf("?authUser="))) {
return true;
}
}
}
@tkatochin
tkatochin / AddToStringPrototypeStartsWithAndEndsWith.js
Last active December 22, 2015 06:59
Stringの startsWith, endsWith
String.prototype.startsWith = function(prefix) {
return this.lastIndexOf(prefix, 0) == 0;
};
String.prototype.endsWith = function(suffix) {
return this.lastIndexOf(suffix) == this.length-suffix.length;
}
@tkatochin
tkatochin / JSONP special
Created September 10, 2013 05:13
NeoCatさんの「JSONPのエラー検知(&リトライ)可能版。」いいね! http://d.hatena.ne.jp/NeoCat/20110206/1296934235 ※charset=utf-8だけ足した。
// Thanks NeoCat http://d.hatena.ne.jp/NeoCat/20110206/1296934235
window.xds = {
load: function(url, callback, onerror, retry, callback_key) {
var ifr = document.createElement("iframe");
ifr.style.display = "none";
document.body.appendChild(ifr);
var d = ifr.contentWindow.document;
var cnt = 0;
ifr[ifr.readyState/*IE*/ ? "onreadystatechange" : "onload"] = function() {
if (this.readyState && this.readyState != 'complete' || cnt++) return;
@tkatochin
tkatochin / pf2gwtcnst.sh
Created December 28, 2015 07:00
Create java file for constants interface for GWT from property file
#!/bin/sh
allargs=$@
extendsType=com.google.gwt.i18n.client.Constants
if [[ $allargs == *"--extends="* ]]; then
echo " --extends=constants-class-name Constantsの拡張クラスを指定できます。指定がない場合はConstantsになります。"
extendsType=`echo $allargs | sed -e "s/.*--extends=\\([a-zA-Z0-9_.]*\\).*/\\1/g"`
allargs=`echo $allargs | sed -e "s/\\(.*\\)\\(--extends=[a-zA-Z0-9_.]*\\)\\(.*\\)/\\1\\3/g"`
fi
@tkatochin
tkatochin / install_appengine-java-sdk.sh
Last active February 3, 2016 11:58
GAEのSDKを自動ダウンロードして展開するスクリプト (Mac)
#!/bin/sh
if [ -z $1 ]; then
echo パラメータに appengine sdkのバージョンを指定してね!
exit 1
fi
DRYRUN=
if [ $1 = --dry-run ]; then
shift
DRYRUN=on
fi