Skip to content

Instantly share code, notes, and snippets.

View siddontang's full-sized avatar
🏠
Working from home

siddontang siddontang

🏠
Working from home
  • PingCAP
  • SunnyVale
View GitHub Profile
@siddontang
siddontang / song.py
Created January 31, 2024 01:09
Use ChatGPT to build a song
from music21 import stream, note, meter, tempo, expressions, instrument
# 创建一个音乐流
melody = stream.Stream()
# 设置拍号为4/4
melody.append(meter.TimeSignature('4/4'))
# # 设置曲速
# melody.append(tempo.MetronomeMark(number=120))
@siddontang
siddontang / Makefile
Created December 6, 2023 18:08
Support pre-build in Makefile
# Refer to https://stackoverflow.com/questions/1612278/pre-build-step-in-makefile
CC=gcc
.PHONY: all clean
.SECONDARY: main-build
all: pre-build main-build
pre-build:
@siddontang
siddontang / diff_directory.sh
Created December 2, 2023 01:26
Diff two directories and output the differences
#!/bin/bash
# Check for the correct number of arguments
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <directory1> <directory2> <output_directory>"
exit 1
fi
# Assign arguments to variables
DIR1="$1"
import subprocess
import socket
import time
import psutil
import glob
import requests
import concurrent.futures
def find_available_ports(num_ports):
@siddontang
siddontang / haokan_down.go
Created March 20, 2023 03:18
Download Baidu Haokan video
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"os"
"strings"
)
@siddontang
siddontang / prompt_demo.md
Created February 6, 2023 01:53
Fortune 500 AI Prompt Run book
### MySQL SQL tables, with their properties:
#
# Table fortune.global_fortune_500_2018_2022, columns = [rank, company_name, country, employees_num, previous_rank, revenues_million, revene_change_percentage, profit_million, profit_change_percentage, asset_million, year]

Q: Compare the amount of businesses between china and the US
Let's think step by step, With the following template:

Start TiDB

tiup --tag 6.0 playground 6.0

Create Corteza database and account

Connect to TiDB

@siddontang
siddontang / bigetc.go
Created May 12, 2022 06:12 — forked from c4pt0r/bigetc.go
bigetc.go
package bigetc
import (
"database/sql"
"time"
"github.com/c4pt0r/log"
_ "github.com/go-sql-driver/mysql"
)
@siddontang
siddontang / BPF.txt
Last active July 19, 2023 08:21
BPF Performance Tools
Hello BPF
@siddontang
siddontang / tcptop.py
Created September 11, 2019 00:59
add count statistics for bcc tcptop
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# tcptop Summarize TCP send/recv throughput by host.
# For Linux, uses BCC, eBPF. Embedded C.
#
# USAGE: tcptop [-h] [-C] [-S] [-p PID] [interval [count]]
#
# This uses dynamic tracing of kernel functions, and will need to be updated
# to match kernel changes.