Skip to content

Instantly share code, notes, and snippets.

@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:2719996
Created May 17, 2012 16:27
jarsigner verify warning
警告:
この jar には、署名者の証明書が期限切れのエントリが含まれています。
@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: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: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:3825662
Created October 3, 2012 07:49
Xcode .gitignore
#--------
# xcode noise
build/*
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/default.*
**/*.xcodeproj/*
!**/*.xcodeproj/project.pbxproj
@ishida
ishida / gist:4086344
Created November 16, 2012 10:45
Objective-C Delegate
//
// AViewController.h
//
@protocol AViewControllerDelegate;
@interface AViewController : UIViewController <AViewControllerDelegate>
{
id <AViewControllerDelegate> delegate;
}
@property (nonatomic, retain) id <AViewControllerDelegate> delegate;
@ishida
ishida / gist:4116621
Created November 20, 2012 07:44
Show ViewController and NavigationController
+ (void)showViewControllerAndNavigationControllerFromParentViewController:(UIViewController *)parentVC
{
AViewController *vc = [[[AViewController alloc] init] autorelease];
UINavigationController* nc = [[[UINavigationController alloc]
initWithRootViewController:vc] autorelease];
nc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
vc.navigationController = nc;
vc.navigationBar = nc.navigationBar;
@ishida
ishida / gist:4129569
Created November 22, 2012 05:38
Detect touches
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint p = [touch locationInView:aView];
NSLog(@"Touch detected: x=%lf, y=%lf", p.x, p.y);
if (0 <= p.y && p.y <= aView.frame.size.height
&& 0 <= p.x && p.x <= aView.frame.size.width)
{
//do something
}
@ishida
ishida / gist:5670785
Last active December 17, 2015 20:49
get memory usage @mac
`ps alx | grep \[r\]uby | awk '{printf ("%d", $8)}'`.to_i
`ps -o rss= -p #{Process.pid}`.to_i