Skip to content

Instantly share code, notes, and snippets.

View jp1017's full-sized avatar
:octocat:
Focusing

妙法莲华经 jp1017

:octocat:
Focusing
View GitHub Profile
@jp1017
jp1017 / adb+
Created January 6, 2016 03:10 — forked from race604/adb+
#!/bin/bash
# Script adb+
# Run any command adb provides on all your currently connected devices,
# Or prompt to select one device
showHelp() {
echo "Usage: adb+ [-a] <command>"
echo " -h: show help"
echo " -a: run command on all device"
echo " command: normal adb commands"
@jp1017
jp1017 / Sort Algorithm
Created January 7, 2016 07:27 — forked from Leaking/Sort Algorithm
Sort Algorithm
/**
* 冒泡排序
*
* @param a
*/
public static void bubbleSort(int[] a) {
int temp;
for (int i = 0; i < a.length; i++)
for (int j = 0; j < a.length - i - 1; j++) {
@jp1017
jp1017 / dispatchTouchEvent源码解析
Created January 7, 2016 07:28 — forked from Leaking/dispatchTouchEvent源码解析
android事件分发dispatchTouchEvent方法的源码解析
package cc.aa;
import android.os.Environment;
import android.view.MotionEvent;
import android.view.View;
public class UnderstandDispatchTouchEvent {
/**
* dispatchTouchEvent()源码学习及其注释
* 常说事件传递中的流程是:dispatchTouchEvent->onInterceptTouchEvent->onTouchEvent
@jp1017
jp1017 / Data.java
Created January 11, 2016 00:20 — forked from douo/Data.java
一个实现安卓 Recycle 机制的例子
/**
* Created by Tiou on 2014/7/15.
* 一个实现 Recycle 机制的对象
*/
public class Data {
/**
* 对象池,就是上文所提到的对象仓库,用于暂时存放不用的对象。
* 用链表来实现对象池结构,直观,高效,易用。
* sPool 便是指向链表头部的引用
*/
@jp1017
jp1017 / CHexConver.java
Created April 18, 2016 08:32 — forked from alanland/CHexConver.java
java 中 Hex的转换
package mobi.dzs.util;
/**
* 16进制值与String/Byte之间的转换
* @author JerryLi
* @email lijian@dzs.mobi
* @data 2011-10-16
* */
public class CHexConver
{
@jp1017
jp1017 / Employee.java
Created June 5, 2016 08:47 — forked from greycode/Employee.java
Guava 开发
package org.yct.demo.guava;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import static com.google.common.base.Preconditions.*;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Ordering;
public class Employee implements Comparable<Employee> {
private String name;
@jp1017
jp1017 / capture_raw_frames.c
Created March 2, 2017 01:35 — forked from maxlapshin/capture_raw_frames.c
v4l2 capture example
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
@jp1017
jp1017 / EndlessRecyclerOnScrollListener.java
Created March 7, 2017 03:07 — forked from ssinss/EndlessRecyclerOnScrollListener.java
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;
@jp1017
jp1017 / PCMusicViaWechat.py
Created March 23, 2017 11:03 — forked from littlecodersh/PCMusicViaWechat.py
Demo of controlling music player through wechat.
#coding=utf8
import os
import itchat
from NetEaseMusicApi import interact_select_song
# 第三方包通过该命令安装:pip install itchat, NetEaseMusicApi
HELP_MSG = u'''\
欢迎使用微信网易云音乐
帮助: 显示帮助
@jp1017
jp1017 / WechatSmartWish.py
Created March 23, 2017 11:03 — forked from littlecodersh/WechatSmartWish.py
Demo of sending smart wishes through wechat.
#coding=utf8
import itchat, time
SINCERE_WISH = u'祝%s新年快乐!'
REAL_SINCERE_WISH = u'祝%s新年快乐!!'
def send_wishes():
friendList = itchat.get_friends(update=True)[1:]
for friend in friendList:
# 如果不是演示目的,把下面的方法改为itchat.send即可