Skip to content

Instantly share code, notes, and snippets.

View ifarbod's full-sized avatar
🙃
PAGE_FAULT_IN_NONPAGED_AREA

iFarbod ifarbod

🙃
PAGE_FAULT_IN_NONPAGED_AREA
View GitHub Profile
@ifarbod
ifarbod / sigmaker_minimal.py
Last active March 13, 2025 15:55
IDA Pro plugin, SIGMaker remade with IDAPython, tested with ida 9.
import ida_ua
import ida_funcs
import ida_name
import ida_idaapi
import ida_kernwin
import ida_bytes
def bit(n):
return 1 << n
@ifarbod
ifarbod / deleted_rows_count-trigger.sql
Created May 21, 2023 21:53
count the number of deleted rows using an after-delete trigger
-- count the number of deleted rows using an after-delete trigger
-- sql server 2019
CREATE TABLE Orders (
OrderID int IDENTITY (1, 1) NOT NULL,
Names nchar (15) NULL,
)
GO CREATE TRIGGER Deleted ON Orders FOR DELETE AS
DECLARE @Count int
SELECT @Count = COUNT(*)
FROM DELETED IF @Count > 0 BEGIN PRINT @Count
@ifarbod
ifarbod / android_thermal_sensors.py
Last active March 24, 2023 13:48
Print thermal sensor name and values.
import subprocess
for i in range(0, 95):
print(f"#{i}")
subprocess.run(f"adb shell cat /sys/class/thermal/thermal_zone{i}/type")
temp = int(subprocess.run(f"adb shell cat /sys/class/thermal/thermal_zone{i}/temp", capture_output=True).stdout.decode("utf-8"))
print(temp / 1000)
@ifarbod
ifarbod / bench_fmt.cpp
Created June 4, 2022 20:59
Benchmark std::format vs fmt::format
// Copyright (c) 2018-2022 iFarbod and other contributors. All Rights Reserved.
//
// SPDX-License-Identifier: MIT
#include <format>
#include <vendor/benchmark/include/benchmark/benchmark.h>
#define FMT_USE_FULL_CACHE_DRAGONBOX 1
#include <vendor/fmt/include/fmt/format.h>
@ifarbod
ifarbod / vs2022_mdd_ndk_r23_patch.md
Created April 16, 2022 20:34
Change needed for NDK r23 to work on VS 2022

Path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Application Type\Android\3.0

22c22
<     <ToolchainPrebuiltRoot_x64_Present Condition="'$(ToolchainPrebuiltRoot_x64_Present)' == '' and '$(HostTag)' == '' and Exists('$(VS_NdkRoot)\toolchains\$(LLVMName)\prebuilt\windows-x86_64') and Exists('$(VS_NdkRoot)\toolchains\$(ToolchainName)-$(ToolchainVersion)\prebuilt\windows-x86_64')">true</ToolchainPrebuiltRoot_x64_Present>
---
>     <ToolchainPrebuiltRoot_x64_Present Condition="'$(ToolchainPrebuiltRoot_x64_Present)' == '' and '$(HostTag)' == '' and Exists('$(VS_NdkRoot)\toolchains\$(LLVMName)\prebuilt\windows-x86_64')">true</ToolchainPrebuiltRoot_x64_Present>

The reason for this is that the second condition is not met, thus not setting ToolchainPrebuiltRoot_x64_Present to true, making HostTag return windows.

// from this
template <typename T, typename U>
inline T Lerp(const T& a, const T& b, const U& t)
{
return a * (1.0 - t) + b * t;
}
// to this:
@ifarbod
ifarbod / find_dxsdk.lua
Created March 15, 2017 23:46
look for dxsdk
-- just do 'dofile()' on this and call the functions
-- should correct the legacy dx sdk fine on most systems
--require "utils"
--included here:
function os.file_exists(name)
local f = io.open(name, "r")
if f ~= nil then
io.close(f)
function findRotation(x1,y1,x2,y2)
local t = -math.deg(math.atan2(x2-x1,y2-y1))
if t < 0 then t = t + 360 end;
return t;
end
// TimecycConverter.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <cstdint>
struct TColour
{
uint32_t bRed;
uint32_t bGreen;
#include <Windows.h>
#include <iostream>
#include <string>
#include <cstdint>
#include <vector>
#include <tchar.h>
#include <stdio.h>
struct IplInstEntry
{