Skip to content

Instantly share code, notes, and snippets.

Liu DongMiao liudongmiao

Block or report user

Report or block liudongmiao

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
@liudongmiao
liudongmiao / highlight.js
Last active Dec 7, 2018
highlight word
View highlight.js
function highlightWord(root, word, className) {
// base on https://stackoverflow.com/a/10730063
// word is lower-case
var walker, textNodes = [];
walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
acceptNode: function (node) {
if (node.nodeType === Node.TEXT_NODE && node.textContent.toLowerCase().indexOf(word) >= 0) {
return NodeFilter.FILTER_ACCEPT;
} else {
View BitmapUtils.java
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
/**
* Created by thom on 2018/9/23.
*/
public class BitmapUtils {
View SimpleApkV2.java
// package me.piebridge;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@liudongmiao
liudongmiao / rijndael.py
Created Sep 6, 2016 — forked from jeetsukumaran/rijndael.py
Pure-Python implementation of Rijndael (AES) cipher.
View rijndael.py
#############################################################################
# Original code ported from the Java reference code by Bram Cohen, April 2001,
# with the following statement:
#
# this code is public domain, unless someone makes
# an intellectual property claim against the reference
# code, in which case it can be made public domain by
# deleting all the comments and renaming all the variables
#
class Rijndael(object):
View designer.html
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
View MinDepth.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
public class MinDepth {
private static void mindepth(int[] array, int index, int depth, HashMap<Integer, int[]> maps) {
List<Integer> added = new ArrayList<Integer>();
for (int i = 0; i < index; ++i) {
@liudongmiao
liudongmiao / fix_gcc_4.6.patch
Last active Dec 22, 2015
loadslic patch for grub4dos
View fix_gcc_4.6.patch
--- configure.ac~ 2009-01-16 22:58:48.000000000 +0800
+++ configure.ac 2013-08-27 20:33:41.000000000 +0800
@@ -115,6 +115,22 @@ if test "x$ac_cv_prog_gcc" = xyes; then
if test "x$no_stack_protector_flag" = xyes; then
STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector"
fi
+ # GCC >= 3.3 supports -fno-reorder-functions; this defends us against
+ # unlikely-to-be-executed functions being linked before _start with GCC
+ # >= 4.6.
+ AC_CACHE_CHECK([whether gcc has -fno-reorder-functions],
You can’t perform that action at this time.