Skip to content

Instantly share code, notes, and snippets.

@wesleyel
wesleyel / mongo-id-generator.go
Created November 3, 2021 05:57
Create a collection called idgen, create a document for every other collection, and store the self-add id
// 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"
)
@wesleyel
wesleyel / capture_window.py
Created October 30, 2021 04:24
Capture window with shortcuts on windows 10
# -*- 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:
@wesleyel
wesleyel / main.py
Last active September 23, 2021 12:53
calculate combinatorial problems
# 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):
@wesleyel
wesleyel / make_gif
Last active May 21, 2021 07:10
使用pillow将cv2读入的图片创建为GIF
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=[]
@wesleyel
wesleyel / addMirror.txt
Created November 7, 2020 16:30
给OpenEuler添加软件源
/* 给OpenEuler添加软件源 */
step1: cd /etc/yum.repos.d/
step2: ls
/* 显示结果例如:openEuler.repo */
step3: sudo vi openEuler.repo
/* 进入vi,依次输入注释前的东西 */
G // 即shift+g,跳转到最后一行