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 <cxxabi.h>
#include <execinfo.h>
#include <format>
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
#define println(...) puts(std::format(__VA_ARGS__).c_str())
struct HijackEntryBase {

Hand-Written C11 Parser with AST and API

The request is for a comprehensive C11 parser with syntactic parsing, an AST, and traversal API. Other specifics include lexing, parsing from scratch, and a detailed main program for testing.

Searched for handwritten C parser C11 example

#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface HTMLNode : NSObject
@property (nonatomic, copy) NSString *tag;
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSString *> *attributes;
@property (nonatomic, strong) NSMutableArray *children;
+ (instancetype)element: (NSString *)tag;
// Helper function to calculate the size of a type based on its encoding
size_t sizeForEncoding(const char *encoding) {
switch (*encoding) {
case 'c': return sizeof(char);
case 's': return sizeof(short);
case 'i': return sizeof(int);
case 'q': return sizeof(long);
case 'Q': return sizeof(size_t);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdint.h>
#include <sys/mman.h>
#include <unistd.h>
#pragma clang assume_nonnull begin
-- Constants for chunk size
local arg = {...}
---@param called string
---@return (string | integer)?
local function get_arg(called)
local tofind = "--"..called
for i, v in ipairs(arg) do
if v == tofind then
local val = arg[i+1]
local socket = require("socket")
local xml_gen = require("x-gen")
local xml = xml_gen.xml
---@param document XML.Node
local function build_response(document)
local str = "<!DOCTYPE html>"..tostring(document)
return ([[
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: %d
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <stdbool.h>
@Frityet
Frityet / CArray.h
Last active March 30, 2024 20:23
Objective C Carray
#import <ObjFW/ObjFW.h>
OF_ASSUME_NONNULL_BEGIN
#define $_concat(a, b) a##b
#define $concat(...) $_concat(__VA_ARGS__)
#if !defined($carray_name)
# define $carray_name(T) $concat(T, Array)
@Frityet
Frityet / README.md
Last active March 21, 2025 14:22
Installing Lua (and wlua!) + Luarocks on native Windows (not WSL)

Installing Lua (and wlua!) + Luarocks on native Windows (not WSL)

This guide will go through the FULL process of installing Lua + MinGW + Luarocks on native Windows. This guide is for those who want to use Lua on Windows without WSL and want everything to work well. By the way, it would be greatly appreciated if anyone wants to make a script that does all of this.

Windows versions

I am only targeting Windows 10/11 in this tutorial, specifically ucrt. If you are using Windows 10/11, ignore this. If you use a different version, you will probably be using msvcrt, so you can skip the steps where I switch Luarocks to ucrt.

Step 1: MinGW