https://ice1000.org/2017/04/24/JniObjGlobalRef/
看到字典树,我首先想到的就是 RegularPP 的字符串批量替换功能需要这种数据结构优化.... 😶
但可惜天不遂人愿,C 程序设计语言是不自带 HashMap 的实现的
而且我也懒得再去研究下 HashMap 该怎么写... 据说挺复杂,之前我都没看懂
那么问题来了
不过我要做的是被称为 ByteTrie 的东西,幸好 Byte 只有 256 种可能
目前计划好的算法呢... 就是使用 ArrayMap 替换 HashMap 实现 ByteTrie,不过添加额外的优化,类似这样
就是说根树查找最坏 32 次比较 byte (或许已经对齐到 int)可以得到答案(子树或者结束符),而子树最多需要 8 次,虽然是模拟的(所以有额外桶查找开销,桶最坏情况得比较 32 次 byte 才找得到)
API 是这么计划的
看到字典树,我首先想到的就是 RegularPP 的字符串批量替换功能需要这种数据结构优化.... 😶
但可惜天不遂人愿,C 程序设计语言是不自带 HashMap 的实现的
而且我也懒得再去研究下 HashMap 该怎么写... 据说挺复杂,之前我都没看懂
那么问题来了
class Node():我们看看第四行的
def __init__(self):
self.children = {}
self.value = None
{} 它是什么?In [2]: dict()嗯,一个 dict,或者说是 HashMap,或者管他什么 Map,但是 Python 里这是 HashMap
Out[2]: {}
不过我要做的是被称为 ByteTrie 的东西,幸好 Byte 只有 256 种可能
目前计划好的算法呢... 就是使用 ArrayMap 替换 HashMap 实现 ByteTrie,不过添加额外的优化,类似这样
#include <stdint.h>根树有 8 个静态桶,所有子树都有 32 个虚拟桶
#include <list.h>
typedef uint8_t byte;
typedef struct bytepair { byte key; byte value; } BytePair;
typedef struct bytemap { LinkedList list; } ByteMap;
typedef struct bytetrie {
LinkedList bin0;
LinkedList bin1;
LinkedList bin2;
LinkedList bin3;
LinkedList bin4;
LinkedList bin5;
LinkedList bin6;
LinkedList bin7;
} ByteTrie;
struct bytetrienode {
LinkedList bin0to31;
} ByteTrieNode;
就是说根树查找最坏 32 次比较 byte (或许已经对齐到 int)可以得到答案(子树或者结束符),而子树最多需要 8 次,虽然是模拟的(所以有额外桶查找开销,桶最坏情况得比较 32 次 byte 才找得到)
API 是这么计划的
typedef struct bytetrieresult {
byte flags;
union {
byte result;
void *node;
};
} ByteTrieResult;
struct bytetrieapi {
ByteTrieResult (*set)(ByteTrie tree, string key, byte value);
ByteTrieResult (*get)(ByteTrie tree, string key);
ByteTrieResult (*nget)(ByteTrieNode node, string key);
ByteTrieResult (*remove)(ByteTrie tree, string key);
ByteTrieResult (*dirs)(ByteTrie tree, string key);
ByteTrieResult (*objs)(ByteTrie tree, string key);
};
const struct bytetrieapi btrie = { /* Func ptrs */ };
duangsuse::Echo
https://ice1000.org/2017/04/24/JniObjGlobalRef/ 看到字典树,我首先想到的就是 RegularPP 的字符串批量替换功能需要这种数据结构优化.... 😶 但可惜天不遂人愿,C 程序设计语言是不自带 HashMap 的实现的 而且我也懒得再去研究下 HashMap 该怎么写... 据说挺复杂,之前我都没看懂 那么问题来了 class Node(): def __init__(self): self.children = {} …
这里还有类似的 Bitwise Trie
Wikipedia
Trie
In computer science, a trie (/ˈtraɪ/, /ˈtriː/ ⓘ), also known as a digital tree or prefix tree, is a specialized search tree data structure used to store and retrieve strings from a dictionary or set. Unlike a binary search tree, nodes in a trie do not store…
https://github.com/duangsuse/AnalFuck
1+ done
1+ done
做啊
好啊!
啊!啊!
那个啊… 那个啊… 那个啊… 做啊
啊! 啊! 啊!
做啊
来啊!
啊!啊!那个啊… 那个啊… 做啊 做啊
野兽!?
GitHub
duangsuse/AnalFuck
淫夢 BrainFuck 程序设计语言翻译. Contribute to duangsuse/AnalFuck development by creating an account on GitHub.
duangsuse::Echo
qqq.c
其实我之前也写过一个 BF 解释器(
不过流程控制没有那么高层就是了
QQQ 语言使用了特殊的操作符切换开闭括号
不过由于 QQQ 的文档不是很详细,没有理解 BF 的流程控制办法,所以 TQVM 实际上的某操作符实现是错的
不过流程控制没有那么高层就是了
QQQ 语言使用了特殊的操作符切换开闭括号
不过由于 QQQ 的文档不是很详细,没有理解 BF 的流程控制办法,所以 TQVM 实际上的某操作符实现是错的
duangsuse::Echo
冰封大佬也 fork 了?(指女装)
177k...
看来以后除了 C,类 C 的 D 也不失为一个好程序设计语言选项了
看来以后除了 C,类 C 的 D 也不失为一个好程序设计语言选项了
#android #reveng #recommended #dev #learn #java
https://github.com/rk700/YAHFA
Yet Another Hook Framework For ART(Dalvik AOT Mode)
提供了和 Xposed 不一样,和 Cydia Substrate 类似的 Hook 模式,
Xposed 框架则可选替换 Before 和 After (Hooked Method)
Like this
https://github.com/rk700/YAHFA
Yet Another Hook Framework For ART(Dalvik AOT Mode)
提供了和 Xposed 不一样,和 Cydia Substrate 类似的 Hook 模式,
backup() 是覆盖之前的方法 hook() 是替换钩子方法Xposed 框架则可选替换 Before 和 After (Hooked Method)
Like this
public class XposedPlugin implements IXposedHookZygoteInit, IXposedHookLoadPackage {
private static final String methodName = "getText";
private XC_MethodHook getTextHook;
static {
getTextHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {}
};
}
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {}
@Override
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
Class<?> targetClass = XposedHelpers.findClass("org.duangsuse.Test", lpparam.classLoader);
XposedBridge.hookAllMethods(targetClass, methodName, getTextHook);
}
}GitHub
GitHub - PAGalaxyLab/YAHFA: Yet Another Hook Framework for ART
Yet Another Hook Framework for ART. Contribute to PAGalaxyLab/YAHFA development by creating an account on GitHub.
duangsuse::Echo
https://github.com/duangsuse/AnalFuck 1+ done 做啊 好啊! 啊!啊! 那个啊… 那个啊… 那个啊… 做啊 啊! 啊! 啊! 做啊 来啊! 啊!啊!那个啊… 那个啊… 做啊 做啊 野兽!?
花了足足一个小时我学会了什么: #learn
+ AWK & SED 入门
+ Makefile 隐含规则编写
+ git stash 是干嘛的
+ git commit --amead
+ 复习 Vim 基本使用
+ D 语言入门 & LDC 使用
+ 理解 Brainfuck & BF 解释器 分支&循环控制
+ 知道如何翻译日语(会看翻译器
+ 复习淫梦萌百(知识胶囊
+ 我终于第一次修好了别人写的没法编译通过的代码(虽然就是加了四个字符的 typecast)
+ AWK & SED 入门
+ Makefile 隐含规则编写
+ git stash 是干嘛的
+ git commit --amead
+ 复习 Vim 基本使用
+ D 语言入门 & LDC 使用
+ 理解 Brainfuck & BF 解释器 分支&循环控制
+ 知道如何翻译日语(会看翻译器
+ 复习淫梦萌百(知识胶囊
+ 我终于第一次修好了别人写的没法编译通过的代码(虽然就是加了四个字符的 typecast)
#recommended #crystal 这里有一打工程系程序员喜欢的设计模式,我可能过会把它翻译成 Kotlin 再来一遍...
https://github.com/crystal-community/crystal-patterns
https://github.com/bthachdev/crystal-design-patterns
前者比后者少的:
Creation Patterns/Lazy Initialization Pattern
Behavioral patterns/Chain Of Responsibility Pattern
Behavioral patterns/Interpreter Pattern
https://github.com/crystal-community/crystal-patterns
https://github.com/bthachdev/crystal-design-patterns
前者比后者少的:
Creation Patterns/Lazy Initialization Pattern
Behavioral patterns/Chain Of Responsibility Pattern
Behavioral patterns/Interpreter Pattern
GitHub
GitHub - crystal-community/crystal-patterns: :book: Examples of GOF patterns written in Crystal
:book: Examples of GOF patterns written in Crystal - crystal-community/crystal-patterns
duangsuse::Echo
#recommended #crystal 这里有一打工程系程序员喜欢的设计模式,我可能过会把它翻译成 Kotlin 再来一遍... https://github.com/crystal-community/crystal-patterns https://github.com/bthachdev/crystal-design-patterns 前者比后者少的: Creation Patterns/Lazy Initialization Pattern Behavioral patterns/Chain…
(准确的说应该大家都喜欢使用吧,比如 Visitor Pattern 很多 AST 解释器设计者都在使用
#recommended #python #package
PyDIO https://sourceforge.net/projects/ajaxplorer/
基于 Web 2.0 的文件管理器、网盘系统
PyDIO https://sourceforge.net/projects/ajaxplorer/
基于 Web 2.0 的文件管理器、网盘系统
SourceForge
Pydio Cells
Download Pydio Cells for free. Formerly AjaXplorer, file sharing platform for the enterprise. Pydio Cells is the mature open source alternative to dropbox and box, for the enterprise. Why building your own box?
crystal-community/bloom_filter
https://en.wikipedia.org/wiki/Bloom_filter
好耶!是布农过滤器实现! #algorithm #crystal
https://en.wikipedia.org/wiki/Bloom_filter
好耶!是布农过滤器实现! #algorithm #crystal
GitHub
GitHub - crystal-community/bloom_filter: Bloom filter implementation in Crystal lang
Bloom filter implementation in Crystal lang. Contribute to crystal-community/bloom_filter development by creating an account on GitHub.