Skip to content

Instantly share code, notes, and snippets.

View STRRL's full-sized avatar
🏠
Working from home

Zhou Zhiqiang STRRL

🏠
Working from home
View GitHub Profile
@STRRL
STRRL / append-ssh-authorized_keys.sh
Created July 14, 2023 04:44
append my ssh pub key as ssh authorized_keys
#!/usr/bin/env bash
mkdir -p ~/.ssh
# if authorized_keys not exist, create it
if [ ! -f ~/.ssh/authorized_keys ]; then
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
fi
curl -L http://github.com/strrl.keys >> ~/.ssh/authorized_keys
@STRRL
STRRL / main.go
Created April 26, 2023 06:54
keep-lookup
package main
import (
"context"
"fmt"
"net"
"os"
"os/signal"
"time"
)
diff --git a/collector/thermal_darwin.go b/collector/thermal_darwin.go
index 282ca3f..fa96f1f 100644
--- a/collector/thermal_darwin.go
+++ b/collector/thermal_darwin.go
@@ -118,7 +118,9 @@ func (c *thermCollector) Update(ch chan<- prometheus.Metric) error {
func fetchCPUPowerStatus() (map[string]int, error) {
cfDictRef, _ := C.FetchThermal()
defer func() {
- C.CFRelease(C.CFTypeRef(cfDictRef.ref))
+ if C.kIOReturnSuccess == cfDictRef.ret {
@STRRL
STRRL / micrometer.md
Last active December 5, 2019 08:16
Micrometer 快速整合文档

Micrometer 快速整合文档

该文档内容来自官方文档,包含部分自己的理解。

[toc]

Micrometer 简介

Micrometer 为大多数流行的监控系统的客户端提供了一个门面(facade)。可以用来监控你的 JVM-based 应用,而不需要为每个监控系统都写一个单独的实现。Micrometer 就像监控界的 SLF4J。

@STRRL
STRRL / tmux-install.sh
Created September 19, 2019 03:27
A copy for tmux non-root install script
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.9a
LIBEVENT_VERSION=2.1.8-stable