Skip to content

Instantly share code, notes, and snippets.

View maikebing's full-sized avatar
🦧
Out sick

maikebing

🦧
Out sick
View GitHub Profile
@maikebing
maikebing / read_cpu_temperature.c
Created July 5, 2024 12:03
linux read cpu temperature
int _readcputemp(char* _path)
{
int temp = 0;
FILE* fd;
char buff[256];
char _temp_file[255] = { 0 };
sprintf(_temp_file, "%stemp", _path);
fd = fopen(_temp_file, "r");
if (fd != NULL)
@maikebing
maikebing / merge-to-subdir
Last active February 22, 2024 17:28 — forked from npryce/merge-to-subdir
Merge history from one Git repository as the history of a subdirectory of another Git repository
#!/bin/bash
# Usage: merge-to-subdir source-repo destination-repo subdir
#
# Merges the history of source-repo into destination-repo as the
# history of the subdirectory subdir.
#
# source-repo can be local or remote.
# destination-repo must be local to the machine.
# subdir can be a relative path, in which case intermediate
@maikebing
maikebing / ZipArchiveEntryOpenExtension.cs
Created September 26, 2023 02:36
Open ZipArchiveEntry checkOpenable extension
public static Stream Open(this ZipArchiveEntry entry, bool checkOpenable)
{
try
{
return entry.GetType().GetMethod("OpenInReadMode", BindingFlags.NonPublic | BindingFlags.Instance)
.Invoke(entry, new object[] { checkOpenable }) as Stream;
}
catch (TargetInvocationException ex1)
{
@maikebing
maikebing / str2time.c
Created March 16, 2019 04:11
Convert strings to time
/*****************************************************************************
* 版权所有(C) 2006, ZTE Corp. WiMAX
*----------------------------------------------------------------------------
* 模 块 名 : BSPCommon
* 文件名称 : str2time.c
* 文件标识 : {[N/A]}
* 内容摘要 : 将字符串转换为时间
* 注意事项 :
* 作 者 : 田瑞忠
* 创建日期 : 2008-12-27
@maikebing
maikebing / STR2LPCWSTR.h
Created November 28, 2018 10:50
convert char * to LPCWSTR
LPCWSTR STR2LPCWSTR( char * str)
{
CString str_____ = CString(str);
USES_CONVERSION;
LPCWSTR lpcw_param = A2CW(W2A(str_____));
str_____.ReleaseBuffer();
return lpcw_param;
}
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@maikebing
maikebing / auto_update.md
Created November 7, 2016 05:30 — forked from iBaozi/auto_update.md
gitlab 自动发布

自动更新代码

功能

该功能通过监听 git push 事件,触发A服务器指定目录 git pull。
比如 forumsbaozi 分支在任意环境下成功push后,会在A服务器的 /data/web/framework/trunk/ baozi/ forums 目录执行 git pull

部署

在A服务器运行 auto_update.py。
在 gitlab,添加 web hook: http://A服务器IP:8003