Skip to content

Instantly share code, notes, and snippets.

View damnever's full-sized avatar
🎲

Xiaochao Dong damnever

🎲
View GitHub Profile
@damnever
damnever / SET-CURRENT-DATETIME.py
Created February 18, 2024 08:07
Synchronize the date and time of some recording devices (MRECSET.TXT)
from datetime import datetime
MRECSET_TXT = 'MRECSET.TXT'
ENCODING = 'GB18030'
datetime_now = datetime.now().strftime("%H:%M %Y/%m/%d")
updated_lines = []
with open(MRECSET_TXT, 'rb') as file: # encoding='GB18030'
for line in file:
package store
import (
"context"
"math/rand"
"os"
"path/filepath"
"strconv"
"strings"
"testing"
# https://github.com/prometheus/prometheus/pull/10973
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app.kubernetes.io/component: prometheus
app.kubernetes.io/instance: prometheus
name: prometheus-wal-test
namespace: default
spec:
@damnever
damnever / Makefile
Last active January 8, 2020 03:44
Makefile for golang
.PHONY: help build test deps clean
# Ref: https://gist.github.com/prwhite/8168133
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} \
/^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
NOW = $(shell date '+%Y-%m-%d')
# /etc/security/limits.conf
* soft nofile 51200
* hard nofile 51200
ulimit -n 51200
# /etc/sysctl.conf see BDP
#!/bin/bash
echo "starting"
for i in `seq 0 $1`; do
$2 &
done
for job in `jobs -p`; do
echo $job
wait $job