Skip to content

Instantly share code, notes, and snippets.

View pollux-'s full-sized avatar

Sree Kumar A.V pollux-

View GitHub Profile
@pollux-
pollux- / CertificatePinner.java
Last active March 7, 2019 01:19
CertificatePinner -
CertificatePinner certificatePinner = new CertificatePinner.Builder()
.add("api.github.com", "sha256/6wJsqVDF8K19zxfLxV5DGRneLyzso9adVdUN/exDacw=")
.build();
final OkHttpClient client = httpBuilder.certificatePinner(certificatePinner).build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(END_POINT)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
@pollux-
pollux- / TLSSocketFactory.java
Created August 8, 2016 02:55
Force enable TLS v.1.2
public class TLSSocketFactory extends SSLSocketFactory {
private SSLSocketFactory internalSSLSocketFactory;
public TLSSocketFactory() throws KeyManagementException, NoSuchAlgorithmException {
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, new TrustManager[] { systemDefaultTrustManager() }, null);
internalSSLSocketFactory = sslContext.getSocketFactory();
}
@pollux-
pollux- / TLSSocketFactory.java
Created August 8, 2016 02:57
Attaching TLSSocketFactory to OkHttp
/**
* Enable TLS specific version V.1.2
* Issue Details : https://github.com/square/okhttp/issues/1934
*/
TLSSocketFactory tlsSocketFactory;
try {
tlsSocketFactory = new TLSSocketFactory();
httpBuilder.sslSocketFactory(tlsSocketFactory, tlsSocketFactory.systemDefaultTrustManager());
@pollux-
pollux- / ConnectionSpec.java
Last active March 7, 2019 01:19
Force the connection to use only TLS v.1.2 avoiding the fallback to older version to avoid vulnerabilities
/**
* Force the connection to use only TLS v.1.2 avoiding the fallback to older version to avoid vulnerabilities
*
*/
final ConnectionSpec.Builder connectionSpec =
new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS);
connectionSpec.tlsVersions(TlsVersion.TLS_1_2).build();
@pollux-
pollux- / reverse
Created October 13, 2016 07:04
Proguard revrse engineering app
https://github.com/pollux-/android-classyshark
public class DualProgressView extends View {
public DualProgressView(Context context) {
super(context);
}
public DualProgressView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public DualProgressView(Context context, AttributeSet attrs, int defStyleAttr) {
public class DualProgressView extends View {
private int mSize;
private Paint mPaint;
private RectF mRect;
public DualProgressView(Context context) {
super(context);
init();
}
public class DualProgressView extends View {
private int mSize;
private Paint mPaint;
private RectF mRect;
private float mIndeterminateSweep;
private float mstartAngle;
public DualProgressView(Context context) {
super(context);
init();
@pollux-
pollux- / sha256 hash
Last active March 26, 2024 20:50
Generating SHA256 hash of a public key from remote server certificate
Creating certificate from remote URL and writing to file (mycertfile.pem)
openssl s_client -showcerts -connect gist.github.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem
Generating SHA256 hash of public key from a certificate (mycertfile.pem)
openssl x509 -in mycertfile.pem -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
Dave Thomas: All programming is maintenance programming, because you are rarely writing original code.
If you look at the actual time you spend programming, you write a bit here and then you go back and make a change.
Or you go back and fix a bug. Or you rip it out altogether and replace it with something else.
But you are very quickly maintaining code even if it's a brand new project with a fresh source file.
You spend most of your time in maintenance mode. So you may as well just bite the bullet and say,
"I'm maintaining from day one."
The disciplines that apply to maintenance should apply globally.
https://sriramramani.wordpress.com/2015/05/06/custom-viewgroups/ customview
http://www.javaworld.com/article/2073649/core-java/why-extends-is-evil.html