Skip to content

Instantly share code, notes, and snippets.

View worldOneo's full-sized avatar
🤗
Trying new things

worldOneo

🤗
Trying new things
View GitHub Profile
@worldOneo
worldOneo / index.xml
Created April 6, 2021 15:02
xml to golang cross compiler
<program>
<import>
<lib>fmt</lib>
</import>
<function name="main">
<define name="i">0</define>
<while condition="i &lt; 100">
<call function="fmt.Printf"><arg>"Hello, %d \n"</arg><arg>i</arg></call>
<set name="i">i + 1</set>
@worldOneo
worldOneo / bench.txt
Last active June 24, 2021 20:03
Local flat JSON db. Ab I/O Heavy monster I wrote in an Evening. So no brain was realy used.
goos: windows
goarch: amd64
pkg: github.com/worldOneo/LilMonk
cpu: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Benchmark_lilmonkdb_composite-12 218 7838672 ns/op 2308182 B/op 5140 allocs/op
PASS
ok github.com/worldOneo/LilMonk 2.359s
@worldOneo
worldOneo / pico.c
Created July 3, 2021 14:35
Simple terminal editor, cant read or write files currently, but can edit memory 😉
#include <termios.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
@worldOneo
worldOneo / main.py
Created July 4, 2021 13:37
Python performance test with C++ integration
import mymodule
import random
import time
"""
This is a test for the usecase of C++ integration in python programms.
For small function calls python doesn't gain as much from C++.
But if you keep your entire load in the C++ side, like NumPy, it is much faster.
"""
@worldOneo
worldOneo / ConversionUtility.ts
Created September 5, 2021 21:11
A simple Utility I smashed together for simple conversion between in units with an expressive syntax
/*
ConversionUtility
Copyright (C) 2021 WorldOneo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@worldOneo
worldOneo / linkedlist.c
Created January 14, 2022 18:16
Simple trie implementation in C
#include <stdlib.h>
struct LinkedList
{
void *value;
struct LinkedList *next;
};
struct LinkedList *linked_list_new()
{
@worldOneo
worldOneo / fuzzy.rs
Last active February 15, 2022 22:46
FuzzySearch engine using BK-Tree written in Rust.
use std::fmt::Debug;
use std::io::{stdout, Write};
use std::{collections::HashMap, env, fs, io, time::Instant};
#[derive(Debug)]
struct FuzzyNode<T>
where
T: Clone,
{
value: Option<(String, T)>,
@worldOneo
worldOneo / ngram.rs
Created February 17, 2022 19:11
Simple, fast ngram index written in rust
use std::collections::BinaryHeap;
use std::fmt::Debug;
use std::vec;
use std::{collections::HashMap, io, time::Instant};
#[derive(Debug)]
struct NGramMeta<T: Clone + PartialEq> {
bind: T,
document: Vec<String>,
freq: f64,
@worldOneo
worldOneo / generator.js
Created March 4, 2022 15:32
Simple UID generator for JavaScript with logic to ensure uniqueness.
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890+@".split("");
const maxBase = n => {
let r = "";
while (n) {
r += chars[n & 63];
n = n/64|0;
}
return r;
};
@worldOneo
worldOneo / table.c
Created May 11, 2022 16:12
Simple (hash) table written in C ~10ns lookups
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef uint64_t u64;
typedef struct Table
{
u64 nullValue;
bool hasNull;