Skip to content

Instantly share code, notes, and snippets.

@CMingTseng
CMingTseng / Android-Emulator-on-AWS-EC2.md
Created July 2, 2020 02:42 — forked from yazinsai/Android-Emulator-on-AWS-EC2.md
Installing and running Android Emulator on Amazon AWS EC2 (Ubuntu 16.04 / m5.xlarge)

Getting the Android Emulator running on EC2 📱

# @ your EC2 instance
sudo apt update
sudo apt install openjdk-8-jre unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d android-sdk
sudo mv android-sdk /opt/
export ANDROID_SDK_ROOT=/opt/android-sdk
[wsl2]
kernel=C:\\Users\\JAKA\\vmlinux
@CMingTseng
CMingTseng / tick_locs.py
Created August 17, 2019 14:00 — forked from virus-warnning/ticks_by_location.py
分點進出取資料研究
import os
import re
import requests
import sys
import json
from bs4 import BeautifulSoup
session = requests.Session()
resp = session.get('https://bsr.twse.com.tw/bshtm/bsMenu.aspx')
if resp.status_code == 200:
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* TODO: Add a class header comment!
*/
public class AspectRatioImageView extends ImageView {
@CMingTseng
CMingTseng / AspectRatioImageView.java
Created March 22, 2019 22:08 — forked from JakeWharton/AspectRatioImageView.java
ImageView that respects an aspect ratio applied to a specific measurement.
// Copyright 2012 Square, Inc.
package com.squareup.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/** Maintains an aspect ratio based on either width or height. Disabled by default. */
public class AspectRatioImageView extends ImageView {
@CMingTseng
CMingTseng / Rx2ServiceBindingFactory.java
Created February 22, 2019 17:57 — forked from MisterRager/Rx2ServiceBindingFactory.java
Bind to an Android service using RxJava!
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import io.reactivex.Observable;
@CMingTseng
CMingTseng / build.gradle
Created October 16, 2018 06:24 — forked from jkasten2/build.gradle
OneSignalSDK version matching error when using google-services plugin
//App build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
android {
compileSdkVersion 27
@CMingTseng
CMingTseng / DividerItemDecoration.java
Created September 30, 2018 19:21 — forked from lapastillaroja/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@CMingTseng
CMingTseng / CustomSSLSocketFactory.java
Created September 19, 2018 14:45 — forked from mannodermaus/CustomSSLSocketFactory.java
Android SSLSocketFactory for use with custom CA
package com.github.aurae.ssl;
import android.content.Context;
import android.support.annotation.RawRes;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.SecureRandom;
import java.security.cert.Certificate;