Skip to content

Instantly share code, notes, and snippets.

View 1a1a11a's full-sized avatar

Juncheng Yang 1a1a11a

View GitHub Profile
@niedbalski
niedbalski / no-madvise.c
Created August 19, 2015 13:12
madvise tests
niedbalski@theos-mobile:~$ cat test-madvise.c
#include <sys/mman.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(void) {
size_t size = sysconf(_SC_PAGE_SIZE) * 6; //24K
@cbecker
cbecker / main.cpp
Last active February 7, 2024 03:04
lightGBM C++ example
#include <LightGBM/config.h>
#include <LightGBM/dataset_loader.h>
#include <LightGBM/boosting.h>
#include <LightGBM/objective_function.h>
#include <LightGBM/metric.h>
#include <LightGBM/utils/common.h>
#include <iostream>
#include <random>
#include <algorithm>
@gboddin
gboddin / 00-MINING.md
Last active November 9, 2025 11:07
Mining optimisation under Linux

Mining under linux

Disclaimer

I'm in no case responsible for fried hardware, erased software or burning down houses. Make sure your miners are always well cooled.

General recommendation

Though you can easily mix nVidia and AMD in the same rig with Linux, it's recommended to use a different thread for each platform so a Driver crash doesn't bring the whole rig down. It should be noted however, that some mining software have trouble when both architecture are found on the same rig.

@t27
t27 / linux-oom-killer-fixes.md
Last active November 12, 2025 14:01
Dealing with the Linux OOM Killer

Dealing with the Linux OOM Killer at the program level

Do this in cases when you dont want to change the os-level settings, but only want to disable the OOM killer for a single process. This is useful when youre on a shared machine/server.

The OOM killer uses the process level metric called oom_score_adj to decide if/when to kill a process. This file is present in /proc/$pid/oom_score_adj. The oom_score_adj can vary from -1000 to 1000, by default it is 0.

You can add a large negative score to this file to reduce the probability of your process getting picked and terminated by OOM killer. When you set it to -1000, it can use 100% memory and still avoid getting terminated by OOM killer.

@XiangpengHao
XiangpengHao / test_clwb.cpp
Last active January 19, 2021 09:42
Code used for testing clwb instruction. https://blog.haoxp.xyz/posts/is-clwb-implemented/
#include <glog/logging.h>
#include <x86intrin.h>
#include <chrono>
#include <iostream>
using namespace std::chrono;
#define TIME_BODY(name, body) \
do { \
auto start = high_resolution_clock::now(); \
@kassane
kassane / sieve-cache.md
Last active May 21, 2024 03:31
About SIEVE-cache :en:

Original post: kubo39/gist 🇯🇵


About SIEVE Cache

A cache algorithm called [SIEVE][sieve-website] was announced in 2023. It claims to be simpler than LRU, and indeed it is a fairly simple algorithm, but it is said to perform as well as existing superior cache algorithms such as S3-FIFO and TinyLFU.