Skip to content

Instantly share code, notes, and snippets.

View tmd45's full-sized avatar

Yoko TAMADA tmd45

View GitHub Profile
@tmd45
tmd45 / gist:1280671
Created October 12, 2011 08:45
get a file timestamp without --time-style (SunOS 5.10)
TIMESTAMP=`ls -E hoge.txt | sed -e 's/ */ /g' | cut -d " " -f 6-7 | cut -c 1-19`
echo $TIMESTAMP
@tmd45
tmd45 / gist:1293005
Created October 17, 2011 16:25
ERROR: port selfupdate
tmd45mba:~ tmd45$ port -v selfupdate
---> Updating MacPorts base sources using rsync
receiving file list ... done
rsync: mkstemp "/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/.base.tar.J70g50" failed: Permission denied (13)
sent 10864 bytes received 111 bytes 4390.00 bytes/sec
total size is 3226624 speedup is 294.00
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-40/rsync/main.c(1400) [generator=2.6.9]
shell command "/usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs" returned error 23
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: shell command failed (see log for details)
@tmd45
tmd45 / gist:1294154
Created October 17, 2011 23:16
Scala 2.9.1 Install done.
tmd45mba:~ tmd45$ scala -version
Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL
@tmd45
tmd45 / HelloWorld.scala
Created October 21, 2011 02:42
Hello, World of Scala
object HelloWorld {
def main(args:Array[String]):Unit = {
println("Hello, Scala World!")
}
}
@tmd45
tmd45 / ci_user_guide_da4b6b832fbde2fc7cfddd496d7373637e7a5f02.diff
Created November 1, 2011 16:09
CodeIgniter User Guide の差分(2011/11/2)
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 35946a2..11a1537 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -57,8 +57,6 @@ Change Log
<h1>Change Log</h1>
-<p>The <img src="images/reactor-bullet.png" width="16" height="16" alt="Reactor Marker" /> indicates items that were contributed to CodeIgniter via CodeIgniter Reactor.</p>
-
@tmd45
tmd45 / gist:1347057
Created November 8, 2011 05:09
Collections.sort
/*
* hogeList<Map<String, String>> を値の昇順にソートする
*/
Collections.sort(hogeList, new Comparator<Map<String, String>>() {
public int compare(
Map<String, String> hoge1,
Map<String, String> hoge2
) {
String val1 = hoge1.get("key");
String val2 = hoge2.get("key");
@tmd45
tmd45 / Test6.java
Created November 14, 2011 09:19
リストを好きな順番に並べ替えたい。要素数は可変。今回の場合は最初の3つだけ順番になってれば良いorz
package localtest;
import java.util.ArrayList;
import java.util.List;
public class Test6 {
/**
* @param args
*/
@tmd45
tmd45 / gist:1369167
Created November 16, 2011 03:34
MITライセンス表示文章の雛形(英語+日本語)
The MIT License
Copyright (c) {year} {copyright holders}
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH T
@tmd45
tmd45 / Example.java
Created March 7, 2012 10:58
no good source comment
package localhost;
public class Example {
/**
* ここにはとても気持ちの悪いコードが書いてあります。
  * 身体の弱い方、体調の優れない方が閲覧されないことをお勧めいたします。
*/
public static void main(String[] args) {
@tmd45
tmd45 / DevideString.java
Created June 1, 2012 13:33
Cutting by byte, MS932 character. After, insert this String to Oracle DB by jdbc, whereupon get ORA-12899
/** 分割開始インデックス */
static final int DIVISION_BYTE_START_INDEX = 0;
/** 分割後文字長 */
static final int DIVISION_BYTE_LENGTH_ADDR = 48;
/**
* 引数の文字列を[分割後文字長(byte)]以下にカットする。<br>
* 扱う文字コードは MS932 とする。
*
* @param str 文字列(MS932)