Skip to content

Instantly share code, notes, and snippets.

View WeRockStar's full-sized avatar

Kotchaphan Muangsan WeRockStar

View GitHub Profile
@WeRockStar
WeRockStar / genymotionwithplay.txt
Last active September 11, 2015 20:40 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161892865 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
Google Apps for Android 4.2 (https://www.androidfilehost.com/?fid=23060877490000128 - gapps-jb-20130812-signed.zip)
@WeRockStar
WeRockStar / introrx.md
Created April 22, 2016 13:12 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@WeRockStar
WeRockStar / SignatureCheck.java
Created April 29, 2016 07:15 — forked from scottyab/SignatureCheck.java
Simple Android signature check. It's not bullet proof but does increase the difficulty of backdooring the app
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";
@WeRockStar
WeRockStar / gist:ef86a53f52b732df58298464c364107d
Created July 24, 2016 11:49 — forked from daschl/gist:db9fcc9d2b932115b679
Draft: Writing Code for Production

Writing Resilient Reactive Applications

This guide is a first draft (that will end up in the official docs) on writing resilient code for production with the Couchbase Java SDK. At the end, the reader will be able to write code that withstands bugs, latency issues or anything else that can make their application fail.

Note that lots of concepts can be applied for both synchronous and asynchronous access. When necessary, both patterns are discussed separately. Also, the focus is on database interaction, but if you are using RxJava as part of your stack you can apply most of the principles there as well (and should!).

RxJava 101 Recap: Cold and Hot Observables

When working with Observables, it is important to understand the difference between cold and hot. Cold Observables will start to emit events once a Observer subscribes, and will do it "fresh" for each Observer. Hot Observables instead are starting to emit data as soon as it becomes available, and will return the same (or parts of the same)

@WeRockStar
WeRockStar / circle.yml
Created August 26, 2016 18:20 — forked from donnfelker/circle.yml
Updated circle.yml file
#
# Build configuration for Circle CI
#
# See this thread for speeding up and caching directories: https://discuss.circleci.com/t/installing-android-build-tools-23-0-2/924
#
general:
artifacts:
- /home/ubuntu/AndroidCI/app/build/outputs/apk/
@WeRockStar
WeRockStar / publickey
Last active February 2, 2022 15:45 — forked from pollux-/publickey
Extract the public key from a certificate
Generate public key + sha256 rely on X.509
1. openssl s_client -connect api.github.com:443 | openssl x509 -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
2. openssl x509 -noout -in certificate.pem -pubkey | openssl asn1parse -noout -inform pem -out public.key openssl dgst -sha256 -binary public.key | openssl enc -base64
3. openssl rsa -in my-rsa-key-file.key -outform der -pubout | openssl dgst -sha256 -binary | openssl enc -base64
4. openssl req -in my-signing-request.csr -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
5. openssl x509 -in my-certificate.crt -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
Covert PEM to DER
openssl x509 -outform der -in certificate.pem -out certificate.der
@WeRockStar
WeRockStar / CertificatePinner.java
Created September 11, 2016 17:24 — forked from pollux-/CertificatePinner.java
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)
@WeRockStar
WeRockStar / TopCropImageView.java
Created September 13, 2016 07:59 — forked from arriolac/TopCropImageView.java
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.
@WeRockStar
WeRockStar / GitHub-Forking.md
Created August 20, 2017 14:31 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j