Skip to content

Instantly share code, notes, and snippets.

View hyongbai's full-sized avatar
💭
Adventuring

hyongbai hyongbai

💭
Adventuring
View GitHub Profile
@hyongbai
hyongbai / id_calculator.sh
Created June 29, 2019 17:02
中国身份证校验码计算公式
# 中国身份证校验码计算公式
# for more information: http://blog.sciencenet.cn/blog-408109-1075697.html
# 使用方法:
# `id_calculator ${身份证号码空格隔开}`
# 例如:
# ```
# $ id_calculator 1 1 0 1 0 0 2 0 0 1 0 9 1 0 8 2 9 1
# $ 求和 = 209, 余数 = 0, 校验码 = 1
PmHostSvc:IPluginHost
=====================
@Override
public Map<String, List<String>> queryLocalBroadcasts(String action, boolean hostOnly) throws RemoteException {
if (LogDebug.LOG) {
LogDebug.d("IPluginHost", String.format("queryLocalBroadcasts(%s): >>>>>> ", action));
}
final long start = LogDebug.LOG ? System.currentTimeMillis() : 0;
//
@hyongbai
hyongbai / gist:498bc9e9358a6e2af86f3e72968308c3
Created November 15, 2018 07:17 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@hyongbai
hyongbai / QHT.sol
Last active October 30, 2018 06:46
基于ETH发行Token
pragma solidity ^0.4.23;
library Math {
function add(uint256 x, uint256 y) pure internal returns (uint256 z) {
assert((z = x + y) >= x);
}
function sub(uint256 x, uint256 y) pure internal returns (uint256 z) {
assert((z = x - y) <= x);
task hello(){
println("HELLO")
}
task deployReplugin {
println("deployReplugin")
}
deployReplugin.doLast {
println("deployReplugin.doLast")
// Way 1
def loadConfig; loadConfig = { p ->
if (p == null || !p.exists()) return
if (new File(p, "rp-config.gradle").exists()) apply from: "${p}/rp-config.gradle"
else loadConfig(p.parentFile)
}
loadConfig(buildscript.sourceFile.parentFile)
// Way2
def loadConfig = { p ->
@hyongbai
hyongbai / gist:0c9751ac0423b57a4f264cc1309c149e
Created October 10, 2016 00:43
load bitbucket failed for css not reachable, add to pac
".cloudfront.net",
"||cloudfront.net",
@hyongbai
hyongbai / byte-sizetuts.md
Last active September 28, 2016 07:38 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.
@hyongbai
hyongbai / gist:4c7d9261076a38e1f279a56e7c28ff8d
Last active October 10, 2016 00:44
Instant Run for 20 and lower
如果应用的minSdkVersion小于21,可能多数的Instant Run功能会挂掉,这里提供一个解决方法,通过product flavor建立一个minSdkVersion大于21的新分支,用来debug。
```Java
private Bitmap getFullResIcon(String packageName) throws PackageManager.NameNotFoundException {
return getFullResIcon(pm.getApplicationInfo(packageName, 0));
}
private Bitmap getFullResIcon(ApplicationInfo info) {
try {
Resources resources = pm.getResourcesForApplication(info.packageName);
if (resources != null) {