This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/bin/env python3 | |
# MIT License | |
# | |
# Copyright (c) 2024 Magicwenli | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from time import sleep | |
import warnings | |
def make_wide(formatter, w=120, h=36): | |
"""Return a wider HelpFormatter, if possible.""" | |
try: | |
# https://stackoverflow.com/questions/5462873/ | |
# https://stackoverflow.com/a/5464440 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 混合端口 HTTP和SOCKS5用一个端口 | |
mixed-port: 7890 | |
# HTTP 代理端口 | |
# port: 7890 | |
# SOCKS5 代理端口 | |
socks-port: 7891 | |
# Linux 和 macOS 的 redir 代理端口 (如需使用此功能,请取消注释) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Scripted from http://serverfault.com/questions/127636/force-local-ip-traffic-to-an-external-interface | |
DEV_0="ens6f0" | |
DEV_1="ens6f1" | |
MAC_0=`ifconfig ${DEV_0}|awk 'NR==1 {print $5}'` | |
MAC_1=`ifconfig ${DEV_1}|awk 'NR==1 {print $5}'` | |
IP_0="192.168.100.1" | |
IP_1="192.168.101.1" | |
FAKE_0="192.168.102.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$process_name = "notepad.exe" | |
$time_minute_limit = 0.1 | |
while ($true) { | |
$process = Get-Process | Where-Object { $_.Path -like "*$process_name" } | |
if ($process) { | |
$last_time = (New-TimeSpan -Start ($process).StartTime).TotalMinutes | |
Write-Output "$process_name is running, live time is $([math]::round($last_time,3)) minutes" | |
if ($last_time -gt $time_minute_limit) { | |
$process | Stop-Process -Force | |
Write-Output "Now is $(Get-Date) , tried to kill $($process.ProcessName) , last_time is $([math]::round($last_time,5)) minutes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# origin code by hiryu85 | |
# https://github.com/hiryu85/python-ID3TagFromFilename/blob/master/id3fromfile.py | |
# rewrite at 2022.06.04 | |
from glob import glob | |
from re import match | |
from string import Template | |
from sys import argv, exit | |
from mutagen import File |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.NAME | |
MiaoCopy | |
.DESCRIPTION | |
Copy files recursively, with GUI and filters! | |
.LINK | |
github.com/magicwenli | |
#> | |
Add-Type -AssemblyName System.Windows.Forms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a collection called idgen, create a document for every other collection, | |
// and store the self-add id | |
import ( | |
"context" | |
"go.mongodb.org/mongo-driver/bson" | |
"go.mongodb.org/mongo-driver/mongo" | |
"go.mongodb.org/mongo-driver/mongo/options" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
# | |
# Author : magicwenli | |
# Date : 2021-10-30 11:54:32 | |
# LastEditTime : 2021-10-30 11:54:32 | |
# Useful links : | |
# | |
# Virtual Keys List: | |
# https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes | |
# RegisterHotKey function: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a sample Python script. | |
# You can use it to calculate combinatorial problems | |
# magicwenli on 2021.09.23 | |
import argparse | |
import math | |
from fractions import Fraction | |
def combA(arguments: list): |
NewerOlder