Skip to content

Instantly share code, notes, and snippets.

View songtianlun's full-sized avatar
🎯
Focusing

TianLun Song songtianlun

🎯
Focusing
View GitHub Profile
@songtianlun
songtianlun / bench-delete-gitee-repo.py
Created December 20, 2022 09:08
批量删除 gitee 代码仓库
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Bench delete gitee repos
# 批量删除 gitee 代码仓库
# Author: TianLun Song <tianlun.song at foxmail.com>
# License: MIT
# Path: bench-delete-gitee-repo.py
# require: requests
# usage: python3 delete.py
# install requests: pip3 install requests
@songtianlun
songtianlun / errno.py
Last active January 18, 2022 09:16
一个 HTTP 服务错误码码枚举类,用于规范服务返回的错误信息和错误码。
#!/usr/bin/python
# coding=utf8
"""
# Author: songtianlun
# mail: songtianlun@frytea.com
# Created Time : 2022-01-18 16:49:58
# License: GPL-2.0-only
# File Name: errno.py
# Description:
@songtianlun
songtianlun / QMPClient.py
Last active January 12, 2022 09:38
一个 python 实现的 QMP 客户端,用于向 QEMU 发送 QMP 指令,(借鉴了 PVE 的 QMP Client 实现)。
#!/usr/bin/python
# coding=utf8
"""
# Author: songtianlun
# mail: songtianlun@frytea.com
# Created Time : 2022-01-07 15:06:17
# License: GPL-2.0-only
# Description:
使用 selector 实现 I/O 多路复用,可并行向不同虚拟机发送 qmp,qga 命令;
注: QEMU 只能处理一条连接,因此我们应当尽快关闭连接。
### Keybase proof
I hereby claim:
* I am songtianlun on github.
* I am songtianlun (https://keybase.io/songtianlun) on keybase.
* I have a public key ASBbXBmIaHVahL6q4H-ADMsMtNKvjscru0oiIAP0FqFMaQo
To claim this, I am signing this object:
# $language = "python"
# $interface = "1.0"
# This automatically generated script may need to be
# edited in order to work correctly.
import time
import math
import random
@songtianlun
songtianlun / Batch-Single-File-Makefile
Last active October 10, 2020 10:29
A Makefile that can batch single c file.
# Batch Single C file MakeFile
# 指定CPU架构 Architecture -> ARCH
ARCH ?=
CC = $(ARCH)gcc
SUFFIX = .c
CFLAGS += -Wall -g
LD =
CUR_SOURCE = $(wildcard *$(SUFFIX))
@songtianlun
songtianlun / RandomStringWithLength
Last active September 18, 2020 12:54
Generate random string of specified length.
/*************************************************************************
> Function : Generate random string of specified length.
> Author : TL Song
> EMail : songtianlun@frytea.com
> Created Time : Fri 18 Sep 2020 11:52:32 AM CST
************************************************************************/
void RandomString(char * str, int len)
{
int RandomAscii;