Skip to content

Instantly share code, notes, and snippets.

View cristeigabriel's full-sized avatar
🏠
fixing merge conflicts in notepad

Cristei Gabriel-Marian cristeigabriel

🏠
fixing merge conflicts in notepad
View GitHub Profile
@cristeigabriel
cristeigabriel / error_print_code_for_mastodon.cc
Created January 5, 2024 02:04
error print code for mastodon
#include <windows.h>
#include <cstdio>
static LPWSTR getErrorStr(DWORD code) {
LPWSTR buffer = nullptr;
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
nullptr, code, LANG_USER_DEFAULT, (LPWSTR)&buffer, 0,
nullptr);
return buffer;
}
@cristeigabriel
cristeigabriel / Getting custom colored Windows taskbar progress - Hacking Explorer and StartIsBack.md
Last active December 26, 2023 21:51
Getting custom colored Windows taskbar progress - Hacking Explorer and StartIsBack

So, one of my latest distractions was making Windows' taskbar progress custom colored. I personally already use StartIsBack, but it has no such option (by default.) So, how do we go about it? I decided to start from Explorer, as it is responsible for the taskbar in itself, and StartIsBack itself hooks into Explorer's painting code to draw everything by itself, with all the context that Explorer has gathered for it.

The following will be a recollection of how my debugging session started off, and how I eventually ended up in the right place:

  • We know that taskbar progress is handled through ITaskbarList3 [guid ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf], respectively by it's SetProgressValue and SetProgressState functions, so let's look for that...
  • Ok, we have the PDB... so let's look for "Progress"... bingo, CTaskItem::GetProgressState
  • Information available from here was exactly what I needed, but I personally lost more time debugging the flow of the whole taskbar d
@cristeigabriel
cristeigabriel / AUTOMATICALLY-TRANSCRIBING-A-YOUTUBE-CHANNELS-VIDEOS.md
Last active October 9, 2023 09:17
Automatically transcribing a YouTube channel's videos

The following document presents the process of scraping some videos from YouTube, downloading them to an appropriately named file, then transcribing them.

In my scenario, I want to do this for the NT YouTube channel, as I find it to be a wealth of first-hand knowledge, but the only set-back is that it is not in text form, and the fact that the videos seem to have been shot in the late 2000s/early 2010s doesn't do that any justice.

In this procedures, we will be using JavaScript (to handle the video scraping, directly in the Dev Console of Google Chrome), and Python, to subsequently achieve the goals stated above.

First, let's gather a list of pairs of the video title and it's URL. We will first go to the YouTube channel and load in all of the videos. Thankfully, YouTube doesn't update the page schema depending on where you're looking in the page (as opposed to web applications such as Discord, which, annoyingly, do just that), therefore upon loading all of the videos wh

@cristeigabriel
cristeigabriel / luavm.h
Last active March 25, 2023 19:58
[C++] CS2 Lua VM structure for leak, address
class IScriptVM {
public:
virtual ~IScriptVM() = 0;
};
class CLuaVM : public IScriptVM {
public:
virtual ~CLuaVM() = 0; // vftable
virtual bool __fastcall Initialize() = 0;
@cristeigabriel
cristeigabriel / atoi.rkt
Last active July 11, 2022 11:11
Scheme Lisp compatible atoi imlpementation. Handles negation and trailing zeros.
#lang sicp
;; power impl
;; x - number
;; y - power
;; z - preserved base
(define (^-impl x y z) (if (<= y 0)
x
(^-impl (* z x) (- y 1) z)))
@cristeigabriel
cristeigabriel / code.cc
Last active July 10, 2021 22:14
uint32_t endianness swap
constexpr auto byte_swap_32bit(uint32_t bytes)
{
return (uint32_t)(bytes << 16) | (uint32_t)(bytes >> 16);
}
constexpr auto to_array_32bit(uint32_t bytes)
{
return PTL::Array<uint8_t, 4>((uint8_t)((uint32_t)(bytes & 0xff000000) >> 24),
(uint8_t)((uint32_t)(bytes & 0x00ff0000) >> 16),
(uint8_t)((uint32_t)(bytes & 0x0000ff00) >> 8),
@cristeigabriel
cristeigabriel / code.cc
Created June 12, 2021 21:46
[C++] Get address to matching strings in memory bitmap
// I've also posted this on unknowncheats.me under the alias of xemacs, as noted in my GitHub description.
// https://www.unknowncheats.me/forum/c-and-c-/456716-address-matching-strings-memory-bitmap.html
// This is technically a complete implementation and ready to use, you just have to change little things to have it compliant as is right now.
auto c_pe::find_utf8_compare_hash( size_t hashed, bool check_8d )const->const std::vector<pattern_t>
{
const auto &module_bitmap = get_module_bitmap( );
const auto &module_text_section = grab_section_by_hash( HASH_CT( ".text" ) );
auto results = std::vector<pattern_t>{};

Keybase proof

I hereby claim:

  • I am cristeigabriel on github.
  • I am cristeigabriel (https://keybase.io/cristeigabriel) on keybase.
  • I have a public key ASD_JFqkKLW1WuuAyMjdZlS-BfvBMXy99E1zw1qpR7q5OAo

To claim this, I am signing this object: