Skip to content

Instantly share code, notes, and snippets.

Integ /
Last active November 24, 2023 02:13 — forked from feix/
A useful tool for unpack wxapkg file with python3 surport.
# coding: utf-8
# py2 origin author lrdcq
# usage python3 filename
__author__ = 'Integ:'
import sys, os
import struct
class WxapkgFile(object):
florina-muntenescu / BaseDao.kt
Last active September 28, 2023 15:01
Use Dao inheritance to reduce the amount of boilerplate code -
View BaseDao.kt
* Copyright (C) 2017 The Android Open Source Project
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
julianfalcionelli /
Last active June 21, 2022 08:55
Rx Error Handling for Retrofit2
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Single;
import io.reactivex.SingleSource;
import io.reactivex.annotations.NonNull;
zjx20 / gist:1c7f4dd1392866f9d8b00dd2a05bd481
Last active March 25, 2022 08:43
kcptun install and systemd daemon
View gist:1c7f4dd1392866f9d8b00dd2a05bd481
tar xvf kcptun-linux-amd64-20170525.tar.gz
sudo mv server_linux_amd64 /usr/local/bin/kcptun_server
sudo mv client_linux_amd64 /usr/local/bin/kcptun_client
sudo mkdir -p /etc/kcptun
sudo bash -c "cat <<EOT > /etc/kcptun/server_conf.json
\"listen\": \":4321\",
\"target\": \"\",
joen93 /
Created April 5, 2017 12:56
RxJava2 and Retrofit 2.2.0 compatible factory, which wraps the {@link RxJava2CallAdapterFactory} and takes care of the error conversion.
* RxJava2 and Retrofit 2.2.0 compatible factory,
* which wraps the {@link RxJava2CallAdapterFactory} and takes care of the error conversion.
* Based on:
public class RxErrorHandlingCallAdapterFactory extends CallAdapter.Factory {
private final RxJava2CallAdapterFactory mOriginalCallAdapterFactory;
private RxErrorHandlingCallAdapterFactory() {
sensen /
Created September 4, 2015 03:33
Fresco's custom BitmapMemoryCacheParamsSupplier for Lollipop devices
public class LollipopBitmapMemoryCacheParamsSupplier implements Supplier<MemoryCacheParams> {
private ActivityManager activityManager;
public LollipopBitmapMemoryCacheParamsSupplier(ActivityManager activityManager) {
this.activityManager = activityManager;
public MemoryCacheParams get() {
grandstaish /
Last active September 13, 2022 05:53
LayoutInflaterFactory examples
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
shimondoodkin /
Last active September 16, 2022 15:02
android vibrate a vibrating bluetooth bracelet
licence pubilc domain
prepered by Shimon Doodkin
vibrate a vibrating bluetooth bracelet
a simple bt client it sends "RING" AT command to a device named "BRACELET"
it is a good "android bluetooth client example".
quanturium /
Last active July 10, 2020 17:50
A simple implementation of CursorAdapter for the new RecyclerView. It is designed to work with CursorLoaders and do not register any content observer (which can cause leaks if not handled properly)
* The MIT License (MIT)
* Copyright (c) 2015 ARNAUD FRUGIER
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
ZkHaider /
Last active January 30, 2022 02:31
Simple Expand / Collapse RecyclerView Item
public static class ExampleViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
private int originalHeight = 0;
private boolean isViewExpanded = false;
private YourCustomView yourCustomView
public ExampleViewHolder(View v) {