Skip to content

Instantly share code, notes, and snippets.

View 1a1a11a's full-sized avatar

Juncheng Yang 1a1a11a

View GitHub Profile
@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.

@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(); \
@t27
t27 / linux-oom-killer-fixes.md
Last active June 14, 2024 12:39
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.

@gboddin
gboddin / 00-MINING.md
Last active January 27, 2024 11:58
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.

@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>
@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
@jaxgeller
jaxgeller / gist:14b6e0b7abd0219a38f1
Created July 8, 2015 16:12
Disable Cyberduck Bonjour Notifications
# in terminal
defaults write ch.sudo.cyberduck rendezvous.enable false
@gubatron
gubatron / compiling_building_c_cpp_notes.md
Last active April 18, 2024 07:58
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015;

Last update on December 14, 2023

Updated on February 27, 2023

Updated August 29, 2019.

@zxhfighter
zxhfighter / awk.md
Created July 24, 2014 11:54
AWK 简明教程

AWK 简明教程

提炼自CoolShell:http://coolshell.cn/articles/9070.html

有一些网友看了前两天的《Linux下应该知道的技巧》希望我能教教他们用awk和sed,所以,出现了这篇文章。我估计这些80后的年轻朋友可能对awk/sed这类上古神器有点陌生了,所以需要我这个老家伙来炒炒冷饭。况且,AWK是贝尔实验室1977年搞出来的文本出现神器,今年是蛇年,是AWK的本命年,而且年纪和我相仿,所以非常有必要为他写篇文章。

之所以叫AWK是因为其取了三位创始人 Alfred Aho,Peter Weinberger, 和 Brian Kernighan 的Family Name的首字符。要学AWK,就得提一提AWK的一本相当经典的书《The AWK Programming Language》,它在豆瓣上的评分是9.4分!在亚马逊上居然卖1022.30元。

我在这里的教程并不想面面俱到,本文和我之前的Go语言简介一样,全是示例,基本无废话。

@alghanmi
alghanmi / curl_example.cpp
Created May 5, 2014 20:12
cURL C++ Example
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}