Skip to content

Instantly share code, notes, and snippets.

View Jacob-Tate's full-sized avatar

Jacob Jacob-Tate

  • Kirkland, WA
View GitHub Profile
@Jacob-Tate
Jacob-Tate / printer_patch.reg
Created September 6, 2022 19:09
Fixes various issues with printers in windows 10 and 11
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers]
"ForceCSREMFDespooling"=dword:00000000
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print]
"RpcAuthnLevelPrivacyEnabled"=dword:00000000
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: PXT related installs ::
:: ::
:: Author: Jacob I. Tate <jacob.tate@digipen.edu> ::
:: Date: 09/07/2021 ::
:: Version: 1.0.0 ::
:: ::
:: Changelog ::
:: 1.0.0 ::
:: - Created the script ::
for aptx:
sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true
for AAC:
sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true
for verification:
sudo defaults read bluetoothaudiod
var stringWithWhiteSpace = " The trimmingCharacters method, removes the whitespace at both ends of a string. "
var whiteSpaceRemoved = stringWithWhiteSpace.trimmingCharacters(NSCharacterSet.whitespaces)
@Jacob-Tate
Jacob-Tate / swift: Screen background color in SwiftUI.swift
Created January 5, 2021 04:20
There are a few methods listed here I personally use ZStack
// Using ZStack
var body: some View{
ZStack {
Color.blue.ignoreSafeArea()
// Other content goes here
// NOTE: The other content will respect the safe area
}
}
// Using Overlay Modifiers
#include <stdexcept>
class CrashHandlerException : public std::runtime_error
{
public:
explicit inline CrashHandlerException(const std::string& error_desc)
: std::runtime_error(error_desc) {}
};
class CrashHandlerFileCreate : public CrashHandlerException
wchar_t path[FILENAME_MAX] = { 0 };
GetModuleFileName(nullptr, path, FILENAME_MAX);
// "C:\path1" "C:\"
// "C:\path1\path2" "C:\path1"
// "C:\path1\" "C:\path1"
// "\\path1\path2\path3" "\\path1\path2"
// "\path1" "\"
// This removed the exe from get module file name
// Assuming unicode
#include <string>
wchar_t path[FILENAME_MAX] = { 0 };
GetModuleFileNameW(nullptr, path, FILENAME_MAX);
std::wstring wide_string(path);
std::string result_string(wide_string.begin(), wide_string.end());
// esi contains the struct ptr
// vtable = *(DWORD*)ptr
mov eax,dword ptr [esi]
// function = *(DWORD*)vtable
mov edx,dword ptr [eax]
// put the class pointer in ecx
// this = ptr
mov ecx,esi
(Get-ChildItem .).BaseName