Skip to content

Instantly share code, notes, and snippets.

View woshichuanqilz's full-sized avatar
😃
热爱生命

Ori woshichuanqilz

😃
热爱生命
View GitHub Profile
def quick_sort_iterative(arr):
stack = [(0, len(arr) - 1)] # 定义一个栈,用于存储待排序的区间
while stack:
start, end = stack.pop() # 从栈中弹出一个区间
if start >= end:
continue
pivot = arr[end] # 选择最后一个元素作为枢轴
partition_index = start # 分区的索引
def merge_sort(arr):
if len(arr) > 1:
mid = len(arr) // 2 # Finding the mid of the array
L = arr[:mid] # Dividing the elements into 2 halves
R = arr[mid:]
merge_sort(L) # Sorting the first half
merge_sort(R) # Sorting the second half
@woshichuanqilz
woshichuanqilz / LC_4.py
Created October 8, 2024 03:55
LC4. 最简单的双指针的解法
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
l1 = len(nums1)
l2 = len(nums2)
total_len = 0
index1 = 0
index2 = 0
last1 = 0
last2 = 0
while True:
@woshichuanqilz
woshichuanqilz / kde_set_proxy_in_cmdl.sh
Created August 20, 2024 21:41
set proxy in command line in kde when setting is down by qt
kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key ProxyType "1"
kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key 'httpProxy' 'http://127.0.0.1:10081'
kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key 'httpsProxy' 'http://127.0.0.1:10081'
kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key 'ftpProxy' 'http://127.0.0.1:10081'
kwriteconfig6 --file kioslaverc --group 'Proxy Settings' --key Authmode 0
# When you modify kioslaverc, you need to tell KIO.
dbus-send --type=signal /KIO/Scheduler org.kde.KIO.Scheduler.reparseSlaveConfiguration string:''
@woshichuanqilz
woshichuanqilz / python PDF to image.md
Created August 13, 2024 19:10
python pdf 2 image
id aliases tags
SqlitePythonCountChrome
# -*- coding: utf-8 -*-  
import datetime  
import sqlite3 
@woshichuanqilz
woshichuanqilz / DeleteGiteeRepoInBatch.py
Last active August 2, 2024 20:48
DeleteGiteeRepoInBatch.py
import requests
import datetime
import threading
access_token = "xxxx"
def check_latest_commit_date(item_list):
# 获取当前日期
current_date = datetime.datetime.now(datetime.timezone.utc)
#!/bin/bash
# 检查是否提供了文件名
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <filename>"
exit 1
fi
filename=$1
import whisper
model = whisper.load_model('small', 'cpu')
# model = whisper.load_model("base")
result = model.transcribe("output.wav")
print(result["text"])
#!/bin/bash
# file content should be
#key:value1
#key:value2
# Read the key-value pairs from the file
data=$(cat file.txt)
# Search for a key using fzf
selected_key=$(echo "$data" | awk -F ':' '{print $1}' | fzf)