Skip to content

Instantly share code, notes, and snippets.

View wilsonssss's full-sized avatar

WilsonL wilsonssss

  • whatever
  • anywhere
View GitHub Profile
@thesadabc
thesadabc / aes-128-ctr.js
Created January 31, 2021 16:06
JS原生API的aes-128-ctr加密算法,使用node的crypto模块与浏览器的window.crypto对象
/**
* 原生API的aes-128-ctr加密算法,
* 参数统一使用UnitArray, 加密过程不限于字符串, 浏览器与node端通用
* 使用node的crypto模块与浏览器的window.crypto对象,
* IV长度固定为16,
* 浏览器不支持aes-256, 故使用aes-128, key长度固定为16,
*/
const str2uint = str => new TextEncoder("utf8").encode(str);
const uint2str = bf => new TextDecoder("utf8").decode(bf);
@trongnghia203
trongnghia203 / install_pyenv.md
Last active April 19, 2024 13:37
Install pyenv
@yuriteixeira
yuriteixeira / puppeteer_chromedevtools_android.md
Created August 28, 2018 08:41
Puppeteer/Chrome Dev Tools Protocol: How to manipulate Android Chrome or WebViews

First of all, get prepared by installing the Android SDK and SDK tools in order to get the adb executable. Then:

  1. adb connect <device ip>

  2. To get the service name `adb shell "cat /proc/net/unix | grep devtools_remote", which will give you something like this output:

00000000: 00000002 00000000 00010000 0001 01 423897 @webview_devtools_remote_18279
@to-bee
to-bee / tensorflow-gpu-sierra
Last active January 11, 2021 01:24
Build tensorflow with gpu support on OSX Sierra
disable sip in recovery mode
start recovery mode with Cmd + R on startup
start terminal
csrutil disable
download and install cuda 8
download cuDNN v6.0 for cuda 8 (register first)
install xcode 7.2
current xcode version is not supported
@kosiara
kosiara / proguard-rules.pro
Created November 3, 2015 15:39
RxJava RxAndroid Proguard rules
#build.gradle
#
# compile 'io.reactivex:rxandroid:1.0.1'
# compile 'io.reactivex:rxjava:1.0.14'
# compile 'io.reactivex:rxjava-math:1.0.0'
# compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'
# rxjava
-keep class rx.schedulers.Schedulers {
public static <methods>;
@cxyxlxdm
cxyxlxdm / GridSpacingItemDecoration.md
Last active April 19, 2024 08:43
Add column spacing in RecyclerView with GridLayoutManager

Android Recyclerview GridLayoutManager column spacing Here is the question, the first answer does not work well in my project,and it makes the spacing bigger between item and item. the second answer is quite perfect.But if RecyclerView has headers,it does not work well. Then I fixed it.

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
@kotucz
kotucz / build-robolectric.gradle
Last active November 5, 2019 12:13
Robolectric runtime dependencies downloader
/**
* Module that includes this will be configured to use offline dependencies for Robolectric
* This downloads robolectric dependencies once into the root project
*/
def robolectricDependenciesFolder = rootProject.buildDir.path + "/robolectric-dependencies"
// configuration that resolves Robolectric runtime dependencies
configurations.create('robolectricRuntime')
@imran0101
imran0101 / EndlessRecyclerOnScrollListener.java
Last active February 22, 2022 12:50
RecyclerView position helper to get first and last visible positions
/**
* Custom Scroll listener for RecyclerView.
* Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e
*/
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = "EndlessScrollListener";
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
@polbins
polbins / README.md
Last active February 29, 2024 09:58
Simple RecyclerView Divider

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter

@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;