Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hotstu's full-sized avatar
🙈
Focusing

hglf hotstu

🙈
Focusing
  • une
  • Chengdu China
View GitHub Profile
@hotstu
hotstu / genymotionwithplay.txt
Created March 18, 2016 02:13 — 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 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - 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)
@hotstu
hotstu / CountingFileRequestBody.java
Created March 21, 2016 05:39 — forked from eduardb/CountingFileRequestBody.java
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
@hotstu
hotstu / NotificationChannelBuilder.kt
Last active May 14, 2019 03:31
NotificationChannelBuilder, DSL style android notification channel builder powered by kotlin, simple way to support Android O notification channels
/**
* @author hglf <a href="https://github.com/hotstu">hglf</a>
* @since 5/13/19
* @desc
*/
class Config {
val chidren: ArrayList<NotificationChannelGroup> = ArrayList()
}
//NOTE: extension properies are resolved static, so here is a little mem leak, call clean() when every thing is done
val extendPenddingChannels = HashMap<NotificationChannelGroup, ArrayList<NotificationChannel>>()
@hotstu
hotstu / NioFile.java
Created June 11, 2020 09:12
Java Nio File channel code including write/read/copy/lock/map
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
public class NioFile {
@hotstu
hotstu / deployArtifactory.gradle
Created May 14, 2019 04:33
deploy Android aar package to private artifactory repo/本脚本将编译后的aar上传私有artifactory仓库
//本脚本将编译后的aar上传私有artifactory仓库
//first config ~/.gradle/gradle.properties
//artifactory_contextUrl=http\://127.0.0.1\:8080/artifactory
//artifactory_user=anmin
//artifactory_repo_release=libs-release-local
//artifactory_password=password
//artifactory_repo_snapshot=libs-snapshot-local
//
//then in you root project's build.gradle:
//import below in project.gradle
@hotstu
hotstu / server.kt
Last active December 26, 2022 01:51
NanoHttpd wrapper for jsonrpc4j
import com.google.gson.Gson
import com.googlecode.jsonrpc4j.JsonRpcBasicServer.*
import com.googlecode.jsonrpc4j.JsonRpcServer
import fi.iki.elonen.NanoHTTPD
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.IOException
import java.io.InputStream
import java.nio.charset.StandardCharsets