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): |
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
from PIL import Image | |
import cv2 | |
import numpy as np | |
def make_gif(target_path, images, duration=80): | |
images[0].save(target_path, | |
save_all=True, append_images=images[1:], optimize=False, duration=duration, loop=1) | |
imgs=[] |
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
/* 给OpenEuler添加软件源 */ | |
step1: cd /etc/yum.repos.d/ | |
step2: ls | |
/* 显示结果例如:openEuler.repo */ | |
step3: sudo vi openEuler.repo | |
/* 进入vi,依次输入注释前的东西 */ | |
G // 即shift+g,跳转到最后一行 |