Skip to content

Instantly share code, notes, and snippets.

View abcarroll's full-sized avatar

A.B. Carroll III abcarroll

View GitHub Profile
#include <stdlib.h>
#include <stdio.h>
//#include "test.h"
/**
* The following two struct's are basically an interface.
*/
// The VTable which will only ever be a single copy (normally)
struct _SomeClass_VTable
@abcarroll
abcarroll / ulopcodes.ll
Created November 10, 2020 02:13
An example PHP extension (ulopcodes) as LLVM IR
; ModuleID = '/home/ab/sail/project/sail-php-driver/ulopcodes.c'
source_filename = "/home/ab/sail/project/sail-php-driver/ulopcodes.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._zend_ulopcodes_globals = type { i8, i8 }
%struct._zend_ini_entry_def = type { i8*, i32 (%struct._zend_ini_entry*, %struct._zend_string*, i8*, i8*, i8*, i32)*, i8*, i8*, i8*, i8*, void (%struct._zend_ini_entry*, i32)*, i32, i16, i8 }
%struct._zend_ini_entry = type { %struct._zend_string*, i32 (%struct._zend_ini_entry*, %struct._zend_string*, i8*, i8*, i8*, i32)*, i8*, i8*, i8*, %struct._zend_string*, %struct._zend_string*, void (%struct._zend_ini_entry*, i32)*, i32, i8, i8, i8 }
%struct._zend_string = type { %struct._zend_refcounted_h, i64, i64, [1 x i8] }
%struct._zend_refcounted_h = type { i32, %union.anon }
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
//void _dump_debug_trace() {}
//void _dump_string(void *pointerToString) {}
// This will work for GCC and clang for x64
// #define GET_STACK_POINTER(NAME) uintptr_t NAME; asm("mov %%rsp, %0": "=r" ( NAME ));
@abcarroll
abcarroll / results.txt
Last active September 13, 2020 02:32
Sail Language "With" Syntax
I have the lock!
15
I am loosing the lock!
Exception: the universe has imploded [test.sail:18]
ab@tower:~/vxx$ echo "drop database xxx" | sudo mysql
ab@tower:~/vxx$ echo "create database if not exists xxx; use xxx; create table if not exists a( b blob ); insert into a (b) values(X'000a0af0ffdeadbeef');" | sudo mysql
ab@tower:~/vxx$ echo "select * from xxx.a" | sudo mysql --raw -b > data
ab@tower:~/vxx$ hd data
00000000 62 0a 00 0a 0a f0 ff de ad be ef 0a |b...........|
0000000c
@abcarroll
abcarroll / install-php-interactive
Created February 12, 2020 18:45
Interactive tool to install PHP on Debian based systems, including Ubuntu.
#!/bin/bash
# ----
# Written By
# A.B. Carroll <ben@hl9.net>,
# Feb. 2020
#
# Released under the terms of "the Unlicense"
# For the complete license text, please see <http://unlicense.org/>
# ----
################################################################################
# GnuPG Options
# (OpenPGP-Configuration-Options)
# Assume that command line arguments are given as UTF8 strings.
utf8-strings
# (OpenPGP-Protocol-Options)
# Set the list of personal digest/cipher/compression preferences. This allows
# the user to safely override the algorithm chosen by the recipient key

Keybase proof

I hereby claim:

  • I am abcarroll on github.
  • I am abcarroll (https://keybase.io/abcarroll) on keybase.
  • I have a public key ASAhT727elb659EW9C3mKARuRLgT425R_zljDyY25EIh6go

To claim this, I am signing this object:

@abcarroll
abcarroll / lmdb.tcl
Created November 9, 2019 06:10 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@abcarroll
abcarroll / lmdb.tcl
Created November 9, 2019 06:10 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!