Skip to content

Instantly share code, notes, and snippets.

@miura1729
miura1729 / bf2.c
Created July 12, 2024 09:09
compiled bf by mmc
#include <mruby.h>
#include <mruby/value.h>
#include <mruby/array.h>
#include <mruby/hash.h>
#include <mruby/throw.h>
#include <mruby/proc.h>
#include <mruby/string.h>
#include <mruby/range.h>
#include <mruby/error.h>
#include <mruby/variable.h>
@miura1729
miura1729 / result.rb
Last active July 7, 2024 23:46
profiler result
AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDEGFFEEEEDDDDDDCCCCCCCCCBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDEEEFGIIGFFEEEDDDDDDDDCCCCCCCCCBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAABBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDEEEEFFFI[KHGGGHGEDDDDDDDDDCCCCCCCCCBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAABBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDEEEEEFFGHIMTKLZOGFEEDDDDDDDDDCCCCCCCCCBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAABBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDEEEEEEFGGHHIKPPKIHGFFEEEDDDDDDDDDCCCCCCCCCCBBBBBBBBBBBBBBBBBBBAAAAAAAAAABBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDEEEEEEFFGHIJKS[[X[KHHGFEEEEEDDDDDDDDDCCCCCCCCCCBBBBBBBBBBBBBBBBBAAAAAAAAABBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDEEEEEEFFGQPUVOTY[[[ZQL[MHFEEEEEEEDDDDDDDCCCCCCCCCCCBBBBBBBBBBBBBBBAAAAAAAABBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDEEEEEFFFFFGGHJLZ[[[[[[[[[UKHGFFEEEEEEEEDDDDDCCCCCCCCC
@miura1729
miura1729 / bf.rb
Last active July 9, 2024 03:33
bf in Ruby
PROG = " A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+
<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>
>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>>
>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>>
>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>>
>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>
[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<<<<<<<[<<<<<<<
<<]>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<<<]>>>>>>>>>+++++++++++++++[[
@miura1729
miura1729 / mhash.c
Last active October 13, 2023 09:23
Can store 64000 data in 65536 buckets
#include "wyhash32.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int mh_key_t;
typedef int mh_value_t;
int pure;
@miura1729
miura1729 / mhash.c
Created September 30, 2023 08:22
Can store 8192 datas in 8192 buckets.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int mh_key_t;
typedef int mh_value_t;
typedef struct mhash {
uint64_t *exists;
@miura1729
miura1729 / mhash.c
Created September 28, 2023 09:10
Can large hash table
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int mh_key_t;
typedef int mh_value_t;
typedef struct mhash {
uint64_t *exists;
@miura1729
miura1729 / mhash.c
Created September 24, 2023 02:26
can 64 entry in 64bucket
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int key_t;
typedef int value_t;
typedef struct mhash {
uint64_t exists;
uint64_t origin;
@miura1729
miura1729 / mhash.c
Last active September 23, 2023 11:47
1st version 24 entry on 32 buckets
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int key_t;
typedef int value_t;
typedef struct mhash {
uint64_t exists;
uint64_t origin;
def ast2str(node)
case node.type
when :SCOPE
tbl, args, body = node.children
"(#{tbl.map {|e| e.to_s}.join(" ,")}) \n #{ast2str(body)}"
when :ARGS
p node.children[1]
p node.children
"()"
main() {
printf("%d\n ", mod5(1));
printf("%d\n ", mod5(2));
printf("%d\n ", mod5(3));
printf("%d\n ", mod5(4));
printf("%d\n ", mod5(5));
printf("%d\n ", mod5(11));
printf("%d\n ", mod5(32));
printf("%d\n ", mod5(10));
printf("%d\n ", mod5(15));