This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| param=$1 | |
| # 如果没有参数或者是 -h/--help,则显示帮助信息 | |
| if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | |
| echo "用法: $0 [代理地址|选项]" | |
| echo "" | |
| echo "选项:" | |
| echo " -a 自动获取本机局域网IP并设置代理为 <局域网IP>:8080" | |
| echo " -d 移除当前设备的代理设置" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rename file names with 5-digit order(index) numbers only, padded with zeros, not perserve origin name. note: | |
| 1. response the mapping result in JSON format only, no code no explain and chat content. | |
| 2. using original file names as keys and renamed file names as values. | |
| fileNames: ["templateAnimLeftFade.zip","templateAnimRightFade.zip","templateAnimScanLine.zip"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rename file names with 5-digit order(index) numbers only, padded with zeros, not perserve origin name. note: | |
| 1. response the mapping result in JSON format only, no code no explain and chat content. | |
| 2. using original file names as keys and renamed file names as values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| set -e | |
| if [ -d "$HOME/.oh-my-zsh" ]; then | |
| echo "Oh My ZSH is installed" | |
| else | |
| echo "Download and install Oh My ZSH before running this script" | |
| echo 'sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"' | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://code.google.com/p/android/issues/detail?id=32696#c5 | |
| If you have a certificate that is not | |
| trusted by Android, when you add it, it goes in the personal cert store. | |
| When you add a cert in this personal cert store, the system requires a | |
| higher security level to unlock the device. But if you manage to add your | |
| cert to the system store then you don't have this requirement. Obviously, | |
| root is required to add a certificate to the system store, but it is quiet | |
| easy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import groovy.json.JsonOutput | |
| def android = project.extensions.android | |
| def list = new ArrayList<>() | |
| afterEvaluate { | |
| android.applicationVariants.all { variant -> | |
| def variantName = variant.name.capitalize() | |
| def variantOutput = variant.outputs.first() | |
| def path = variantOutput.getOutputFile().path | |
| def flavorList = variant.productFlavors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package zyc.android.utils | |
| import android.content.BroadcastReceiver | |
| import android.content.Context | |
| import android.content.Intent | |
| import android.content.IntentFilter | |
| import android.net.ConnectivityManager | |
| import android.net.ConnectivityManager.CONNECTIVITY_ACTION | |
| import android.net.Network | |
| import android.os.Build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun reportGooglePlayServiceStatus(context: Context) { | |
| when (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)) { | |
| ConnectionResult.SUCCESS -> "success" | |
| ConnectionResult.SERVICE_MISSING -> "service_missing" | |
| ConnectionResult.SERVICE_UPDATING -> "service_updating" | |
| ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED -> "service_version_update_required" | |
| ConnectionResult.SERVICE_DISABLED -> "service_disabled" | |
| ConnectionResult.SERVICE_INVALID -> "service_invalid" | |
| else -> "unknown" | |
| }.let { result -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static boolean checkPermission(Context context, String permission) { | |
| boolean result = false; | |
| if (Build.VERSION.SDK_INT >= 23) { | |
| try { | |
| Class<?> clazz = Class.forName("android.content.Context"); | |
| Method method = clazz.getMethod("checkSelfPermission", String.class); | |
| int rest = (Integer) method.invoke(context, permission); | |
| if (rest == PackageManager.PERMISSION_GRANTED) { | |
| result = true; |