Skip to content

Instantly share code, notes, and snippets.

@diorcety
diorcety / thiscall.py
Created August 19, 2024 12:38 — forked from ess7/thiscall.py
Calling a thiscall DLL function in Python ctypes (x86)
import ctypes
def _thiscallcode(address):
buf = ctypes.windll.kernel32.VirtualAlloc(0, 4096, 0x3000, 0x40)
# Stack: ret addr, this, arg1, arg2, ...
# [esp] [esp+4] ...
code = b""
# code += b"\xcc"
code += b"\x8b\x4c\x24\x04" # mov ecx, dword ptr [esp+4]
code += b"\x8F\x04\x24" # pop dword ptr [esp+0]
@diorcety
diorcety / main.c
Last active February 9, 2024 08:59
STM32 RDP without POR
/* From https://www.youtube.com/watch?v=f7vs0NwZPFo */
/*
* Warning -> if you use IWDG !
* EraseChip + POR + Flash -> will hang
* BlankChip + Flash -> will hang
* EraseChip + Flash -> may work
*
* In order to make it works you should do:
@diorcety
diorcety / gist:c0655671889013035d4f1f14707603f3
Created July 21, 2023 10:56 — forked from antonpiatek/gist:c74991f7ec54126fc91dd66a290d7520
A jenkins script to clean up workspaces on slaves
// find old workspace folders on any node (master/slave)
// currently only look for deleted branches of multibranch (pipeline?) jobs, and remove them
// also finds builds older than 90 days. Set flags below to true to actually do deletes
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
// ==UserScript==
// @name AliExpress Orders to CSV "DragonCity" V3
// @match https://trade.aliexpress.com/orderList.htm*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==
// Thanks for your scripts : https://gist.github.com/naixx/9929f308bfc0aac649d7c48c4a510737
#include <iostream>
#include <memory>
#include <chrono>
#include <thread>
#include <rxcpp/rx.hpp>
struct Abcd {
Abcd() {
#include <iostream>
#include <memory>
#include <chrono>
#include <thread>
#include <rxcpp/rx.hpp>
struct Abcd {
Abcd() {
#include <iostream>
#include <memory>
#include <rxcpp/rx.hpp>
struct Abcd {
Abcd() {
printf("Abcd\n");
}
@diorcety
diorcety / gist:7473146
Created November 14, 2013 19:46
Mimeparser
"""
RESTful resource variant selection using the HTTP Content-Type.
"""
__version__ = '0.5.3'
__author__ = 'Martin Blech <[email protected]>'
__license__ = 'MIT'
import mimeparse
from functools import wraps
@diorcety
diorcety / firebreath_issue_macosx
Created June 4, 2012 15:43
Firebreath strange issue on Mac OSX
uild ydiorcet$ xcodebuild
=== BUILD AGGREGATE TARGET ZERO_CHECK OF PROJECT FireBreath WITH THE DEFAULT CONFIGURATION (Debug) ===
Check dependencies
PhaseScriptExecution "CMake Rules" build/FireBreath.build/Debug/ZERO_CHECK.build/Script-F9871725903B4B3682C6E1F6.sh
cd /Users/ydiorcet/Desktop/firebreath-1.6
/bin/sh -c /Users/ydiorcet/Desktop/firebreath-1.6/build/FireBreath.build/Debug/ZERO_CHECK.build/Script-F9871725903B4B3682C6E1F6.sh
echo ""
make -f /Users/ydiorcet/Desktop/firebreath-1.6/build/CMakeScripts/ReRunCMake.make