Skip to content

Instantly share code, notes, and snippets.

View zaki50's full-sized avatar

Makoto Yamazaki zaki50

View GitHub Profile
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);
@zaki50
zaki50 / skype_for_au.log
Created April 16, 2011 07:03
skype for au(com.skype.android.kddi) での結果
$ cd /data/data/com.skype.android.kddi/files
$ cat shared.xml
shared.xml: No such file or directory
$ cat ★skypeid★/main.db
★skypeid★/main.db: No such file or directory
$
@zaki50
zaki50 / install-all.sh
Created May 20, 2011 06:04
install-all.sh
#!/bin/sh
# 対象アプリのパッケージ名。 org.zakky.memopad とか
pkgname="$1"
# 対象アプリの apk。 bin/MemoPad.apk とか
apkpath="$2"
for i in $(adb devices |grep -v "List of devices" | awk '{print $1;}'); do adb -s $i shell pm uninstall -k "$pkgname"; adb -s $i install "$apkpath"; done
package org.zakky.queue;
import android.app.Activity;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import java.util.List;
@zaki50
zaki50 / gist:1034022
Created June 19, 2011 09:51
XLarge判定
(context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
== Configuration.SCREENLAYOUT_SIZE_XLARGE
@zaki50
zaki50 / gist:1034403
Created June 19, 2011 15:18
config_xperia_arc.txt
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32.9
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_HARDIRQS=y
@zaki50
zaki50 / rpn
Created June 26, 2011 06:23
Main.java
package org.zakky.rpn;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;
public class Main {
public static void main(String[] args) throws Exception {
final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
package org.zakky.rpn;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.concurrent.TimeUnit;
public class Main {