Skip to content

Instantly share code, notes, and snippets.

View Frityet's full-sized avatar
😁
I have like 60 projects that i am not doing

Frityet

😁
I have like 60 projects that i am not doing
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <setjmp.h>
#include <signal.h>
static int sig_to_catch;
static void (^execption_handler)(int sig);
static jmp_buf exception_buffer;
local https = require("ssl.https")
local ltn12 = require("ltn12")
local json = require("json")
local lgi = require("lgi")
local GObject = lgi.require("GObject")
local GTK = lgi.require("Gtk", "3.0")
---@param url string
---@return { [string] : string | number | table }
local function webhook_info(url)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Composition of Functions

Preamble

Using the equations

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

and

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

#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>
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
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;
[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]
@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/"
#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