1. Requirements python >= 3.9 pip install beautifulsoup4 2. Create a python script get_latest_info_from_github_repos.py import requests from bs4 import BeautifulSoup urls = [ "https://github.com/geoserver/geoserver", "https://github.com/Leaflet/Leaflet", "https://github.com/Turfjs/turf/" ] def get_latest_version(url) -> tuple: url = url + "/releases/latest" response = requests.get(url) if response.status_code != 200: raise Exception(f'Request failed with status {response.status_code}') soup = BeautifulSoup(response.text, 'html.parser') version = soup.find('span', {'class': 'css-truncate-target'}).get_text(strip=True) datetime = soup.find('relative-time').get("datetime") return version, datetime for url in urls: version = "UNKNOWN" datetime = "UNKNOWN" try: version, datetime = get_latest_version(url) except Exception as e: pass print(f'{url},{version},{datetime[0:10]}') 3.
Read more使用 git filter-branch –commit-filter 重写历史记录可能会导致数据丢失。这个命令允许你在Git存储库的历史记录中进行修改,应用一个自定义的 commit 过滤器。当你使用这个命令时,请务必小心操作,因为它会改变存储库的历史记录。 在执行前,建议先进行备份,以确保你有一个完好的历史记录备份。另外,这个命令可能会导致一些副作用,如更改提交哈希值、移除或合并提交、删除部分文件等。 因此,在执行 git filter-branch 之前,请确保你已经理解了它的工作原理,并且在执行前考虑了潜在的风险。如果你不确定自己在做什么,建议先创建一个分支进行实验,以避免意外破坏存储库的历史记录。 删除 README.md 和 docs/docker_build.md 两个文件,并清理所有产生的提交 git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch README.md docs/docker_build.md' --prune-empty --tag-name-filter cat -- --all 删除指定编号的提交信息 使用 git log --oneline 命令查询到要删除提交 git log --oneline | grep Update ed2e2a7 [feat]:[][Update docs/场景梳理.xlsx] 2a919eb [feat]:[][Update docs/场景梳理.xlsx] 记录要删除的提交短 ID 到以下脚本的 DEL_COMMIT_IDS=['ed2e2a7','a919eb'] 位置 git filter-branch --force --commit-filter 'DEL_COMMIT_IDS=['ed2e2a7','a919eb']; if [[ $DEL_COMMIT_IDS =~ ${GIT_COMMIT:0:7} ]]; then skip_commit "$@"; else git commit-tree "$@"; fi' HEAD 执行后可以看到 Ref 'refs/heads/master' was rewritten 表示已经重写了历史记录,然后再用 git log --oneline 查看可以看到已经删除
Apache NiFi Schema Apache NiFi是一个易于使用、功能强大且可靠的数据处理和分发系统。它采用基于组件的方式设计数据流。 在NiFi终端界面,用户通过界面拖动组件建立和维护数据流。 术语 Processor 处理器是NiFi的基本组件,负责创建、发送、接收、转换、过滤、分割和处理数据。NiFi的数据流是由处理器连接起来的。处理器有一组属性,可以根据需要进行配置。 Name: Processor 的名称,用于在数据流图中识别 Processor。 Scheduling Strategy: 确定 Processor 是应根据时间间隔(Timer Driven)运行,还是应根据事件触发(Event Driven)运行。 Concurrent tasks: 这是可以同时执行的任务数。这允许并行处理,可以提高处理效能。 Comments: 可以在此处添加任何有关 Processor 的额外信息或注释。 Yield Duration: 当 Processor 无法进行处理时(例如,输出连接的队列已满),它将“退避(Yield)”,过一段时间再试。该属性定义了退避的持续时间。 Penalization Duration: 如果 Processor出现错误,将对其进行“惩罚”,使其在一段时间内无法处理任何FlowFile。这项属性决定了这段时间的长度。 Connection 在 Apache NiFi 中,connection 是流程图中两个处理器或者一个处理器与一个转换器之间传递数据的关键部分。以下是 connection 的一些典型属性(schema): Name: 连接的名称,便于在数据流图中明确识别连接。 Source: 连接的源处理器。连接从此处开始,将源处理器的输出数据传递到目标处理器。 Destination: 连接的目标处理器,它接收源处理器的输出数据。 Back Pressure Object Threshold: 这是队列中元素的数量,一旦超过该数量,源处理器将停止生产数据。 Back Pressure Data Size Threshold: 这是队列容量,一旦超过这个容量,源处理器将停止生产数据。 Prioritizers: 如果队列中包含多个元素,优先级器确定应首先处理哪一项。 Expiration: FlowFile在队列中能存活的最长时间。 FlowFile Apache NiFi 中的 FlowFile 是一个数据记录或对象,它包含两部分,数据内容和属性。以下是一些 FlowFile 相关的重要概念和可能的 Schema :
Read more官方网站 https://github.com/nvm-sh/nvm/ 安装 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash 使用 查看远程可用版本 nvm ls-remote 安装 nvm install 14.21.3 切换 nvm use 14.21.3
AWS Lightsail 配合 Cloudflare WARP,使 Griseo 在远程主机通过命令行使用 ChatGPT 背景 你可以使用 curl ipinfo.io 命令查看你的 IP 地址,通常 AWS 服务器的 org 会显示 Amazon.com, 此时你是无法访问 chat.openai.com 的。我们需要使用 Cloudflare 让被访问网站认为访问来自于“原生IP” curl ipinfo.io { "ip": "xxxx", "hostname": "xxxx", "city": "Tokyo", "region": "Tokyo", "country": "JP", "loc": "xxx", "org": "XXXX Amazon.com, Inc.", "postal": "xxx-xxxx", "timezone": "Asia/Tokyo", "readme": "https://ipinfo.io/missingauth" } Cloudflare Warp 代理模式 通过在服务器本机启动一个 SOCKS5 代理,然后把需要的流量转发到这个代理上 安装软件包 以 Debian 举例,添加安装源 sudo apt install curl curl https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.
Read more下载安装程序脚本 curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh chmod +x openvpn-install.sh 执行安装 执行安装脚本,端口建议改为 443(你所在的局域网客户端通常不会阻止 443 出口) $ ./openvpn-install.sh Welcome to the OpenVPN installer! The git repository is available at: https://github.com/angristan/openvpn-install I need to ask you a few questions before starting the setup. You can leave the default options and just press enter if you are ok with them. I need to know the IPv4 address of the network interface you want OpenVPN listening to. Unless your server is behind NAT, it should be your public IPv4 address.
Read moreLinux CRON 命令 CREATE A CRON SCRIPT TO CLEAN Edit the /opt/daily-clean.sh file #!/bin/bash # docker docker system prune -f docker builder prune -f docker volume prune -f # /home/puaiuc/ find /home/puaiuc/ -maxdepth 1 -type f \( -iname "*" ! -iname ".*" \) -delete Now give the file executable permission chmod a+x /opt/daily-clean.sh Edit the crontab file to schedule it crontab -e In our case, we have scheduled it to every day at the start of the day
Read more使用 pyenv 可以很灵活的配置版本环境 环境说明 我的 macbook 上默认已经安装了 python3,但是我还需要一个 python2 环境编译一些老的项目 python3 --version Python 3.11.2 安装 安装 pyenv $ brew install pyenv 允许在 bash 中启用 pyenv $ eval "$(pyenv init -)" 使用 一旦你安装了pyenv并激活了它,你可以安装不同版本的python并选择你可以使用的版本。 $ pyenv install 2.7.18 你可以用以下命令检查安装的版本 $ pyenv versions 你可以使用如下命令切换全局版本 $ pyenv global 3.3.1 你可以使用如下命令在当前目录设置版本 $ pyenv local 3.5.2 你能够运行以下命令检查版本 $ python --version Python 2.7.18
从上游仓库中选取 commits 提交到另一个仓库 附加修改作者,消息,时间 前期准备 你要准备一个要同步的库 # 下载这个库 git clone git@github.com:coolbeevip/git-commits-replay.git # 查看这个库的所有 commits git --git-dir=./git-commits-replay/.git log --pretty=format:"%H,%an,%ae,%ad,%s" --date=format:'%Y-%m-%d %H:%M:%S' --reverse 52d099240f6da63193ba309106dad77d060836a7,Lei Zhang,zhanglei@apache.org,2023-02-18 10:49:43,Create A.md 516e406615c0020919939bafe59b35359a03c33b,Lei Zhang,zhanglei@apache.org,2023-02-18 10:50:09,Create B.md 551e5c88440396b73f3b1642bf765dcb9136fd1f,Lei Zhang,zhanglei@apache.org,2023-02-18 10:50:30,Create C.md 5dacf876b6f0b4a0d3ead7ec3daaac924b1b37f4,Lei Zhang,zhanglei@apache.org,2023-02-18 10:51:02,Create ALL.md 72a7a54c48286e9a7c92d1201108baa61cbd7db4,Lei Zhang,zhanglei@apache.org,2023-02-18 10:52:13,删除 A B C 新建一个仓库并关联要同步的库 # 新建一个本地仓库 mkdir git-commits-replay-local cd git-commits-replay-local git init git config --global init.defaultBranch master git branch -m master # 关联上游仓库 git remote add upstream git@github.com:coolbeevip/git-commits-replay.git 重放 commit 并修改提交信息 例如要将 52d099240f6da63193ba309106dad77d060836a7,Lei Zhang,zhanglei@apache.
Read more定时收集当前用户的CPU和内存利用率 创建如下 user_usage.sh #!/usr/bin/bash echo -e TIME\\tCPU%\\tMEM% while true do top -b -n 1 -u "$user" | awk -v user="$user" -v date="$(date '+%Y/%m/%d %H:%M:%S')" 'NR>7 { cpu_utilization_sum += $9; mem_utilization_sum += $10;} END { printf "%s\t%.2f\t%.2f\n",date,cpu_utilization_sum,mem_utilization_sum; }' sleep $1 done 每 3 秒采集一次 sh user_usage.sh 3 TIME CPU% MEM% 2023/01/06 17:26:56 64.80 82.10 2023/01/06 17:26:57 70.60 82.10 2023/01/06 17:26:58 393.60 82.10 2023/01/06 17:26:59 137.50 82.20 定时收集某个进程的CPU和内存利用率 创建如下 proc_usage.sh #!/usr/bin/bash echo proc $2 echo -e TIME\\tCPU%\\tMEM% while true do top -b -n 1 -p `ps -ef | grep $2 | grep -v grep | awk '{ print $2 }' | paste -s -d ','` | awk -v user="$user" -v date="$(date '+%Y/%m/%d %H:%M:%S')" 'NR>7 { cpu_utilization_sum += $9; mem_utilization_sum += $10;} END { printf "%s\t%.
Read more