Skip to content

Instantly share code, notes, and snippets.

Avatar

DroidUnplugged pollux-

View GitHub Profile
View GlideHelper.java
import android.content.Context;
import android.support.annotation.NonNull;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.data.DataFetcher;
import com.bumptech.glide.load.model.stream.StreamModelLoader;
@pollux-
pollux- / getdeviceart.sh
Created Sep 3, 2018 — forked from PaulKinlan/getdeviceart.sh
Screen Record for Android
View getdeviceart.sh
#! /bin/bash
mkdir -p ./backgrounds
function get_google_device_art {
local device=$1
# Get the Google Device backgrounds
curl "https://developer.android.com/distribute/marketing-tools/device-art-resources/$1/port_back.png" > "./backgrounds/$1_port_back.png"
curl "https://developer.android.com/distribute/marketing-tools/device-art-resources/$1/port_fore.png" > "./backgrounds/$1_port_fore.png"
View programming notes
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
@pollux-
pollux- / sha256 hash
Last active Mar 7, 2019
Generating SHA256 hash of a public key from remote server certificate
View sha256 hash
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
View rect_animation
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();
View drawing_rectangle
public class DualProgressView extends View {
private int mSize;
private Paint mPaint;
private RectF mRect;
public DualProgressView(Context context) {
super(context);
init();
}
View custom_view_constructors
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) {
@pollux-
pollux- / reverse
Created Oct 13, 2016
Proguard revrse engineering app
View reverse
https://github.com/pollux-/android-classyshark
@pollux-
pollux- / ConnectionSpec.java
Last active Mar 7, 2019
Force the connection to use only TLS v.1.2 avoiding the fallback to older version to avoid vulnerabilities
View ConnectionSpec.java
/**
* 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- / TLSSocketFactory.java
Created Aug 8, 2016
Attaching TLSSocketFactory to OkHttp
View TLSSocketFactory.java
/**
* 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());
You can’t perform that action at this time.