Skip to content

Instantly share code, notes, and snippets.

View vaiorabbit's full-sized avatar
🎮
busy playing video games

vaiorabbit

🎮
busy playing video games
View GitHub Profile
@vaiorabbit
vaiorabbit / ClassDiagram.plantuml
Created June 9, 2019 13:44
UMLモデリングのエッセンス 第3版 図3.1
@startuml
skinparam linetype ortho
/' skinparam groupInheritance 1 '/
class Order
{
- dataReceived: Date[0..1]
- isPrepaid: Boolean[1]
- number: String[1]
@vaiorabbit
vaiorabbit / NNDemo.cpp
Created September 29, 2018 14:25
Two-layer fully-connected neural network with numerical differentiation
#include <algorithm> // std::max (C++14)
#include <cmath>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <Eigen/Dense>
////////////////////////////////////////////////////////////////////////////////////////////////////
@vaiorabbit
vaiorabbit / one_image.html
Last active November 18, 2017 05:32
leaflet.js : Load one file with 'imageOverlay'
<html>
<head>
<title>leaflet.js : Load one file with 'imageOverlay'</title>
<!-- http://leafletjs.com/download.html -->
<!-- Use local -->
<!--
<link rel="stylesheet" href="./leaflet/leaflet.css" />
<script src="./leaflet/leaflet.js"></script>
-->
<!-- Use remote -->
@vaiorabbit
vaiorabbit / conv2dtest.py
Last active November 12, 2017 10:11
tf.nn.conv2d
import numpy as np
import tensorflow as tf
x_in = np.array([
[
[[2], [1], [2], [0], [1]],
[[1], [3], [2], [2], [3]],
[[1], [1], [3], [3], [0]],
[[2], [2], [0], [1], [1]],
[[0], [0], [3], [1], [2]],
@vaiorabbit
vaiorabbit / userChrome.css
Created October 29, 2017 05:20
Hiding Firefox tabs with userChrome.css
/*
- To hide Firefox tabs, paste below into your userChrome.css .
- If you don't have one, create it as Profiles/(your prof)/chrome/userChrome.css
*/
#tabbrowser-tabs {
visibility: collapse !important;
}
@vaiorabbit
vaiorabbit / nuklear.ast
Created December 18, 2016 08:03
[Experimental] Collecting '#define'd numerical values from nuklear.h (see 'def collect_decl_macro')
{'NK_BUTTON_BEHAVIOR_STACK_SIZE': '8',
'NK_CHART_MAX_SLOT': '4',
'NK_COLOR_STACK_SIZE': '32',
'NK_FLAGS_STACK_SIZE': '32',
'NK_FLOAT_STACK_SIZE': '32',
'NK_FONT_STACK_SIZE': '8',
'NK_INCLUDE_DEFAULT_ALLOCATOR': '1',
'NK_INCLUDE_FONT_BAKING': '1',
'NK_INCLUDE_VERTEX_BUFFER_OUTPUT': '1',
'NK_INPUT_MAX': '16',
@vaiorabbit
vaiorabbit / nuklear.ast
Created December 12, 2016 14:05
[Experimental] Collecting struct/union information from nuklear.h
STRUCT_DECL : nk_buffer (Forward Declaration)
STRUCT_DECL : nk_allocator (Forward Declaration)
STRUCT_DECL : nk_command_buffer (Forward Declaration)
STRUCT_DECL : nk_draw_command (Forward Declaration)
STRUCT_DECL : nk_convert_config (Forward Declaration)
STRUCT_DECL : nk_style_item (Forward Declaration)
STRUCT_DECL : nk_text_edit (Forward Declaration)
STRUCT_DECL : nk_draw_list (Forward Declaration)
STRUCT_DECL : nk_user_font (Forward Declaration)
STRUCT_DECL : nk_panel (Forward Declaration)
@vaiorabbit
vaiorabbit / nuklear.ast
Last active December 12, 2016 14:05
[Experimental] Collecting enum values from nuklear.h
{'anonymous_enum_0': [('nk_false', 0), ('nk_true', 1)],
'nk_allocation_type': [('NK_BUFFER_FIXED', 0), ('NK_BUFFER_DYNAMIC', 1)],
'nk_anti_aliasing': [('NK_ANTI_ALIASING_OFF', 0), ('NK_ANTI_ALIASING_ON', 1)],
'nk_buffer_allocation_type': [('NK_BUFFER_FRONT', 0),
('NK_BUFFER_BACK', 1),
('NK_BUFFER_MAX', 2)],
'nk_button_behavior': [('NK_BUTTON_DEFAULT', 0), ('NK_BUTTON_REPEATER', 1)],
'nk_buttons': [('NK_BUTTON_LEFT', 0),
('NK_BUTTON_MIDDLE', 1),
('NK_BUTTON_RIGHT', 2),
@vaiorabbit
vaiorabbit / nuklear_preprocessor.py
Created December 10, 2016 16:05
[Experimental] Extract constants defined as preprocessor macros in nuklear.h ( https://github.com/vurtun/nuklear ).
import re, subprocess, sys
if __name__ == "__main__":
cmd = "/usr/local/Cellar/llvm/3.9.0/bin/clang -dM -E %s" % (sys.argv[1])
output = subprocess.check_output(cmd.strip().split(" "))
define_lines = output.split("\n")
for define_line in define_lines:
macro_tokens = define_line.split(" ")
if len(macro_tokens) != 3:
continue
@vaiorabbit
vaiorabbit / SDL_pixels.h.ast
Created December 10, 2016 09:15
[Experimental] Syntactic analysis of SDL header with Clang Python bindings.
TRANSLATION_UNIT : /Users/foo/Libs/SDL2-2.0.5/include/SDL_pixels.h
FUNCTION_DECL : SDL_GetPlatform()
VISIBILITY_ATTR : default
ENUM_CONSTANT_DECL : SDL_FALSE
INTEGER_LITERAL :
ENUM_CONSTANT_DECL : SDL_TRUE
INTEGER_LITERAL :
TYPEDEF_DECL : SDL_bool
ENUM_DECL :
ENUM_CONSTANT_DECL : SDL_FALSE