Skip to content

Instantly share code, notes, and snippets.

Avatar
🏍️
chuck chuck yeager

Shota Takizawa miyakelp

🏍️
chuck chuck yeager
View GitHub Profile
@miyakelp
miyakelp / hello.c
Last active Jun 19, 2019
HelloWorld
View hello.c
#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) {
@miyakelp
miyakelp / scikit_learn_randomforest_to_verilog.py
Last active May 19, 2021
scikit_learn_randomforest_to_verilog.py
View 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 / sparksql_please.diff
Last active Apr 1, 2021
sparksql_please.diff
View 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_pipeline_fragment.py
Created Apr 3, 2021
scikit_learn_randomforest_to_verilog_pipeline_fragment.py
View 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]