Skip to content

Instantly share code, notes, and snippets.

View HsingPeng's full-sized avatar

bboxhe HsingPeng

  • NULL
  • China
View GitHub Profile
@HsingPeng
HsingPeng / BinaryTree.java
Created August 14, 2017 12:43
树的前序、中序、后序遍历(递归、非递归)
import java.util.Stack;
import java.util.Queue;
import java.util.LinkedList;
public class BinaryTree {
private int mValue;
private BinaryTree mLeft;
private BinaryTree mRight;
public BinaryTree(int value) {
@HsingPeng
HsingPeng / gist:5633b4dc58ffaee1320fab1b87be6efe
Created July 23, 2017 03:59
修复 evernote sync 1.2.16 不能显示checkout
在 EvernoteSync.php 里修改 formatArticle 函数
//添加<en-todo>标签
// 清除不需要的标签(<a><span><b><strong><em><u><strike><i>可出现在<p>内)
$ret = strip_tags($ret, '<a><span><b><strong><em><u><strike><i><div><p><pre><code><video><source><embed><object><param><audio><bgsound><h1><h2><h3><h4><h5><table><tr><td><th><br><img><blockquote><ol><ul><li><en-todo>');
......
//恢复checkbox
$ret = str_replace('<en-todo checked="false"/>', '<input type="checkbox"/>', $ret);
5.8.10.202 - - [17/Mar/2017:00:56:40 +0800] "GET / HTTP/1.1" 400 166 "-" "-" -
40.77.167.77 - - [17/Mar/2017:01:27:26 +0800] "GET / HTTP/1.1" 200 1848 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" -
77.88.47.105 - - [17/Mar/2017:01:34:38 +0800] "GET /robots.txt HTTP/1.1" 200 80 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" -
77.88.47.105 - - [17/Mar/2017:01:34:46 +0800] "GET / HTTP/1.1" 200 1848 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" -
139.162.106.181 - - [17/Mar/2017:09:00:15 +0800] "GET / HTTP/1.1" 200 5423 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36" -
101.226.33.221 - - [17/Mar/2017:11:40:33 +0800] "GET / HTTP/1.1" 200 1848 "" "Mozilla/5.0 (iPhone; CPU iPhone OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H143 Safari/600.1.4" -
101.226.33.221 - - [17/Mar/2017:11:40:34 +0800] "GET /asset/materialize/font/material
@HsingPeng
HsingPeng / A.md
Last active May 20, 2017 09:44
__attribute__((packed))的作用

attribute((packed))的作用只是把padding(填充)空间删除了,char、int该占多大还是多大。

参考:attribute((packed))的作用 http://blog.csdn.net/lmh12506/article/details/25641853

test_packed.c例子结果:

deep@deep-virtual-machine:~$ ./a.out                                            
01 99 c9 73 cd ab 00 00 
01 cd ab 00 00 
@HsingPeng
HsingPeng / HeapSort.java
Last active September 15, 2017 12:28
堆排序 HeapSort.java 归并排序 MergeSort.java 快速排序 QuickSort.java 希尔排序 ShellSort.java
public class HeapSort {
public static void heapAdjust(int[] H, int s, int length) {
int child = s * 2 + 1;
int temp = H[s];
while (child < length) {
if (child+1<length && H[child] < H[child+1]) {
child++;
}
if (H[child] > H[s]) {
public class Solution {
public List<List<String>> solveNQueens(int n) {
List<List<String>> list = new ArrayList<List<String>>();
if (n == 1) {
List<String> current = new ArrayList<String>();
list.add(current);
current.add("Q");
return list;
}
1_JAVA.md
2_Linux
3_计算机和网络
4_算法
5_ANDROID
图床:小贱贱图床 http://pic.xiaojianjian.net/

Android打印机项目 涉及的技术:

APP部分:

系统打印插件API

APP基础:Activity、Broadcast、Service(四大组件中的三个)

UI制作(Activity、Fragment、Dialog、Handler、各种Layout、Button、Listview)

@HsingPeng
HsingPeng / SeqMaxOperateQueue.java
Last active February 18, 2017 06:09
设计一个队列;支持:出队,入队,求最大元素,要求O(1);均摊分析
public class SeqMaxOperateQueue extends SeqQueue {
private SeqQueue queue;
public SeqMaxOperateQueue() {
super();
queue = new SeqQueue();
}
public void enQueue(int v) {
@HsingPeng
HsingPeng / GuessBoxGame.java
Created February 16, 2017 06:45
Guess box game
bboxh@DESKTOP-DEEP:~$ cat GuessBoxGame.java
import java.util.Random;
public class GuessBoxGame {
private static int times = 10000;
private static int boxNumber = 3;
private static int noChangeWinner = 0;
private static int changeWinner = 0;
public static void main(String[] args) {