Skip to content

Instantly share code, notes, and snippets.

string getLongestCommonSubString(string a, string b)
{
/*
dp[i, j] 为a[0, i - 1] 与 b[0, j - 1]末尾连续相等元素的数量
dp[i, j] = 0 (a[i] != b[j])
dp[i, j] = dp[i - 1, j - 1] + 1 (a[i] == b[j])
*/
vector<vector<int>> dp(a.length() + 1, vector<int>(b.length() + 1, 0));
int index = 0;
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;
@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
@foundkey
foundkey / ConfigNDKEnv.bat
Last active January 17, 2019 11:13
设置交叉编译arm原生程序的环境
:: 用于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
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());
}
}
netsh interface set interface "以太网" disabled
@foundkey
foundkey / SimpleServer.py
Last active April 10, 2019 08:05
Simple HTTP Server
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)
@foundkey
foundkey / filterAPK.bat
Last active December 29, 2018 06:49
copy special type file to targe folder
::复制指定类型的文件到同一个文件夹
::2018-12-19
::FK
@echo off
setlocal enabledelayedexpansion
set DIR=%~pn1
set /p Type= filter file extension:
@foundkey
foundkey / backTitle.java
Last active November 27, 2018 10:17
标题栏显示返回按钮
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) {
@foundkey
foundkey / traversalXML.java
Last active November 7, 2018 05:37
使用DOM方式,遍历XML文件
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