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EEEEFFFFFGGHJLZ[[[[[[[[[UKHGFFEEEEEEEEDDDDDCCCCCCCCC
@miura1729
miura1729 / bf.rb
Last active July 8, 2024 03:26
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));
@miura1729
miura1729 / gp.rb
Last active February 17, 2022 11:39
  graph TD
    N2[5]
    N1[ARRAY] --> |0| N2
    N3["foo"]
    N1[ARRAY] --> |1| N3
    N4[:a]
    N1[ARRAY] --> |2| N4
    N0[Foo] --> |"@a"| N1
 N0[Foo] --&gt; |"@b"| N0