Skip to content

Instantly share code, notes, and snippets.

@TTTPOB
TTTPOB / send.py
Created May 13, 2021
send message to wecom (企业微信) by phone number
View send.py
#!/bin/env python3
## the reason why i use urllib is to minimize dependency requiremnts
## the reason i dont user serverchan (https://sc.ftqq.com/) is that i want a multiuser support
from urllib import request
import sys
import json
## Please Change xxxxxx to the value you have
CORPID="xxxxxx"
MSGSECRET="xxxxxx"
View 全局字体替换.css
@namespace url(http://www.w3.org/1999/xhtml);
/*!
* custom-yahei-family.css
* https://n2o.io/go?page=custom.css
*
* Copyright 2018 Francis Zhao <francis@n2o.io>
* https://n2o.io/license
*
* Date: 2018-03-11T15:00+06:00
@TTTPOB
TTTPOB / call-this-on-server-with-arg.py
Created Apr 11, 2021
telegram bot send message via cloudflare worker (for server notification like job done)
View call-this-on-server-with-arg.py
#!/usr/bin/env python3
from urllib import request
import sys
import json
TOKEN="16181xxxxx:xxxxxxxxxxxxxxx"
CHAT="-100118639xxxx"
TEXT=sys.argv[1]
SERVER="what ever name you want"
@TTTPOB
TTTPOB / SRR2fqgz.py
Last active Apr 15, 2021
NCBI SRR to fastq.gz, save your time by skipping the `fasterq-dump`
View SRR2fqgz.py
#!/usr/bin/env python
# coding: utf-8
# see https://blog.tpob.xyz/2021/03/24/%E6%9B%B4%E5%BF%AB%E4%B8%8B%E8%BD%BDsra%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%AD%E7%9A%84fastq.gz%E6%96%87%E4%BB%B6/ for more
import requests
import json
import sys
accesion=sys.argv[1]
@TTTPOB
TTTPOB / zfsMonitor.service
Created Feb 16, 2021
oversimplified script to monitor zpool status and send it to telegram via a bot
View zfsMonitor.service
[Unit]
Description=Monitoring the zpool on my machine
[Service]
ExecStart=/usr/local/bin/zfsMonitor
Type=oneshot
StandardOutput=journal
User=root
@TTTPOB
TTTPOB / socat@.service
Created Jan 24, 2021
socat systemd unit file for wsl2 to forward a port to windows host
View socat@.service
[Unit]
Description=Socat Greeting Service
Documentation=man:socat(1)
[Service]
User=root
Group=root
#ExecStart=/bin/bash -c "/usr/bin/env WSL_HOST=`tail -1 /etc/resolv.conf |cut -d' ' -f2` socat tcp-l:%i,fork,reuseaddr tcp:$WSL_HOST:%i "
ExecStart=/bin/bash -c "socat tcp-l:%i,fork,reuseaddr tcp:`tail -1 /etc/resolv.conf |cut -d' ' -f2`:%i"
Restart=on-success
@TTTPOB
TTTPOB / update_manifest.py
Created Oct 21, 2020
auto genereate winget manifest yaml for calibre when specify version code; for my own use so...
View update_manifest.py
import yaml
import os
import sys
versioncode = sys.argv[1]
url="https://download.calibre-ebook.com/" + versioncode + "/calibre-64bit-" + versioncode + ".msi"
os.system("aria2c -x16 --continue=true -o " + "calibre-64bit-" + versioncode + ".msi "+url)
hashval = os.popen("sha256sum calibre-64bit-"+versioncode+".msi"+" | cut -d\ -f1").read().strip()
manifest_dict = {
View full.list
DOMAIN-SUFFIX,51cto.com
DOMAIN-SUFFIX,51sjsj.com
DOMAIN-SUFFIX,5cy.com
DOMAIN-SUFFIX,5read.com
DOMAIN-SUFFIX,aacnjournals.org
DOMAIN-SUFFIX,aacrjournals.org
DOMAIN-SUFFIX,aacr.org
DOMAIN-SUFFIX,aappublications.org
DOMAIN-SUFFIX,accessmedicine.com
DOMAIN-SUFFIX,accesspharmacy.com
@TTTPOB
TTTPOB / sortPhoto.ps1
Last active Aug 7, 2020
OneDrive photo auto backup on phone will put all your photo in one place, I wrote this powershell script to sort them into different folders. It is easy to read and modify.
View sortPhoto.ps1
Get-ChildItem . | Foreach-Object -Process {
$subPath = $_.LastWriteTime.year.tostring() + "\" + $_.LastWriteTime.year.tostring() + "." + $_.LastWriteTime.month.tostring("00")
$from = $_.Name
function Move-Android ($subdest) {
Write-Output $_.Name
$dest = $subdest + "\" + $subPath
if (!(Test-Path $dest)) {
New-Item -Path $dest -ItemType Directory | Out-Null
}
@TTTPOB
TTTPOB / config.ini
Last active Apr 27, 2020
dler_windowtap
View config.ini
[custom]
;设置规则标志位
surge_ruleset=PseudoDirect,rules/ConnersHua/Surge/Ruleset/Unbreak.list
;surge_ruleset=PseudoReject,rules/NobyDa/Surge/AdRule.list
;surge_ruleset=PseudoReject,rules/ConnersHua/Surge/Ruleset/Hijacking.list
surge_ruleset=Academic,https://github.com/TTTPOB/SS-Rule-Snippet/raw/master/Rulesets/Custom/academic.list
surge_ruleset=ManuallySelect,rules/ConnersHua/Surge/Ruleset/GlobalMedia.list
surge_ruleset=ChinaMedia,rules/lhie1/Surge3/Domestic.list
surge_ruleset=DIRECT,https://gist.githubusercontent.com/TTTPOB/3cd919152e736581685fd84bb7071cdf/raw/Steam.list
surge_ruleset=ManuallySelect,rules/ConnersHua/Surge/Ruleset/Telegram.list