Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include "findMaxP.h"
int getSizeForMax() {
return 10000;
}
int findMaxP(int length, int arr[]) {
@Schroedi
Schroedi / gist:45d6af3f4500df76459d
Last active August 29, 2015 14:10
sloppy mouse for tag switching in awesome wm
-- global timer that runs once and focuses the window currently under the mouse pointer
sloppytimer = timer({ timeout = 0.01 })
sloppytimer:connect_signal("timeout", function()
c = awful.mouse.client_under_pointer(screen)
if c then
client.focus = c
c:raise()
end
sloppytimer:stop()
end)
@Schroedi
Schroedi / passiveDump.patch
Created February 10, 2022 15:59
PoB dump passives
diff --git a/runtime-win32.zip b/runtime-win32.zip
deleted file mode 100644
index 2fd1fff6..00000000
Binary files a/runtime-win32.zip and /dev/null differ
diff --git a/src/Classes/PassiveSpec.lua b/src/Classes/PassiveSpec.lua
index e34f723d..e4c8cce2 100644
--- a/src/Classes/PassiveSpec.lua
+++ b/src/Classes/PassiveSpec.lua
@@ -13,6 +13,18 @@ local m_max = math.max
local m_floor = math.floor
// Automate the settings window for debugging
// e.a. automatically expand the Plugins section and select the plugin you are currently working on
public void Initialize()
{
LokiPoe.OnGuiTick += OnGuiTickEvent;
}
private static void OnGuiTickEvent(object sender, GuiTickEventArgs e)
{
@Schroedi
Schroedi / DPBFastMoveFromInvNoAffinity.cs
Created July 7, 2022 10:57
Fast move an item from the inventory holding shift to ignore tab affinity
public static FastMoveResult FastMoveFromInvNoAffinity(int itemLocalId)
{
if (!LokiPoe.ProcessHookManager.IsEnabled)
{
return FastMoveResult.ProcessHookManagerNotEnabled;
}
LokiPoe.ProcessHookManager.ClearAllKeyStates();
var inventorySlotUiElement = LokiPoe.InGameState.InventoryUi.InventoryControl_Main.InventorySlotUiElement;
@Schroedi
Schroedi / FreezePoe.cs
Created July 14, 2022 10:07
Freeze and unfreeze PoE to use DPB's ObjectExplorer without hurry.
public static partial class KeksTools
{
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool DebugActiveProcess(uint dwProcessId);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool DebugActiveProcessStop(uint dwProcessId);
private static bool WasHooked = false;
@Schroedi
Schroedi / TerrainToPng.cs
Created July 20, 2022 05:24
Save PoE map to png
/// <summary>
///
/// </summary>
/// <param name="filename"></param>
/// <param name="data">LokiPoe.TerrainData.Layer0</param>
/// <param name="terrainSize">LokiPoe.TerrainData.Size</param>
/// <param name="bpr">LokiPoe.TerrainData.BytesPerRow</param>
public static void GeneratePng(string filename, ref byte[] data, Vector2i terrainSize, int bpr)
{
Color TerrainColor(int v)
@Schroedi
Schroedi / Patch.cs
Last active July 29, 2022 12:54
Time all Run methods in dpb and print if they take more than 100ms. Uses https://github.com/pardeike/Harmony
using System;
using System.Linq;
using DreamPoeBot.Loki.Bot;
using DreamPoeBot.Loki.Common;
using HarmonyLib;
namespace kekslib
{
public static partial class KeksTools
{
@Schroedi
Schroedi / Gui.xaml
Created August 3, 2022 06:43
Theme the Property grid from http://www.codeproject.com/KB/grid/WpfPropertyGrid.aspx for use in DPB settings
<wpg:WpfPropertyGrid HelpVisible="False" Margin="5, 0, 0, 0" x:Name="PropertyGrid1" Width="350" Height="400"/>
@Schroedi
Schroedi / ElementFromPath.cs
Created September 13, 2022 10:19
Get the element from the string produced by DumpFrameUnderCursor
public static Element ElementFromPath(string path)
{
if (!path.StartsWith("root"))
{
Log.Error("[ElementFromPath] Path must start with root: root.Children[1].Children[102]");
return null;
}
path = path.Substring("root.".Length);
// remove tailing .
if (path.EndsWith("."))