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;
@dlqqq
dlqqq / ryzen_bug.md
Last active June 22, 2024 10:23 — 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 March 21, 2024 11:48
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"