Skip to content

Instantly share code, notes, and snippets.

View miyakelp's full-sized avatar
🏍️
chuck chuck yeager

Shota Takizawa miyakelp

🏍️
chuck chuck yeager
View GitHub Profile
@miyakelp
miyakelp / scikit_learn_randomforest_to_verilog_pipeline_fragment.py
Created April 3, 2021 08:55
scikit_learn_randomforest_to_verilog_pipeline_fragment.py
# rf = scikit-learnのRandomForest
from collections import deque
def get_leaf_labels(tree, depth):
leaf_min_index = 2 ** (depth) - 1
features =[-1] * (2 ** (depth) - 1)
labels = [-1] * 2 ** depth
tree_labels = np.argmax(tree.value.T, axis=0)[0]
@miyakelp
miyakelp / sparksql_please.diff
Last active April 1, 2021 15:26
sparksql_please.diff
diff --git a/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 b/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
index 55ba375..c4bbea8 100644
--- a/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
+++ b/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
@@ -531,8 +531,12 @@ transformClause
(RECORDREADER recordReader=STRING)?
;
+pleasePhrase
+ : PLEASE
@miyakelp
miyakelp / scikit_learn_randomforest_to_verilog.py
Last active December 14, 2022 20:45
scikit_learn_randomforest_to_verilog.py
def create_tree_function_wire(name, tree, num_skip = 2):
result_str = ''
skip = ' ' * num_skip
skip2 = skip * 2
skip3 = skip * 3
result_str += skip + "function [9:0] %s;\n" % (name)
result_str += skip2 + "input [783:0] pixel;\n"
result_str += "\n"
for node in range(len(tree.feature)):
if tree.feature[node] >= 0:
@miyakelp
miyakelp / hello.c
Last active June 19, 2019 00:48
HelloWorld
#include <stdio.h>
#include <stdlib.h>
void main2(void) {
unsigned n;
((int (*)(void))(*(int (**)(void))(&n + 3)))();
exit(0);
}
int main(int argc, char **argv) {