Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
flying in the sky

Luong Vo (Lucas) luongvo

🚀
flying in the sky
View GitHub Profile
@luongvo
luongvo / ssl_pinning.sh
Last active Sep 18, 2020
SSL Pinning - Public key getting script
View ssl_pinning.sh
#!/bin/bash
certs=`openssl s_client -servername $1 -host $1 -port 443 -showcerts </dev/null 2>/dev/null | sed -n '/Certificate chain/,/Server certificate/p'`
rest=$certs
while [[ "$rest" =~ '-----BEGIN CERTIFICATE-----' ]]
do
cert="${rest%%-----END CERTIFICATE-----*}-----END CERTIFICATE-----"
rest=${rest#*-----END CERTIFICATE-----}
echo `echo "$cert" | grep 's:' | sed 's/.*s:\(.*\)/\1/'`
echo "$cert" | openssl x509 -pubkey -noout |
openssl rsa -pubin -outform der 2>/dev/null |
@luongvo
luongvo / ActivityLifecycle.md
Created Dec 7, 2018 — forked from kristopherjohnson/ActivityLifecycle.md
Notes about Android Activity lifecycle method ordering
View ActivityLifecycle.md

Results of some experiments to determine which Activity lifecycle methods get called in certain situations.

Scenario: Launch app from home, then return home

Launch:

  • activity.onCreate()
  • activity.onStart()
  • activity.onResume()
  • activity.onWindowFocusChanged(true)
@luongvo
luongvo / config.yml
Created Sep 10, 2018 — forked from bassaer/config.yml
CircleCI 2.0でAndroidライブラリの自動デプロイ ref: http://qiita.com/bassaer/items/6b9aedae4571d59f0fdf
View config.yml
version: 2
jobs:
build:
branches:
only:
- master
- develop
docker:
# specify the version you desire here
- image: circleci/android:api-26-alpha
@luongvo
luongvo / Readme.md
Created May 28, 2018 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.
View Readme.md

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@luongvo
luongvo / build.gradle
Created Jan 3, 2018 — forked from aalmiray/build.gradle
Aggregated Jacoco reports in a multi-project Gradle build
View build.gradle
allprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
repositories {
jcenter()
}
jacoco {
toolVersion = '0.7.1.201405082137'
@luongvo
luongvo / cp-env-to-properties.sh
Created Jan 3, 2018 — forked from danielgomezrico/cp-env-to-properties.sh
Gradle / Bash - copy all env variables to app/gradle.properties (used to copy secret env vars from travis or circle CI to build android projects)
View cp-env-to-properties.sh
#!/usr/bin/env bash
#
# Copy env variables to app module gradle properties file
#
set +x // dont print the next lines on run script
printenv | tr ' ' '\n' > app/gradle.properties
set -x
View environmentSetup.sh
#
# Circle CI & gradle.properties live in harmony
#
# Android convention is to store your API keys in a local, non-versioned
# gradle.properties file. Circle CI doesn't allow users to upload pre-populated
# gradle.properties files to store this secret information, but instaed allows
# users to store such information as environment variables.
#
# This script creates a local gradle.properties file on current the Circle CI
# instance. It then reads environment variable TEST_API_KEY_ENV_VAR which a user
@luongvo
luongvo / circle.yml
Created Jan 3, 2018 — forked from mugifly/circle.yml
Faster test & Build of Android Studio Project (Gradle Project) on Circle-CI.
View circle.yml
machine:
java:
version: oraclejdk8
environment:
# Java options
JAVA_OPTS: "-Xms512m -Xmx2048m"
# ADB options
ADB_INSTALL_TIMEOUT: 5000
dependencies:
View RoundedCornerLayout.java
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.util.AttributeSet;
@luongvo
luongvo / RoundedImageView.java
Created Dec 20, 2017 — forked from dzeikei/RoundedImageView.java
Android Rounded ImageView without modifying the original bitmap. Best used with ScaleType.CENTER_CROP or ScaleType.FIT_XY
View RoundedImageView.java
package com.snepo.common.widgets;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Path.FillType;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;