Skip to content

Instantly share code, notes, and snippets.

View ZaWertun's full-sized avatar
💻
💻🍕🍺

Yaroslav Sidlovsky ZaWertun

💻
💻🍕🍺
View GitHub Profile
@weirddan455
weirddan455 / time.c
Created December 31, 2021 16:43
clock_gettime benchmark
#include <time.h>
#include <stdio.h>
#include <stdint.h>
#define MILLION 1000000
#define BILLION 1000000000
int main(void)
{
struct timespec start, end;
@ADeltaX
ADeltaX / dllmain.cpp
Created March 22, 2021 17:54
Example for accessing SetWindowBand function via dll injection via explorer.exe
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mutex>
//INSTALL DETOURS FROM NUGET! (or build from source yourself)
#include <detours.h>
//Definitions
typedef BOOL(WINAPI* SetWindowBand)(IN HWND hWnd, IN HWND hwndInsertAfter, IN DWORD dwBand);
typedef BOOL(WINAPI* NtUserEnableIAMAccess)(IN ULONG64 key, IN BOOL enable);
@dlqqq
dlqqq / ryzen_bug.md
Last active February 3, 2025 13:55 — forked from wmealing/C-states.md
AMD Ryzen "Freezing" Bug on GNU/Linux Systems

Random "Freezing" with AMD Ryzen CPUs

It seems that numerous GNU/Linux users (including myself) have been having issues with the system randomly "freezing" during light usage. From journalctl output and anecdotal accounts, it is speculated that the AMD Ryzen CPUs do not support other C-states for power management very well (at least on GNU/Linux distributions), and the freezing may be resolved by limiting the C-state of the CPU.

Possible Solution

Limiting the C-state of the CPU can be done through the addition of the following kernel boot parameter.

processor.max_cstate=1
@dimaryaz
dimaryaz / dropbox_ext4.c
Created August 15, 2018 07:28
Dropbox ext4 hack
/*
* dropbox_ext4.c
*
* Compile like this:
* gcc -shared -fPIC -ldl -o libdropbox_ext4.so dropbox_ext4.c
*
* Run Dropbox like this:
* LD_PRELOAD=./libdropbox_ext4.so ~/.dropbox-dist/dropboxd
*/
@teknoraver
teknoraver / unixhttpc.go
Last active November 7, 2024 14:29
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"