This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ************************************************************************** */ | |
/* */ | |
/* :::::::: */ | |
/* main.c :+: :+: */ | |
/* +:+ */ | |
/* By: dpattij <dpattij@student.codam.nl> +#+ */ | |
/* +#+ */ | |
/* Created: 2020/01/11 21:49:38 by dpattij #+# #+# */ | |
/* Updated: 2020/01/25 18:55:48 by dpattij ######## odam.nl */ | |
/* */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdarg.h> | |
int ft_isdigit(char c) | |
{ | |
return (c >= '0' && c <= '9'); | |
} | |
int ft_asdigit(char c) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define STATUS_ERROR -1 | |
#define EOF -1 | |
int pr_getc(int fd, char *c) | |
{ | |
static char buffer[256]; | |
static int head; | |
static int max; | |
if (head == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fcntl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "get_next_line.h" | |
#include <execinfo.h> | |
int ptrcnt = 0; | |
typedef struct despacito { | |
void *ptr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Array = {}; | |
local function lerrorf(l, s, ...) | |
error(string.format(s, ...), l + 1); | |
end | |
function Array.new(size) | |
local new = | |
{ | |
size = size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create instruction | |
local function inst_bytecode(opcode, ...) | |
local args={...} | |
return { | |
OPCODE = opcode, | |
ARGS = args | |
} | |
end | |
-- Generate closure from instruction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on https://www.lua.org/manual/5.3/manual.html | |
// (specifically chapter 3: https://www.lua.org/manual/5.3/manual.html#3) | |
// ignores the goto related things | |
program = { SOI ~ block ~ EOI } | |
// this is also a variable | |
identifier = @{ ( ASCII_ALPHA | "_" ) ~ ( ASCII_ALPHANUMERIC | "_" )+ } | |
// keywords |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
use winapi::minwindef::{LPVOID, DWORD, PDWORD}; | |
fn main() { | |
let address = 0xDEADBEEF; // in practice i know the address is right ok, just trust me. | |
let old_protect: DWORD = 0; | |
let t = unsafe { kernel32::VirtualProtect(address as LPVOID, 1, 0x40, old_protect as PDWORD) }; | |
println!("results: {}, {}", old_protect, t); // "t" returns 0, but I don't know why t.t | |
} |