Skip to content

Instantly share code, notes, and snippets.

Avatar

Makoto Yamazaki zaki50

View GitHub Profile
View settings.xml
<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 Nov 24, 2010
JExcel API のサンプル
View JExcelSample.java
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 Dec 17, 2010
eclipse と ddms で logcat に ASCII外の文字を出すと化ける不具合の修正です。 tools_r8 ブランチ用
View fix_logcat_encoding.diff
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 Dec 24, 2010
OBBファイルをマウントした際の mount のオプションとか
View output_of_mount.txt
/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
View hudson_console_log
ユーザー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
View hudson_console_log.txt
ユーザー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
View 型パラメータのインスタンス作成
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;
}
View keygen.java
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 Feb 24, 2011
https なURLから マーケットを開く
View RedirectorActivity.java
/*
こんな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 Mar 3, 2011
コマンドの長さが127を超えると例外がスローされるので修正
View FeliCaLib-fix_RuntimeException_on_alloc.diff
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);
You can’t perform that action at this time.