Skip to content

Instantly share code, notes, and snippets.

刘钦 liuqinh2s

Block or report user

Report or block liuqinh2s

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 获取一个随机端口
def findFreePort():
"""
函数返回值是当前可用来监听的一个随机端口。
"""
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('localhost', 0))
# 用getsockname来获取我们实际绑定的端口号
addr, port = s.getsockname()
# 释放端口
View 最小二叉堆(Priority Queue)
import java.util.ArrayList;
import java.util.Arrays;
public class Solution {
public void insert(ArrayList<Integer> heap, int val){
heap.add(val);
update(heap, heap.size()-1);
}
View API过滤器
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Iterator;
public class Solution {
public static void main(String[] args) {
Solution solution = new Solution();
View java二叉树
import java.util.ArrayList;
public class Solution {
public boolean HasSubtree(TreeNode root1,TreeNode root2) {
boolean result = false;
if(root1!=null && root2!=null){
result = doesTree1HaveTree2(root1, root2);
if(!result){
result = HasSubtree(root1.left, root2);
View java单链表
public class Solution {
public ListNode Merge(ListNode list1,ListNode list2) {
if(list1==null){
return list2;
}
if(list2==null){
return list1;
}
ListNode node = new ListNode(0);
View 四路partition
public class Solution {
public void partition(int[] array) {
if (array == null || array.length <= 1) {
return;
}
int index1 = 0;
int index2 = 0;
int index3 = 0;
for (int i = 0; i < array.length; i++) {
View 单链表
#include<iostream>
#include<stack>
using namespace std;
struct ListNode{
int value;
ListNode* pNext;
};
View json解析器(java版)
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class JsonParser {
private String json;
private int index = 0;
private Map<Character, Boolean> numChars = new HashMap<>();
View 自动输入电话支付宝按键精灵脚本
/************************************************
*
* 全局变量
*
* 1. LOG 相关变量和函数
* 2. 延时函数,控制点击速度,寻找最佳的速度,避免被支付宝限制
* 3. 结束函数,自定义结束时候要执行的动作
* 2. 路径和文件相关变量和函数
*
************************************************/
View hexo博客同时push到git pages和ipfs上
idString=`ipfs id`
str="ID\": \""
subIdStr=${idString#*$str}
str1="\","
subIdStr1=${subIdStr%%$str1*}
echo $subIdStr1
sed -i "" "/root: / s/\/ipns\/$subIdStr1\//\//" _config.yml
sed -i "" "/url: / s/http:\/\/ipfs.io\/ipns\/$subIdStr1/http:\/\/liuqinh2s.github.io/" _config.yml
hexo clean
hexo g -d
You can’t perform that action at this time.