Skip to content

Instantly share code, notes, and snippets.

View zaki50's full-sized avatar

Makoto Yamazaki zaki50

View GitHub Profile
<settings>
<profiles>
<profile>
<id>sign</id>
<properties>
<keystore>./test.keystore</keystore>
<storepass>hogehoge</storepass>
<keypass>hogehoge</keypass>
<alias>test</alias>
</properties>
@zaki50
zaki50 / JExcelSample.java
Created November 24, 2010 09:25
JExcel API のサンプル
public class JExcelSample {
public void sample(File inputFile) {
final Workbook masterBook = Workbook.getWorkbook(inputFile);
try {
for (Sheet sheet : masterBook.getSheets()) {
if (sheet == null) {
assert false : "null は無いはず。";
continue;
}
@zaki50
zaki50 / fix_logcat_encoding.diff
Created December 17, 2010 07:48
eclipse と ddms で logcat に ASCII外の文字を出すと化ける不具合の修正です。 tools_r8 ブランチ用
diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/MultiLineReceiver.java b/ddms/libs/ddmlib/src/com/android/ddml
index 24dbb05..f3d9412 100644
--- a/ddms/libs/ddmlib/src/com/android/ddmlib/MultiLineReceiver.java
+++ b/ddms/libs/ddmlib/src/com/android/ddmlib/MultiLineReceiver.java
@@ -51,7 +51,7 @@ public abstract class MultiLineReceiver implements IShellOutputReceiver {
if (isCancelled() == false) {
String s = null;
try {
- s = new String(data, offset, length, "ISO-8859-1"); //$NON-NLS-1$
+ s = new String(data, offset, length, "UTF-8"); //$NON-NLS-1$
@zaki50
zaki50 / output_of_mount.txt
Created December 24, 2010 09:15
OBBファイルをマウントした際の mount のオプションとか
/dev/block/loop0 /mnt/obb/443968eabe370a269a4f820df69824bb vfat ro,dirsync,nosuid,nodev,uid=10030,fmask=0227,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
ユーザーanonymousが実行
[workspace] $ /bin/sh -xe /Library/Tomcat/temp/hudson2161977023374287353.sh
+ echo /Users/zaki/.hudson/secrets/a3e0d4fc-c897-4ca1-9381-e51919ce2917
/Users/zaki/.hudson/secrets/a3e0d4fc-c897-4ca1-9381-e51919ce2917
+ cat /Users/zaki/.hudson/secrets/a3e0d4fc-c897-4ca1-9381-e51919ce2917/aa/bb.txt
secret!
Finished: SUCCESS
ユーザーanonymousが実行
[workspace] $ /bin/sh -xe /Library/Tomcat/temp/hudson2161977023374287353.sh
+ echo /Users/zaki/.hudson/secrets/a3e0d4fc-c897-4ca1-9381-e51919ce2917
/Users/zaki/.hudson/secrets/a3e0d4fc-c897-4ca1-9381-e51919ce2917
+ cat /Users/zaki/.hudson/secrets/a3e0d4fc-c897-4ca1-9381-e51919ce2917/aa/bb.txt
secret!
Finished: SUCCESS
class Klass<K> {
public static <K> Klass<K> create(Class<K> c) {
return new Klass<K>(c);
}
private final Class<K> clazz;
private Klass(Class<K> c) {
clazz = c;
}
final KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
kpg.initialize(new RSAKeyGenParameterSpec(2048, RSAKeyGenParameterSpec.F4));
Log.i("hamatz", "generating RSA key pair...");
final long start = SystemClock.uptimeMillis();
final KeyPair kp = kpg.generateKeyPair();
final long end = SystemClock.uptimeMillis();
Log.i("hamatz", "done: " + (end-start) + "ms.");
final RSAPrivateKey privkey = (RSAPrivateKey) kp.getPrivate();
final RSAPublicKey pubkey = (RSAPublicKey) kp.getPublic();
@zaki50
zaki50 / RedirectorActivity.java
Created February 24, 2011 03:43
https なURLから マーケットを開く
/*
こんなintent filter で
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https" android:host="market.android.com"/>
</intent-filter>
*/
protected void onResume() {
@zaki50
zaki50 / FeliCaLib-fix_RuntimeException_on_alloc.diff
Created March 3, 2011 23:13
コマンドの長さが127を超えると例外がスローされるので修正
Index: src/net/kazzz/felica/lib/FeliCaLib.java
===================================================================
--- src/net/kazzz/felica/lib/FeliCaLib.java (リビジョン 37)
+++ src/net/kazzz/felica/lib/FeliCaLib.java (作業コピー)
@@ -256,7 +256,7 @@
* @return byte[] このデータのバイト列表現を戻します
*/
public byte[] getBytes() {
- ByteBuffer buff = ByteBuffer.allocate(this.length);
+ ByteBuffer buff = ByteBuffer.allocate(this.length & 0xFF);