Skip to content

Instantly share code, notes, and snippets.

@rustyx
rustyx / thinkfan
Last active April 7, 2024 16:07
thinkfan.yaml for Lenovo Thinkpad X1 Extreme Gen 5
# thinkfan.yaml for Lenovo Thinkpad X1 Extreme Gen 5
sensors:
- tpacpi: /proc/acpi/ibm/thermal
indices: [0, 1, 2, 4, 5, 6]
correction: [-15, -10, -8, -2, -2, -4]
- hwmon: /sys/class/hwmon
name: nvme
indices: [1, 2, 3]
package main
import (
"fmt"
"io"
"net"
"os"
"os/exec"
)
@rustyx
rustyx / map_growth_test.go
Last active December 13, 2021 11:05
A test for Go map growth issue #20135
package main
import (
"fmt"
"runtime"
)
func main() {
mymap := make(map[string]*string)
for i := 0; i < 1000000001; i++ {
@rustyx
rustyx / make_array.hpp
Last active February 17, 2021 14:58
C++ make_array
#include <array>
#include <tuple>
#include <utility>
/*
Makes a std::array of objects without a default constructor.
C++17 is required for std::make_from_tuple, otherwise can be adapted for C++14.
Example usage:
struct A {
A(std::string s) {}