Skip to content

Instantly share code, notes, and snippets.

@ishida
ishida / gist:2823064
Created May 29, 2012 07:12
echo YYYY-mm-dd HH:MM:SS.xxxxxx
echo "`date +"%Y-%m-%d %H:%M:%S"`.`perl -e 'use Time::HiRes qw(gettimeofday); my($sec,$microsec)=gettimeofday(); print $microsec . "\n";'`"
@ishida
ishida / gist:2823051
Created May 29, 2012 07:08
Measures time
#!/bin/bash
START_TIME=`date +%s`
# do something you want to measure time
END_TIME=`date +%s`
SS=`expr ${END_TIME} - ${START_TIME}`
@ishida
ishida / gist:2720364
Created May 17, 2012 17:25
private key in old jks + p7s -> p12 (UNTESTED)
$ keytool -importkeystore -srckeystore OLD_KEYSTORE.jks -destkeystore OLD_KEYSTORE.p12 -srcstoretype JKS -deststoretype PKCS12 -srcalias MY_ALIAS -destalias MY_ALIAS
$ openssl pkcs12 -in OLD_KEYSTORE.p12 -nocerts -nodes -out PRIVATE.key
$ openssl pkcs7 -in NEW_CERT.p7s -out NEW_CERT.cer -print_certs
$ openssl pkcs12 -export -in NEW_CERT.cer -inkey PRIVATE.key -out NEW_KEYSTORE.p12
@ishida
ishida / gist:2719996
Created May 17, 2012 16:27
jarsigner verify warning
警告:
この jar には、署名者の証明書が期限切れのエントリが含まれています。
@ishida
ishida / gist:2719990
Created May 17, 2012 16:26
verify jar certs using jarsigner
$ jarsigner -verbose -verify -certs TARGET.jar
22501 Thu Dec 02 20:26:46 JST 2010 META-INF/MANIFEST.MF
22534 Thu May 17 22:40:54 JST 2012 META-INF/MY_ALIAS.SF
3731 Thu May 17 22:40:54 JST 2012 META-INF/MY_ALIAS.RSA
...
sm 1012 Thu Dec 02 20:26:46 JST 2010 com/example/a.class
@ishida
ishida / gist:2719987
Created May 17, 2012 16:25
sign jar with jks
$ jarsigner -keystore MY_KEYSTORE_2.jks TARGET.jar MY_ALIAS
@ishida
ishida / gist:2719967
Created May 17, 2012 16:21
check alias in keystore using keytool
$ keytool -list -keystore MY_KEYSTORE_2.jks
キーストアのタイプ: JKS
キーストアのプロバイダ: SUN
キーストアには 1 エントリが含まれます。
MY_ALIAS, 2010/06/10, PrivateKeyEntry,
証明書のフィンガープリント (MD5): XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
@ishida
ishida / gist:2719962
Created May 17, 2012 16:21
change alias in keystore using keytool
$ keytool -changealias -keystore MY_KEYSTORE_2.jks -alias XXX-XXX-XXX-XXX-XXX -destalias MY_ALIAS
@ishida
ishida / gist:2719951
Created May 17, 2012 16:18
pfx to jks
$ keytool -importkeystore -srckeystore MY_KEYSTORE_1.pfx -srcstoretype PKCS12 -destkeystore MY_KEYSTORE_2.jks
出力先キーストアのパスワードを入力してください:
新規パスワードを再入力してください:
ソースキーストアのパスワードを入力してください:
別名 XXX-XXX-XXX-XXX-XXX のエントリのインポートに成功しました。
インポートコマンドが完了しました: 1 件のエントリのインポートが成功しました。0 件のエントリのインポートが失敗したか取り消されました
@ishida
ishida / gist:2658884
Created May 11, 2012 10:36
ssh config
$vi ~/.ssh/config
ServerAliveInterval 60
Host HOST2
User USER
ProxyCommand ssh USER@HOST1 nc -w 6000 HOST2 22