Skip to content

Instantly share code, notes, and snippets.

@caticat
caticat / gist:c6c722f7f442f2ee27eb550c3747b22b
Last active October 10, 2020 06:02
syslog系统日志写入
// syslog系统日志写入
// 记录在/var/log/message中
#include <stdio.h>
#include <syslog.h>
int main()
{
openlog("bin_name", LOG_PID, LOG_LOCAL0);
syslog(LOG_DEBUG, "A%d", 1); // 默认在日志中看不到
@caticat
caticat / chain.go
Last active August 4, 2017 09:13
basic chain utilities
package main
/*
例子:
c := &ChainSortedMap{}
c.comparator = func(o1 interface{}, o2 interface{}) bool {
d1 := o1.(*SA)
d2 := o2.(*SA)
if d1.lv == d2.lv {
return d1.exp > d2.exp