Skip to content

Instantly share code, notes, and snippets.

View Frityet's full-sized avatar
😁
I LOVE LUA! ❤️

Frityet

😁
I LOVE LUA! ❤️
View GitHub Profile
/usr/local/bin/emcc -c -O0 -IClient/src -IClient/src/include -I/usr/local/Cellar/emscripten/3.1.7/libexec/system/include -Wall -Wextra -Werror -pthread -g -v -fsanitize=address,leak,undefined -fno-omit-frame-pointer -o build/.objs/client/wasm/x86_64/debug/Client/src/main.c.o Client/src/main.c
/usr/local/bin/emcc -c -O0 -IClient/src -IClient/src/include -I/usr/local/Cellar/emscripten/3.1.7/libexec/system/include -Wall -Wextra -Werror -pthread -g -v -fsanitize=address,leak,undefined -fno-omit-frame-pointer -o build/.objs/client/wasm/x86_64/debug/Client/src/rendering/render_main.c.o Client/src/rendering/render_main.c
"/usr/local/Cellar/emscripten/3.1.7/libexec/llvm/bin/clang" -target wasm32-unknown-emscripten -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=1 -D__EMSCRIPTEN_tiny__=7 -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -Werror=implicit-function-declaration -Xclang -iw
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
extern int errno;
#include <pthread.h>
//Compilation does require CURL, so you should compile once, and just use the .dll
namespace CSharpSpeedTest
{
public static class MemoryCopy
{
public static unsafe void Fast(void* dst, void* src, ulong n)
{
var offset = 0;
while (n != 0)
{
if (n % sizeof(ulong) * 8 == 0)
#include <stdio.h>
#include <stdlib.h>
#include <Block.h>
#include "mstring.h"
#define lambda ^
#define make_method(...) Block_copy(lambda __VA_ARGS__)
#define defmethod(name, ...) name = make_method
@Frityet
Frityet / netrequire.lua
Last active June 14, 2022 20:27
(CC only) lets you require lua libraries from the internet!
local mtable = {}
math.randomseed(os.time())
---@class PackageDefinition
---@field url string
---@field name string
---@field cache boolean
local PACKAGE_CACHE_DIR = "cache/pkgcache/"
[GLOBAL STRING_TO_UINTEGER]
;qword STRING_TO_UINTEGER(char str[len], qword len)
STRING_TO_UINTEGER:
MOV RDX, RDI ;RDI is the first argument of any function, so we must save the string address in RDX for scratch
CMP RSI, 0x1
JG .multichar
; If the string is 1 char long, no need to do iterations
MOV DIL, BYTE [RDX]
typedef pthread_t Thread_t;
typedef void Job_f(size_t argc, void **argv);
struct Promise {
bool done;
void *data;
};
struct Job {
struct Job *next;
Vector_create:
push rbp
mov rbp, rsp
mov QWORD PTR [rbp-40], rdi
mov QWORD PTR [rbp-48], rsi
pxor xmm0, xmm0
movaps XMMWORD PTR [rbp-32], xmm0
movq QWORD PTR [rbp-16], xmm0
mov rax, QWORD PTR [rbp-48]
mov QWORD PTR [rbp-32], rax
#pragma once
namespace XTD
{
template<typename T>
using Get_f = T (*)(const T *);
template<typename T>
using Set_f = T &(*)(T *, const T &);
template<typename T>

Composition of Functions

Preamble

Using the equations

$$ f(x) = {1 \over x} $$

and

$$ g(x) = {1 - x} $$