Skip to content

Instantly share code, notes, and snippets.

@qinghon
qinghon / translate-po.py
Created April 17, 2024 03:39
translate .po file using ollama api
import argparse
import time
import polib
import requests
API = ""
def translate_text(prompt, model):
@qinghon
qinghon / ovs_cmake.patch
Created September 11, 2022 16:53
ovs support cmake
Index: tests/CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
--- /dev/null (date 1662902023379)
+++ b/tests/CMakeLists.txt (date 1662902023379)
@@ -0,0 +1,62 @@
Index: mc_v10/fsl_dpni.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/mc_v10/fsl_dpni.h b/mc_v10/fsl_dpni.h
--- a/mc_v10/fsl_dpni.h (revision c48bb2c0dabdd47e5f69fc808f380cfbd205291e)
+++ b/mc_v10/fsl_dpni.h (date 1655815719863)
@@ -264,6 +264,10 @@
uint32_t cmd_flags,
@qinghon
qinghon / i2c_release.c
Created April 24, 2022 07:06
i2c_release_bus_0
// plat/nxp/drivers/ddr/nxp-ddr/ddr.c
/* Return the bit mask of valid DIMMs found */
static int parse_spd(struct ddr_info *priv)
{
struct ddr_conf *conf = &priv->conf;
struct dimm_params *dimm = &priv->dimm;
int j, valid_mask = 0;
#ifdef CONFIG_DDR_NODIMM
valid_mask = ddr_get_ddr_params(dimm, conf);
@qinghon
qinghon / main.py
Created June 21, 2021 14:54
libtorrent python binding test signature
#!/usr/bin/env python3
import sys
import time
import nacl
from nacl.signing import SigningKey, VerifyKey
import libtorrent as lt
if __name__ == '__main__':
@qinghon
qinghon / move_bt_file.py
Last active October 16, 2021 14:50
move single file torrent to path
#!/usr/bin/env python3
# usage:
# depends: `pip install qbittorrent-api`
# step1: set `/path/to/move_bt_file.py "%C" "%I" "%F"` to qbittorent "Run external program on torrent completion"
# step2: create directory for single file torrent file prefix in `DIST_PATH`
# ps: only support single file torrent
import os
import sys
@qinghon
qinghon / dns.he.net.sh
Last active December 19, 2023 03:08
he.net ddns auto update
#!/bin/bash
nic="eth0"
export LastIP=`/bin/cat /var/log/ipv6addr`
export NowIP=`ip -o -6 addr show dev $nic scope global |head -n 1 | /bin/sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d'`
password="you password"
hostname="nas.d.youdomain.com"
if [ -z "$NowIP" ]
then