Skip to content

Instantly share code, notes, and snippets.

View mostevercxz's full-sized avatar

giant mostevercxz

  • Songjiang,Shanghai,China
View GitHub Profile
@mostevercxz
mostevercxz / test_langfuse_trace.py
Created August 20, 2024 09:00
langfuse tracing
from langfuse.decorators import observe
from langfuse.openai import openai # OpenAI integration
QUERY = "你是谁"
@observe(name="多轮改单轮")
def rewrite(user_input : str):
return user_input
@observe(name="意图识别")
@mostevercxz
mostevercxz / CentOS-Base.repo
Created December 10, 2019 04:41
Redhat 7.6 centos source
[base]
name=CentOS-7 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
http://mirrors.aliyuncs.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
@mostevercxz
mostevercxz / ftrace_a.cpp
Last active April 27, 2019 07:29
How to trace all functions in a specific c/c++ file?
#include "ftrace_a.h"
#include <iostream>
#include <dlfcn.h> // dladdr
#include <cxxabi.h> // __cxa_demangle
#include <stdlib.h> // malloc, free
#include <string.h> // strlen
extern "C"
{
// This function must not be traced!!!
@mostevercxz
mostevercxz / CMakeLists.txt
Created March 6, 2019 14:46 — forked from socantre/CMakeLists.txt
Example of using add_custom_command and add_custom_target together in CMake to handle custom build steps with minimal rebuilding: This example untars library headers for an INTERFACE library target
set(LIBFOO_TAR_HEADERS
"${CMAKE_CURRENT_BINARY_DIR}/include/foo/foo.h"
"${CMAKE_CURRENT_BINARY_DIR}/include/foo/foo_utils.h"
)
add_custom_command(OUTPUT ${LIBFOO_TAR_HEADERS}
COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_CURRENT_SOURCE_DIR}/libfoo/foo.tar"
COMMAND ${CMAKE_COMMAND} -E touch ${LIBFOO_TAR_HEADERS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/foo"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/libfoo/foo.tar"
@mostevercxz
mostevercxz / stacktrace.cxx
Last active March 3, 2019 04:38 — forked from fmela/stacktrace.cxx
A C++ function that produces a stack backtrace with demangled function & method names.
/*
* Copyright (c) 2009-2017, Farooq Mela
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@mostevercxz
mostevercxz / split.lua
Created November 5, 2018 09:12
Lua split string
function splitString(str, seperator)
if str == nil or str == '' then return nil end
local elements = {}
local i = 0
local left, right = string.find(str, seperator)
local final_pos = 1
while left ~= nil do
local tmp_str= string.sub(str, final_pos, right - 1 )