Skip to content

Instantly share code, notes, and snippets.

View leafsummer's full-sized avatar
🎯
Focusing

LeafSummer leafsummer

🎯
Focusing
View GitHub Profile
@leafsummer
leafsummer / nvd_cve_data_download.sh
Created January 11, 2024 06:29
use shell to download the nvd cve datasource to save in the local files
#!/bin/sh
# 下载nvd的数据源备份
data_source="https://nvd.nist.gov/feeds/json/cve/1.1/"
download_dir="/data/SFTP/data/SDA/release/NVD/"
# file_name="nvdcve-1.1-{}.json.gz"
@leafsummer
leafsummer / chatfairy_app.py
Created December 1, 2023 04:10
This is a minimal chat application with no dependancy but Flask! I call it Chatfairy.
from functools import wraps
from flask import (
Flask,
json,
redirect,
render_template_string,
request,
session,
url_for,
@leafsummer
leafsummer / txt2speech.py
Created October 31, 2023 04:01
text2speed by azure sdk
import os
from tqdm import tqdm
import azure.cognitiveservices.speech as speechsdk
key = "写你自己的key"
region = "eastasia"
endpoint = "https://eastasia.api.cognitive.microsoft.com/sts/v1.0/issuetoken"
# Read user input
filename = input("Please enter the name of the text file to convert: ")
@leafsummer
leafsummer / test_network.sh
Created April 13, 2023 06:11
test network latency and packet loss
#!/bin/bash
log_file=/var/log/curl_error.log
max_age=86400 # one day in seconds
max_loop=1000 # maximum number of loops to execute
loop_count=0 # current number of loops executed
if [ ! -f "$log_file" ]; then
touch "$log_file"
fi
@leafsummer
leafsummer / commit_message.md
Created August 5, 2022 03:56
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

Organization name: leexij@gmail.com
Serial Key: eNrzzU/OLi0odswsqslJTa3IzHJIz03MzNFLzs+tMTQyNrcwsTQyAIEa5xpDAIFxDy8k
@leafsummer
leafsummer / config.fish
Created August 3, 2021 10:53 — forked from pierre-b/config.fish
golang fish shell config
# config file
# vim ~/.config/fish/config.fish
# reload the config
# source ~/.config/fish/config.fish
# set the workspace path
set -x GOPATH /users/my-username/go
# add the go bin path to be able to execute our programs
@leafsummer
leafsummer / func_timeout.py
Created May 10, 2021 03:00
[function timeout decorator]
from threading import Thread
ThreadStop = Thread._Thread__stop
class TimeoutException(Exception):
pass
def timelimited(timeout):
@leafsummer
leafsummer / walk_up.py
Created May 7, 2021 10:49
[walk up directory for list all files]
def walk_up(bottom):
"""mimic os.walk, but walk 'up' instead of down the directory tree.
From: https://gist.github.com/zdavkeos/1098474
"""
bottom = os.path.realpath(bottom)
# get files in current dir
try:
names = os.listdir(bottom)
@leafsummer
leafsummer / gist:8b74d99bee233514db8f96239a2fb004
Created April 10, 2021 09:40 — forked from david415/gist:8274636
/etc/ufw/before.rules - for use with tor...
#
# rules.before
#
# Rules that should be run before the ufw command line added rules. Custom
# rules should be added to one of these chains:
# ufw-before-input
# ufw-before-output
# ufw-before-forward
#