This file contains 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
String str = "Hello World"; | |
Paint calcTextRect = new Paint(); | |
String familyName = “宋体”; | |
Typeface font = Typeface.create(familyName,Typeface.BOLD); | |
calcTextRect.setTypeface(font); // 设置字体 | |
calcTextRect.setColor(Color.RED); // 设置颜色 | |
calcTextRect.setTextSize(22); // 设置字体大小 | |
Rect rect = new Rect(); | |
calcTextRect.getTextBounds(str, 0, 1, rect); |
This file contains 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 void traversalXMLFile(String uri) throws Exception { | |
StringBuilder result = new StringBuilder(); | |
result.append("File: ").append(uri).append("\n"); | |
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); | |
DocumentBuilder db = dbf.newDocumentBuilder(); | |
Document doc = db.parse(uri); | |
Element rootElement = doc.getDocumentElement(); | |
// check root element |
This file contains 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 com.toby.personal.myapplication; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.MenuItem; | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
This file contains 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
::复制指定类型的文件到同一个文件夹 | |
::2018-12-19 | |
::FK | |
@echo off | |
setlocal enabledelayedexpansion | |
set DIR=%~pn1 | |
set /p Type= filter file extension: |
This file contains 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
from http.server import HTTPServer, BaseHTTPRequestHandler | |
import json | |
HOST = "127.0.0.1" | |
PORT = 8081 | |
data = [ { 'a' : 'hello', 'b' : 'world', 'c' : 3, 'd' : 4, 'e' : 5 } ] | |
class RequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) |
This file contains 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
netsh interface set interface "以太网" disabled |
This file contains 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 void getCurFun() { | |
Thread thread = Thread.currentThread(); | |
StackTraceElement traceElement[] = thread.getStackTrace(); | |
for (int i = 0; i < traceElement.length; ++i) { | |
System.out.println(i + ": " + traceElement[i].toString()); | |
} | |
} |
This file contains 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
:: 用于cmake编译arm原生程序前设置环境变量 | |
:: 使用Android SDK自带的cmake工具(cmake官网版本不支持Android平台) | |
@set path=D:\Android\Sdk\cmake\3.6.4111459\bin;%path% | |
:: 该文件用于配置NDK的编译工具链 | |
@set TOOLCHAIN_FILE=D:\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake | |
:: 编译工具 | |
@set MAKE_PROGRAM=D:\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe | |
:: NDK路径 | |
@set ANDROID_NDK=D:\Android\Sdk\ndk-bundle |
This file contains 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
@echo off | |
set ToolDir="D:\Android\Sdk\build-tools\27.0.3" | |
set path=%ToolDir%;%path% | |
chcp 65001 | |
set /p APK="Input apk full path:" | |
aapt dump badging %APK% | |
pause |
This file contains 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 com.foundkey.example; | |
import javax.crypto.*; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.security.*; | |
import java.security.spec.InvalidKeySpecException; | |
import java.security.spec.PKCS8EncodedKeySpec; | |
import java.security.spec.X509EncodedKeySpec; | |
import java.util.Base64; |
OlderNewer