Skip to content

Instantly share code, notes, and snippets.

@thiagolioy
thiagolioy / SessionManagerSpec.m
Created June 11, 2015 13:59
How to use Specta, Expecta and OCMock . With ViewControllers and Helper|Utility Classes
#import <UIKit/UIKit.h>
#import <Specta.h>
#import <Expecta.h>
#import <OCMock.h>
#import "SessionManager.h"
SpecBegin(SessionManagerSpec)
@idanakav
idanakav / percent_example
Created May 29, 2015 08:35
Percent library
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.percent.PercentRelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
@deiu
deiu / webcryptoapi.html
Last active June 27, 2024 07:44
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
@scottyab
scottyab / SignatureCheck.java
Last active June 5, 2024 11:36
Simple Android signature check. Please note: This was created in 2013, not actively maintained and may not be compatible with the latest Android versions. It's not particularly difficult for an attacker to decompile an .apk, find this tamper check, replace the APP_SIGNATURE with theirs and rebuild (or use method hooking to return true from `vali…
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
public class TamperCheck {
//we store the hash of the signture for a little more protection
private static final String APP_SIGNATURE = "1038C0E34658923C4192E61B16846";