├── .gitignore ├── CreatePasswd ├── IDphoto.py ├── MASM ├── program │ ├── HELLO.EXE │ ├── HELLO.OBJ │ └── hello.asm ├── run └── tools │ ├── Link.exe │ ├── Masm.exe │ └── debug.exe ├── README.md ├── archiso ├── RemasterArchISO.sh └── isolinux.tar.gz ├── autossh ├── autossh.host ├── autossh.service ├── nginxssh.service └── test.sh ├── backup ├── arch-time-backup.prf ├── arch-time-backup.sh ├── borg-backup-arch-root.sh ├── obsolete │ ├── auto_rsync_mhd.sh │ ├── auto_rsync_office_tm.sh │ └── auto_rsync_zjscan-data.sh └── readme.md ├── bashrc ├── Makefile ├── arch.in ├── common ├── ifts-client.in ├── ifts-server.in └── systemd.in ├── check_x86-64_psabi.sh ├── continue.sh ├── create-ap ├── configure_iptables_transocks_and_create_ap.sh ├── readme.md └── transocks.toml ├── easyconnect-in-docker ├── Dockerfile ├── deploy.sh ├── dpkg.cfg.excludes ├── easyconnect.sh ├── ec-example.desktop ├── hook_script.sh ├── only-cli │ ├── Dockerfile.cli │ ├── dpkg.cfg.excludes │ ├── easyconnect.sh │ ├── get_cli_resources.sh │ └── readme.md ├── readme.md ├── slim_ecdata.sh └── start.sh ├── ffmpeg-flv-hevc-support ├── 010-add-av_stream_get_first_dts-for-chromium.patch ├── 050-add-flv_hevc-support.patch └── PKGBUILD ├── getboottime ├── gitrc ├── gitconfig └── gitignore_global ├── goldendict-pkg ├── PKGBUILD ├── PKGBUILD-old ├── PKGBUILD-test └── hidpi-icon.patch ├── image2mp4.sh ├── ipv6.sh ├── ipython-notebook ├── PKGBUILD-nbviewer-git ├── cjk_tplx │ ├── cjk.tplx │ ├── cjkart.tplx │ └── cjkrep.tplx └── nb2pdf.sh ├── linuxqq ├── PKGBUILD ├── app_launcher-index-lite.js └── linuxqq.sh ├── lost ├── 0002-libsixel-loader-gcc44.patch ├── labyrinth.py └── maze.py ├── m3u8-xmap-download.sh ├── make_A_mess.sh ├── mediawiki ├── LocalSettings-example.php ├── get-mediawiki ├── get-wiki-dumps.sh ├── import-wikidb.sh ├── import-xml-subwiki.sh └── mwdumper-1.16.jar ├── meiriyiwen.py ├── merge_pdf.sh ├── mpv ├── mpv-url-debug.desktop ├── mpv-url.desktop ├── mpv.conf ├── readme.md ├── script-opts │ ├── mpv_url_scheme.conf │ └── test_show_options.conf └── scripts │ ├── mpv_url_scheme.lua │ ├── property-list.txt │ ├── test_properties_hook.lua │ └── test_show_options.lua ├── myapp.sh ├── allstrap ├── gc.sh ├── git.sh ├── lapack.sh ├── libsixel.sh ├── luaprompt.sh ├── petsc.sh ├── ranger.sh ├── stripmyapp.sh ├── tig.sh └── zsh.sh ├── nanorc ├── fortran.nanorc └── nanorc ├── netinfocap ├── LICENSE ├── MANIFEST.in ├── README.rst ├── netinfocap │ ├── __init__.py │ ├── __main__.py │ ├── convert_json.py │ ├── extractor │ │ ├── __init__.py │ │ ├── bilive.py │ │ ├── extractor.py │ │ ├── hls.py │ │ └── rtmpt.py │ ├── infocapture.py │ ├── server.py │ └── vcsi │ │ ├── LICENSE │ │ ├── __init__.py │ │ └── vcsi.py ├── setup.cfg └── setup.py ├── novel123 ├── obsolete ├── 1015.c ├── 1015.cpp ├── 1026.c ├── bdsl.c ├── copy-passwd.sh ├── d2m.c ├── example_link_so │ ├── main.c │ ├── makefile │ ├── mod.c │ └── mod.h ├── ext-1089.py ├── gdpy3-animation-Hypocycloid.py ├── k_max.c ├── lychrel.py ├── main.c ├── main.cpp ├── num2str.f90 ├── prime.c ├── py3.12+logging-queue-handler-bug.py ├── py3.12+logging-queue-handler-fix.patch ├── py3.12+logging-queue-handler-patch-test.sh ├── py3.12+logging-queue-handler.py ├── ring.c ├── test-gdpy3-animation.py ├── test_error_handle.F90 ├── test_get_command_argument.F90 ├── test_reshape_order.F90 ├── testinterface-operator-compiler_ver.F90 ├── testinterface.F90 ├── testmod.lua ├── testnewmod.lua ├── testnewmod2.lua ├── tgpt-interactive-emoji-Prompt-test.patch ├── x2.m ├── x2_5cosx_5x.m └── ylgy.py ├── option ├── getopt-test └── getopts-test ├── pandocker ├── bash.bashrc └── dockerfile ├── pipe ├── test-srun-genlog.py └── test-srun-genlog.sh ├── quiz_store.py ├── random-desktop.pl ├── river_tif └── river.py ├── screenrc ├── setup-QChatGPT.sh ├── setup-Umi-OCR.sh ├── setup-gpt4free.sh ├── setup-gpt_academic.sh ├── setup-label-studio.sh ├── setup-pdf2zh.sh ├── setwp ├── PKGBUILD ├── TODO ├── setwp.conf └── setwp.py ├── slim_BB.sh ├── splitmv ├── TODO ├── setting.py └── splitmv.py ├── subprocess-ctrl-C.py ├── synergy ├── init.sh ├── mac-crypto.sh ├── synergy.conf ├── usynergys.service └── win-crypto.bat ├── systemd ├── 80-runtime-dir-xauthority.sh ├── reload_modules ├── sleep@.service ├── tlp.service ├── xsecurelock.service └── xsecurelock@.service ├── test_youku_ccode.sh ├── th-1a ├── auto-thvpn.sh ├── ecvpn.sh └── keep.sh ├── time_group_file.py ├── trap.sh ├── travel-node-s.sh ├── turtle ├── DeepinScrot-3619.png ├── bingdundun.py ├── doggy.py ├── figure_1.png ├── leaf-show.py └── leaf.py ├── uos-info ├── apt-sources.list.d │ ├── appstore.list │ ├── driver.list │ └── printer.list ├── debian_version ├── oem-settings.ini ├── os-release └── usr-share-settings-home.ini ├── var.mk ├── vim ├── lua │ └── keymaps.lua └── vimrc ├── wget-list.sh ├── wg字典.pl ├── wpsforlinux ├── PKGBUILD ├── check_data.sh ├── wps-office.xml └── wpsoffice.install ├── wpsoffice-PKGBULD ├── merge_PKGBUILD └── orig_PKGBUILD │ ├── wpsoffice-common │ ├── LICENSE │ └── PKGBUILD │ ├── wpsoffice-fonts │ ├── PKGBUILD │ └── wpsoffice-fonts.install │ ├── wpsoffice-langpack │ └── PKGBUILD │ ├── wpsoffice-templates │ └── PKGBUILD │ └── wpsoffice │ ├── PKGBUILD │ ├── wps-office.xml │ └── wpsoffice.install ├── wpsoffice-i18n └── PKGBUILD ├── wsshell.py ├── xdpi.py ├── you-get └── iqiyi.md └── 儿童动画 ├── make-list.py ├── 小猪佩奇.tar.gz ├── 巴塔木ABC.tar.gz ├── 巴塔木流行儿歌.tar.gz ├── 巴塔木童谣.tar.gz ├── 汪汪队立大功 └── src │ └── 2021 ├── 海底小纵队 ├── 2211 ├── 5416 ├── 21799 └── src │ ├── read_1_6.sh │ ├── 特别篇.html.gz │ ├── 第1季.html.gz │ ├── 第2季.html.gz │ ├── 第3季.html.gz │ ├── 第4季.html.gz │ ├── 第5季.html.gz │ └── 第6季.html.gz ├── 超级宝贝JOJO.tar.gz └── 迷你小洞 ├── read_1_3.sh ├── you-mpv.sh ├── 迷你小洞-玩创造.gz ├── 迷你小洞-第一季.gz ├── 迷你小洞-第三季.gz └── 迷你小洞-第二季.gz /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | Md_Tex_pandoc/*.pdf 3 | *.iso 4 | docker/*.tar* 5 | easyconnect-in-docker/ECDATA/* 6 | __pycache__/ 7 | linuxqq/*.deb 8 | linuxqq/LiteLoaderQQNT-*.zip 9 | *.src.tar.gz 10 | *.pkg.tar.xz 11 | *.pkg.tar.zst 12 | create-ap/transocks 13 | ffmpeg-flv-hevc-support/1*-*.patch 14 | -------------------------------------------------------------------------------- /CreatePasswd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+=" 4 | LENGTH="$1" 5 | while [ "${n:=1}" -le "$LENGTH" ] 6 | do 7 | PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}" 8 | let n+=1 9 | done 10 | echo "$PASS" 11 | exit 0 12 | -------------------------------------------------------------------------------- /IDphoto.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2021 shmilee 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | 10 | class IDphoto(object): 11 | '''Convert photo''' 12 | # ref: https://blog.csdn.net/pythonlaodi/article/details/110188261 13 | 14 | def __init__(self, path, resize_kwargs=None): 15 | self.path = path 16 | photo = cv2.imread(path) 17 | if resize_kwargs: 18 | photo = cv2.resize(photo, **resize_kwargs) 19 | rows, cols, channels = photo.shape 20 | print('Photo shape: %dx%d, channels=%d' % (rows, cols, channels)) 21 | self.photo = photo 22 | self.rows = rows 23 | self.cols = cols 24 | 25 | def select(self, lower, upper, iterations): 26 | # 图片转换为灰度图 27 | hsv = cv2.cvtColor(self.photo, cv2.COLOR_BGR2HSV) 28 | # 图片的二值化处理 29 | # 将在两个阈值内的像素值设置为白色 255, 不在阈值区间内的像素值设置为黑色 0 30 | mask = cv2.inRange(hsv, np.array(lower), np.array(upper)) 31 | # 腐蚀膨胀 若是腐蚀膨胀后仍有白色噪点,可以增加iterations的值 32 | erode = cv2.erode(mask, None, iterations=iterations) 33 | self.dilate = cv2.dilate(erode, None, iterations=iterations) 34 | 35 | def cover(self, new_BGR): 36 | # BGR通道, 蓝 (255,0,0), 红 (0,0,255), 白 (255,255,255) 37 | for i in range(self.rows): 38 | for j in range(self.cols): 39 | if self.dilate[i, j] == 255: # 像素点255表示白色 40 | self.photo[i, j] = new_BGR # 替换颜色, BGR通道 41 | 42 | def save(self, path): 43 | cv2.imwrite(path, self.photo) 44 | 45 | def show(self): 46 | cv2.imshow('IDphoto', self.photo) 47 | 48 | def _A2B(self, path, lower, upper, new, iterations): 49 | self.select(lower, upper, iterations) 50 | self.cover(new) 51 | self.save(path) 52 | 53 | def blue2red(self, path, lower_blue=(90, 70, 70), upper_blue=(110, 255, 255), iterations=2): 54 | self._A2B(path, lower_blue, upper_blue, (0, 0, 255), iterations) 55 | 56 | def blue2white(self, path, lower_blue=(90, 70, 70), upper_blue=(110, 255, 255), iterations=2): 57 | self._A2B(path, lower_blue, upper_blue, (255, 255, 255), iterations) 58 | 59 | def red2blue(self, path, lower_red=(0, 135, 135), upper_red=(180, 245, 230), iterations=2): 60 | self._A2B(path, lower_red, upper_red, (255, 0, 0), iterations) 61 | 62 | def red2white(self, path, lower_red=(0, 135, 135), upper_red=(180, 245, 230), iterations=2): 63 | self._A2B(path, lower_red, upper_red, (255, 255, 255), iterations) 64 | 65 | 66 | if __name__ == '__main__': 67 | idphoto = IDphoto('./test.jpg') 68 | idphoto.blue2red('./test-out.jpg') 69 | -------------------------------------------------------------------------------- /MASM/program/HELLO.EXE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/MASM/program/HELLO.EXE -------------------------------------------------------------------------------- /MASM/program/HELLO.OBJ: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/MASM/program/HELLO.OBJ -------------------------------------------------------------------------------- /MASM/program/hello.asm: -------------------------------------------------------------------------------- 1 | TITLE 'HELLO.EXE---PRINT HELLO ON SCREEN' 2 | CR EQU 0DH 3 | LF EQU 00H 4 | CSEG SEGMENT PUBLIC 'CODE' 5 | ASSUME CS:CSEG,DS:DSEG,SS:STACK 6 | PRINT PROC FAR 7 | PUSH BX 8 | PUSH AX 9 | PUSH DS 10 | MOV AX,DSEG 11 | MOV DS,AX 12 | MOV bX,OFFSET MESSAGE 13 | MOV AH,06h 14 | INT 10H 15 | INT 20H 16 | POP DS 17 | POP AX 18 | POP BX 19 | PRINT ENDP 20 | CSEG ENDS 21 | ; 22 | DSEG SEGMENT 'DATA' 23 | MESSAGE DB CR,'HELLO!',CR,LF,'$' 24 | DSEG ENDS 25 | ; 26 | STACK SEGMENT STACK 'STACK' 27 | DW 64 DUP(9) 28 | STACK ENDS 29 | END PRINT 30 | 31 | -------------------------------------------------------------------------------- /MASM/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dosbox -c 'mount d: ./' -c 'path %path%;d:\tools' -------------------------------------------------------------------------------- /MASM/tools/Link.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/MASM/tools/Link.exe -------------------------------------------------------------------------------- /MASM/tools/Masm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/MASM/tools/Masm.exe -------------------------------------------------------------------------------- /MASM/tools/debug.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/MASM/tools/debug.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | shmilee's github stats 3 | 4 | 5 | 6 | 7 | 8 | 9 | 一些脚本 10 | -------------------------------------------------------------------------------- /archiso/isolinux.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/archiso/isolinux.tar.gz -------------------------------------------------------------------------------- /autossh/autossh.host: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Example script to start up tunnel with autossh. 4 | # 5 | # This script will tunnel 2200 from the remote host 6 | # to 22 on the local host. On remote host do: 7 | # ssh -p 2200 localhost 8 | # 9 | # $Id: autossh.host,v 1.6 2004/01/24 05:53:09 harding Exp $ 10 | # 11 | 12 | ID=shmilee 13 | HOST=222.205.57.208 14 | HOST_PORT=5321 15 | 16 | if [ "X$SSH_AUTH_SOCK" = "X" ]; then 17 | eval `ssh-agent -s` 18 | ssh-add $HOME/.ssh/id_rsa 19 | fi 20 | 21 | AUTOSSH_POLL=600 22 | AUTOSSH_PORT=20000 23 | #AUTOSSH_GATETIME=30 24 | AUTOSSH_LOGFILE=$(date +%F).log 25 | AUTOSSH_DEBUG=yes 26 | #AUTOSSH_PATH=/usr/local/bin/ssh 27 | export AUTOSSH_POLL AUTOSSH_LOGFILE AUTOSSH_DEBUG AUTOSSH_PATH AUTOSSH_GATETIME AUTOSSH_PORT 28 | 29 | autossh -2 -fN -M 20000 -R 3690:127.0.0.1:22 ${ID}@${HOST} -p ${HOST_PORT} 30 | -------------------------------------------------------------------------------- /autossh/autossh.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=AutoSSH service for a reverse tunnel from 222-205-57-208 3 | # place this in ~/.config/systemd/user/, than enable this. 4 | # Requires=sshd.service 5 | After=network.target 6 | After=sshd.service 7 | 8 | [Service] 9 | Environment="AUTOSSH_GATETIME=0" "AUTOSSH_POLL=60" "AUTOSSH_LOGFILE=%h/.autossh.log" 10 | ExecStart=/usr/bin/autossh -M 20000 -NR 3690:localhost:22 -o TCPKeepAlive=yes -p 5321 shmilee@222.205.57.208 -i %h/.ssh/id_rsa 11 | 12 | [Install] 13 | WantedBy=default.target 14 | -------------------------------------------------------------------------------- /autossh/nginxssh.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=AutoSSH service for local port 80 forwarded to 222-205-57-208:80 3 | # place this in /etc/systemd/system/, than enable this. 4 | After=network.target 5 | Requires=nginx.service 6 | After=nginx.service 7 | 8 | [Service] 9 | Environment="AUTOSSH_GATETIME=0" "AUTOSSH_POLL=60" "AUTOSSH_LOGFILE=/var/log/nginxssh.log" 10 | ExecStart=/usr/bin/autossh -M 22000 -NR 222.205.57.208:917:localhost:917 -NR 222.205.57.208:80:localhost:80 -o TCPKeepAlive=yes -p 5321 root@222.205.57.208 -i /home/shmilee/.ssh/id_rsa 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /autossh/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #passwd=$1 4 | remote='shmilee@222.205.57.208' 5 | port='5321' 6 | 7 | 8 | #if [ x$passwd == x ];then 9 | # echo "need \$1 == passwd" 10 | # exit 1 11 | #fi 12 | if ! systemctl status sshd;then 13 | echo "start sshd.service first!" 14 | exit 2 15 | fi 16 | 17 | re=1 18 | i=1 19 | 20 | while [ $re != 0 -a $i != 3600 ];do 21 | if ssh -p $port $remote 'ls' 2>&1 >/dev/null;then 22 | echo ----[`date +%m-%d-%T`]第$i连接---- 23 | echo " -> Begin ..." 24 | #plink -N -R 3690:127.0.0.1:22 -P $port $remote -pw $passwd 25 | autossh -NR 3690:127.0.0.1:22 -p $port $remote 26 | let i++ 27 | echo " -> `date +%m-%d-%T`" 28 | echo " -> Over. Wait 20s and reconnect." 29 | sleep 20 30 | else 31 | echo " -> remote Unreachable. Wait 10s and retry." 32 | sleep 10 33 | fi 34 | done 35 | -------------------------------------------------------------------------------- /backup/arch-time-backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2024 shmilee 3 | 4 | CMD='rsync_tmbackup.sh' 5 | PROFILE="$1" 6 | Exclude_List= 7 | 8 | if (hash rsync &>/dev/null) && (hash ${CMD} &>/dev/null); then 9 | if [ -z "${PROFILE}" ]; then 10 | echo "usage: $0 " 11 | exit 1 12 | fi 13 | if [ ! -f "${PROFILE}" ]; then 14 | echo "!!! Profile not found: ${PROFILE} !" 15 | exit 2 16 | fi 17 | else 18 | echo "!!! Lost command: rsync or ${CMD}!" 19 | exit 3 20 | fi 21 | 22 | read_profile() { 23 | local lineN0=$(awk '/^#.*THE_EXCLUDE_LIST_BEGIN/{print NR;exit}' "${PROFILE}") 24 | local lineN1=$(awk '/^[ ]*THE_EXCLUDE_LIST_BEGIN[ ]*$/{print NR;exit}' "${PROFILE}") 25 | local lineN2=$(awk '/^[ ]*THE_EXCLUDE_LIST_END[ ]*$/{print NR;exit}' "${PROFILE}") 26 | if [ -z "$lineN0" -o -z "$lineN1" -o -z "$lineN2" ]; then 27 | echo "!!! Invalid profile: ${PROFILE} !" 28 | exit 4 29 | fi 30 | local profile_source_part="$(mktemp -u -t 'atb.profile.source.part.XXXXX')" 31 | awk -v n=$lineN0 '{if(NR"${profile_source_part}" 32 | Exclude_List="$(mktemp -u -t 'atb.profile.exclude.list.XXXXX')" 33 | awk -v n1=$lineN1 -v n2=$lineN2 '{if((n1"${Exclude_List}" 34 | 35 | source "${profile_source_part}" 36 | rm "${profile_source_part}" 37 | # default 38 | RSYNC_FLAGS="${RSYNC_FLAGS:-$($CMD --rsync-get-flags)}" 39 | EXP_STATEGY="${EXP_STATEGY:-1:1 30:7 365:30}" 40 | } 41 | 42 | 43 | show_info() { 44 | cat < $msg [y/n] " ans 60 | if [ "$ans" = 'y' -o "$ans" = 'Y' ];then 61 | return 0 62 | else 63 | return 1 64 | fi 65 | } 66 | 67 | create_backup() { 68 | local SSHOPT='' 69 | if [ -n "${SSH_PORT}" ]; then 70 | SSHOPT+="-p ${SSH_PORT}" 71 | fi 72 | if [ -n "${SSH_KEY}" ]; then 73 | SSHOPT+=" -i ${SSH_KEY}" 74 | fi 75 | printf 'CMD: %s %s --rsync-set-flags "%s" --strategy "%s" "%s" "%s" "%s"\n\n' \ 76 | "${CMD}" "${SSHOPT}" "${RSYNC_FLAGS}" "${EXP_STATEGY}" \ 77 | "${SOURCE}" "${DESTINATION}" "${Exclude_List}" 78 | if ask "Continue?"; then 79 | ${CMD} ${SSHOPT} --rsync-set-flags "${RSYNC_FLAGS}" --strategy "${EXP_STATEGY}" \ 80 | "${SOURCE}" "${DESTINATION}" "${Exclude_List}" 81 | fi 82 | rm "${Exclude_List}" 83 | } 84 | 85 | read_profile 86 | show_info 87 | create_backup 88 | exit 0 89 | -------------------------------------------------------------------------------- /backup/obsolete/auto_rsync_mhd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SRC_DESTS=( 3 | "$HOME/ifts_study:/media/数据/ifts_study:--delete:--delete-excluded" 4 | "$HOME/ifts_study:/media/GTC-DATA/ifts_study:--delete:--delete-excluded" 5 | "$HOME/project:/media/store/project:--delete:--delete-excluded" 6 | ) 7 | 8 | for s_d in ${SRC_DESTS[@]}; do 9 | src=$(echo $s_d | cut -d ':' -f1) 10 | dest=$(echo $s_d | cut -d ':' -f2) 11 | echo "===== $src --> $dest =====" 12 | deloption=$(echo $s_d | cut -d ':' -f3- | sed 's/:/ /g') 13 | rsyncoption='-a -v --progress' 14 | if [ -n "$deloption" ]; then 15 | echo "WARN: $deloption option is ON!" 16 | rsyncoption="$rsyncoption $deloption" 17 | fi 18 | if [ ! -f $src/auto_rsync_exclude ]; then 19 | echo "WARN: Not found auto_rsync_exclude in $src directory!" 20 | else 21 | rsyncoption="$rsyncoption --exclude-from=$src/auto_rsync_exclude" 22 | fi 23 | echo "CMD: rsync $rsyncoption $src/ $dest" 24 | if [ ! -d "$dest" ]; then 25 | echo "ERROR: Not found DEST directory '$dest'!" 26 | echo "vqq is in 'System Vol.. Info..'!" 27 | else 28 | read -p "Continue y/n? " ans 29 | if [ x$ans == 'xy' ]; then 30 | rsync $rsyncoption "$src/" "$dest" 31 | fi 32 | fi 33 | done 34 | -------------------------------------------------------------------------------- /backup/obsolete/auto_rsync_office_tm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | office='shmilee@office.zju' 3 | SRC_DESTS=( 4 | "$HOME/ifts_study:/home/backup/ifts_study" 5 | "$HOME/project:/home/backup/project" 6 | ) 7 | 8 | echo "please run rsync_tmbackup on same machine!!" 9 | exit 1 10 | 11 | for s_d in ${SRC_DESTS[@]}; do 12 | src=$(echo $s_d | cut -d ':' -f1) 13 | dest=$(echo $s_d | cut -d ':' -f2) 14 | echo "===== $src --> $office:$dest =====" 15 | option=$(echo $s_d | cut -d ':' -f3- | sed 's/:/ /g') 16 | if [ -n "$deloption" ]; then 17 | cmd="rsync_tmbackup.sh -p 6658 $option $src $office:$dest" 18 | else 19 | cmd="rsync_tmbackup.sh -p 6658 $src $office:$dest" 20 | fi 21 | if [ ! -f $src/auto_rsync_exclude ]; then 22 | echo "WARN: Not found auto_rsync_exclude in $src directory!" 23 | else 24 | cmd="$cmd $src/auto_rsync_exclude" 25 | fi 26 | echo "CMD: $cmd" 27 | read -p "Continue y/n? " ans 28 | if [ x$ans == 'xy' ]; then 29 | $cmd 30 | fi 31 | done 32 | -------------------------------------------------------------------------------- /backup/obsolete/auto_rsync_zjscan-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SRC_DESTS=( 3 | # "$HOME/ifts_study/zjlab-project1:/home/data-nfnas/zjlab-project1:--delete:--delete-excluded" 4 | "/home/data-zjhpc/GTC-DB-base2023/snapshot:/media/GTC-DATA/GTC-DB-base2023/snapshot" 5 | "/home/data-zjhpc/GTC-DB-base2023/zetapsi3d:/media/GTC-DATA/GTC-DB-base2023/zetapsi3d" 6 | "/home/data-zjhpc/GTC-DB-base2023/flux3d:/media/GTC-DATA/GTC-DB-base2023/flux3d" 7 | # "/home/data-zjhpc/snap20231214/snapshot:/home/shmilee/ifts_study/research/04-nonlinear-simulation-ITG-TEM-isotope-effect/20231214-nonlinear-ITGak/snapshot" 8 | # "/home/data-zjhpc/snap20231214/zetapsi3d:/home/shmilee/ifts_study/research/04-nonlinear-simulation-ITG-TEM-isotope-effect/20231214-nonlinear-ITGak/zetapsi3d" 9 | # "/home/data-zjhpc/snap20231214/flux3d:/home/shmilee/ifts_study/research/04-nonlinear-simulation-ITG-TEM-isotope-effect/20231214-nonlinear-ITGak/flux3d" 10 | ) 11 | 12 | for s_d in ${SRC_DESTS[@]}; do 13 | src=$(echo $s_d | cut -d ':' -f1) 14 | dest=$(echo $s_d | cut -d ':' -f2) 15 | echo "===== $src --> $dest =====" 16 | deloption=$(echo $s_d | cut -d ':' -f3- | sed 's/:/ /g') 17 | rsyncoption='-a -v --progress --append-verify' 18 | if [ -n "$deloption" ]; then 19 | echo "WARN: $deloption option is ON!" 20 | rsyncoption="$rsyncoption $deloption" 21 | fi 22 | if [ ! -f $src/auto_rsync_exclude ]; then 23 | echo "WARN: Not found auto_rsync_exclude in $src directory!" 24 | else 25 | rsyncoption="$rsyncoption --exclude-from=$src/auto_rsync_exclude" 26 | fi 27 | echo "CMD: rsync $rsyncoption $src/ $dest" 28 | if [ ! -d "$dest" ]; then 29 | echo "ERROR: Not found DEST directory '$dest'!" 30 | else 31 | read -p "Continue y/n? " ans 32 | if [ x$ans == 'xy' ]; then 33 | rsync $rsyncoption "$src/" "$dest" 34 | fi 35 | fi 36 | done 37 | -------------------------------------------------------------------------------- /backup/readme.md: -------------------------------------------------------------------------------- 1 | move to https://github.com/shmilee/arch-time-backup 2 | 3 | write new shell script based on `rsync_tmbackup.sh`. 4 | -------------------------------------------------------------------------------- /bashrc/Makefile: -------------------------------------------------------------------------------- 1 | RCFILE = \ 2 | rc-arch \ 3 | rc-ifts 4 | ArchLinux = ifts-client.in arch.in systemd.in 5 | IFTS = ifts-server.in 6 | 7 | 8 | all: $(RCFILE) 9 | 10 | rc-arch: 11 | cat common $(ArchLinux) >arch.bashrc 12 | 13 | rc-ifts: 14 | cat common $(IFTS) >ifts.bashrc 15 | 16 | install-arch: 17 | install -m644 arch.bashrc $(HOME)/.bashrc 18 | 19 | install-ifts: 20 | install -m644 ifts.bashrc $(HOME)/.bashrc 21 | 22 | clean: 23 | $(RM) arch.bashrc ifts.bashrc 24 | 25 | .PHONY: install clean 26 | -------------------------------------------------------------------------------- /bashrc/arch.in: -------------------------------------------------------------------------------- 1 | # ArchLinux 2 | source /usr/share/doc/pkgfile/command-not-found.bash 3 | 4 | alias Arch_update='sudo pacman -Syu' 5 | alias fbterm_zh='LANG=zh_CN.UTF-8 fbterm' 6 | 7 | extract() { 8 | local c e i 9 | (($#)) || return 10 | for i; do 11 | c='' 12 | e=1 13 | if [[ ! -r $i ]]; then 14 | echo "$0: file is unreadable: \`$i'" >&2 15 | continue 16 | fi 17 | case $i in 18 | *.t@(gz|lz|xz|b@(2|z?(2))|a@(z|r?(.@(Z|bz?(2)|gz|lzma|xz))))) 19 | c='bsdtar xvf';; 20 | *.7z) c='7z x';; 21 | *.Z) c='uncompress';; 22 | *.bz2) c='bunzip2';; 23 | *.exe) c='cabextract';; 24 | *.gz) c='gunzip';; 25 | *.rar) c='unrar x';; 26 | *.xz) c='unxz';; 27 | *.zip) c='unzip -O GBK';; 28 | *) echo "$0: unrecognized file extension: \`$i'" >&2 29 | continue;; 30 | esac 31 | command $c "$i" 32 | e=$? 33 | done 34 | return $e 35 | } 36 | 37 | # list "${@:3}", $1 beginning number, $2 the number of items in a row 38 | list() { 39 | local n=($(seq -w $1 $((${#@}+$1-3)))) i=0 _f 40 | for _f in ${@:3}; do 41 | (($i%$2==0)) && echo -e -n "\t" # indent 42 | echo -e -n "${n[$i]}) $_f;\t" 43 | (( $i%$2 == $(($2-1)) )) && echo # \n 44 | ((i++)) 45 | done 46 | (($i%$2==0)) ||echo # aliquant \n 47 | } 48 | 49 | -------------------------------------------------------------------------------- /bashrc/common: -------------------------------------------------------------------------------- 1 | # 2 | # ~/.bashrc 3 | # 4 | 5 | # Source global definitions 6 | if [ -f /etc/bashrc ]; then 7 | . /etc/bashrc 8 | fi 9 | if [ -f /etc/bash.bashrc ]; then 10 | . /etc/bash.bashrc 11 | fi 12 | 13 | shopt -s extglob 14 | 15 | # If not running interactively, don't do anything 16 | #[[ $- != *i* ]] && return 17 | 18 | # colorful man page 19 | export PAGER="`which less` -s" 20 | export BROWSER="$PAGER" 21 | export LESS_TERMCAP_mb=$'\E[01;34m' 22 | export LESS_TERMCAP_md=$'\E[01;34m' 23 | export LESS_TERMCAP_me=$'\E[0m' 24 | export LESS_TERMCAP_se=$'\E[0m' 25 | export LESS_TERMCAP_so=$'\E[01;44;33m' 26 | export LESS_TERMCAP_ue=$'\E[0m' 27 | export LESS_TERMCAP_us=$'\E[01;33m' 28 | 29 | # PS1 30 | export PROMPT_COMMAND='PS_result=`RET=$?;[ $RET == 0 ]&&echo -ne "\033[0;32m:) $RET"||echo -ne "\e[0;31m:( $RET"`' 31 | PS1='(\A) \[\e[0;34m\]\u\[\e[0;0m\]@\[\e[0;33m\]\h\[\e[0;0m\] \w $PS_result\[\e[0;0m\]\n\$ ' 32 | 33 | # modified commands 34 | alias grep='grep --color=auto' 35 | alias more='less' 36 | alias c='clear' 37 | alias df='df -h' 38 | alias du='du -c -h' 39 | alias openports='netstat --all --numeric --programs --inet --inet6' 40 | alias ping='ping -c 5' 41 | alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' 42 | 43 | # ls 44 | alias ls='ls -hF --color=auto' 45 | alias lr='ls -R' # recursive ls 46 | alias ll='ls -l' 47 | alias la='ll -A' 48 | alias lx='ll -BX' # sort by extension 49 | alias lz='ll -rS' # sort by size 50 | alias lt='ll -rt' # sort by date 51 | alias lm='la | more' 52 | 53 | # safety features 54 | alias cp='cp -i' 55 | alias mv='mv -i' 56 | #alias rm='rm -I' # 'rm -i' prompts for every file 57 | alias ln='ln -i' 58 | alias chown='chown --preserve-root' 59 | alias chmod='chmod --preserve-root' 60 | alias chgrp='chgrp --preserve-root' 61 | 62 | -------------------------------------------------------------------------------- /bashrc/ifts-client.in: -------------------------------------------------------------------------------- 1 | # IFTS.ZJU 2 | alias ifts="ssh -p 5789 smli@10.22.92.173" 3 | alias oldifts="TERM=linux ssh -p 10321 smli@10.22.92.172" 4 | alias zion='ssh -p 5789 smli@10.22.92.171' 5 | 6 | scp2ifts () { scp -P 5789 -r $1 smli@10.22.92.173:upload/; } 7 | scp4ifts () { scp -P 5789 -r smli@10.22.92.173:$1 ./; } 8 | 9 | scp2zion () { scp -P 5789 -r $1 smli@10.22.92.171:upload/; } 10 | scp4zion () { scp -P 5789 -r smli@10.22.92.171:$1 ./; } 11 | 12 | -------------------------------------------------------------------------------- /bashrc/ifts-server.in: -------------------------------------------------------------------------------- 1 | # User specific aliases and functions 2 | 3 | # source /public/program/pgi/linux86-64/10.0/pgi.sh 4 | # source /public/program/pgi.7.0/linux86-64/7.1-4/pgi.sh 5 | 6 | # intel mpi 64bit 7 | # source /public/program/intel/impi/3.2.1.009/bin64/mpivars.sh 8 | 9 | # intel mpi 10 | # source /public/program/intel/impi/3.2.1.009/bin/mpivars.sh 11 | 12 | # 2_1.3.2p1+gcc 13 | # source /public/program/mpi/mpich2/1.3.2p1/bin/mpivars.sh 14 | 15 | # mpich2_1.4.1p1+gcc 16 | # source /public/program/mpi/mpich2/1.4.1p1/gcc.gfortran/bin/mpivars.sh 17 | 18 | # openmpi+icc 19 | source /public/program/mpi/openmpi/1.4.3/icc_ifort/bin/mpivars.sh 20 | 21 | # openmpi+gcc 22 | # source /public/program/mpi/openmpi/1.4.3/gcc.gfortran/bin/mpivars.sh 23 | 24 | # mvapich2+icc 25 | # source /public/program/mpi/mvapich2/1.4.1/icc.ifort/x86_64/bin/mpivars.sh 26 | 27 | # LD_LIBRARY_PATH=/public/program/hdf5-1.8.8-linux-x86_64-static/lib:${LD_LIBRARY_PATH} 28 | # export LD_LIBRARY_PATH 29 | 30 | #export SYS=LinuxMPI 31 | 32 | #-----------------------------2013-12-25----------------------------------------------# 33 | export PATH=$PATH:/public/home/users/tgzhang/lib/hdf5-1.8.8/bin 34 | export PATH=$PATH:/public/home/users/tgzhang/lib/netcdf-4.1.2/bin 35 | export PATH=$PATH:/public/home/users/tgzhang/lib/adios-1.3.1/bin 36 | #export PATH=$PATH:/public/home/users/tgzhang/lib/netcdf-4.1.3/bin 37 | export PATH=$PATH:/public/home/users/tgzhang/matlab/MATLAB/R2012a/bin 38 | #---------------------------------------------------------------------------------------# 39 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/public/home/users/tgzhang/lib/zlib-1.2.5/lib 40 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/public/home/users/tgzhang/lib/mxml-2.7/lib 41 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/public/home/users/tgzhang/lib/netcdf-4.1.3/lib 42 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/public/program/lapack-3.4.0 43 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/public/home/users/tgzhang/lib/NTCC/lib 44 | #export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/public/program/hdf5-1.8.8-linux-x86_64-static/lib 45 | #---------------------------------------------------------------------------------------# 46 | # export PETSC_DIR=/public/home/users/czhao/src/petsc-3.1-p8 47 | # export PETSC_ARCH=linux-pgi-opt 48 | export PETSC_DIR=/public/home/users/tgzhang/lib/petsc-3.4.4 49 | export PETSC_ARCH=linux-gnu-intel 50 | 51 | # myapp: git ipython 52 | LD_LIBRARY_PATH=~/myapp/usr/lib:${LD_LIBRARY_PATH} 53 | PATH=~/myapp/usr/bin:$PATH 54 | 55 | -------------------------------------------------------------------------------- /bashrc/systemd.in: -------------------------------------------------------------------------------- 1 | # simplified systemd command, for instance "sudo systemctl stop xxx.service" - > "0.stop xxx" 2 | if ! systemd-notify --booted; 3 | then # for not systemd 4 | 0.start() { 5 | sudo rc.d start $@ 6 | } 7 | 8 | 0.restart() { 9 | sudo rc.d restart $@ 10 | } 11 | 12 | 0.stop() { 13 | sudo rc.d stop $@ 14 | } 15 | else 16 | # start systemd service 17 | 0.start() { 18 | sudo systemctl start $@ 19 | } 20 | # restart systemd service 21 | 0.restart() { 22 | sudo systemctl restart $@ 23 | } 24 | # stop systemd service 25 | 0.stop() { 26 | sudo systemctl stop $@ 27 | } 28 | # enable systemd service 29 | 0.enable() { 30 | sudo systemctl enable $@ 31 | } 32 | # disable a systemd service 33 | 0.disable() { 34 | sudo systemctl disable $@ 35 | } 36 | # show the status of a service 37 | 0.status() { 38 | systemctl status $@ 39 | } 40 | # reload a service configuration 41 | 0.reload() { 42 | sudo systemctl reload $@ 43 | } 44 | # list all running service 45 | 0.list() { 46 | systemctl 47 | } 48 | # list all failed service 49 | 0.failed () { 50 | systemctl --failed 51 | } 52 | # list all systemd available unit files 53 | 0.list-files() { 54 | systemctl list-unit-files 55 | } 56 | # check the log 57 | 0.log() { 58 | sudo journalctl $@ 59 | } 60 | # show wants 61 | 0.wants() { 62 | systemctl show -p "Wants" $1.target 63 | } 64 | # analyze the system 65 | 0.analyze() { 66 | systemd-analyze $@ 67 | } 68 | fi 69 | 70 | -------------------------------------------------------------------------------- /check_x86-64_psabi.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/awk -f 2 | 3 | #https://dl.xanmod.org/check_x86-64_psabi.sh 4 | 5 | BEGIN { 6 | while (!/flags/) if (getline < "/proc/cpuinfo" != 1) exit 1 7 | if (/lm/&&/cmov/&&/cx8/&&/fpu/&&/fxsr/&&/mmx/&&/syscall/&&/sse2/) level = 1 8 | if (level == 1 && /cx16/&&/lahf/&&/popcnt/&&/sse4_1/&&/sse4_2/&&/ssse3/) level = 2 9 | if (level == 2 && /avx/&&/avx2/&&/bmi1/&&/bmi2/&&/f16c/&&/fma/&&/abm/&&/movbe/&&/xsave/) level = 3 10 | if (level == 3 && /avx512f/&&/avx512bw/&&/avx512cd/&&/avx512dq/&&/avx512vl/) level = 4 11 | if (level > 0) { print "CPU supports x86-64-v" level; exit level + 1 } 12 | exit 1 13 | } 14 | -------------------------------------------------------------------------------- /continue.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | get_char() 3 | { 4 | SAVEDSTTY=`stty -g` 5 | stty -echo 6 | stty cbreak 7 | dd if=/dev/tty bs=1 count=1 2> /dev/null 8 | stty -raw 9 | stty echo 10 | stty $SAVEDSTTY 11 | } 12 | echo "" 13 | echo "请按任意键继续操作!" 14 | char=`get_char` 15 | echo "done" 16 | -------------------------------------------------------------------------------- /create-ap/readme.md: -------------------------------------------------------------------------------- 1 | 1. https://github.com/lakinduakash/linux-wifi-hotspot 2 | 3 | ``` 4 | sudo create_ap wlan0 wlan0 yourAP YourPass -g 192.168.6.1 5 | ``` 6 | 7 | 2. transocks https://github.com/cybozu-go/transocks 8 | 9 | Bin https://github.com/cybozu-go/transocks/issues/29 10 | 11 | ``` 12 | ./transocks -f ./transocks.toml 13 | ``` 14 | 15 | 3. https://gist.github.com/andersondanilo/a28e7165fa8a9700d8ead20a224ecf44 16 | 17 | ``` 18 | ./configure_iptables_transocks_and_create_ap.sh 19 | ``` 20 | 21 | 4. ap-client -> ap -> transocks -> 8087 22 | -------------------------------------------------------------------------------- /create-ap/transocks.toml: -------------------------------------------------------------------------------- 1 | # listening address of transocks. 2 | listen = "0.0.0.0:12345" # default is "localhost:1081" 3 | 4 | proxy_url = "socks5://127.0.0.1:8087" # for SOCKS5 server 5 | #proxy_url = "http://10.20.30.40:3128" # for HTTP proxy server 6 | 7 | [log] 8 | #filename = "/path/to/file" # default to stderr 9 | level = "info" # critical", error, warning, info, debug 10 | #format = "json" # plain, logfmt, json 11 | -------------------------------------------------------------------------------- /easyconnect-in-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # debian 10 buster 2 | # https://hub.docker.com/_/debian/ 3 | 4 | FROM debian:buster-slim 5 | 6 | LABEL maintainer="shmilee.zju@gmail.com" \ 7 | release.version="buster" \ 8 | ec.versions="7.6.3 7.6.7 etc." \ 9 | description="buster with EasyConnect run prerequisites" 10 | 11 | ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \ 12 | DEBIAN_CODENAME=buster \ 13 | DEBIAN_MIRROR=http://mirrors.163.com/debian \ 14 | EasyConnectDir=/usr/share/sangfor/EasyConnect 15 | 16 | # DEBIAN_SECURITY_MIRROR=http://mirrors.163.com/debian-security \ 17 | # && echo "deb $DEBIAN_SECURITY_MIRROR $DEBIAN_CODENAME/updates main contrib" >> /etc/apt/sources.list \ 18 | 19 | COPY dpkg.cfg.excludes /etc/dpkg/dpkg.cfg.d/01_excludes 20 | RUN echo "deb $DEBIAN_MIRROR $DEBIAN_CODENAME main contrib" > /etc/apt/sources.list \ 21 | && echo "deb $DEBIAN_MIRROR $DEBIAN_CODENAME-updates main contrib" >> /etc/apt/sources.list \ 22 | && apt-get update \ 23 | && apt-get install -y --no-install-recommends --no-install-suggests \ 24 | tini busybox iptables iproute2 psmisc \ 25 | libgtk2.0-0 libx11-xcb1 libxtst6 libnss3 libasound2 libdbus-glib-1-2 \ 26 | dante-server openssh-client openssh-server \ 27 | ttf-wqy-microhei \ 28 | && rm /usr/bin/tini-static \ 29 | && rm -r /usr/share/icons/Adwaita/ \ 30 | && ln -s "$(which busybox)" /usr/local/bin/ip \ 31 | && ln -s "$(which busybox)" /usr/local/bin/ifconfig \ 32 | && ln -s "$(which busybox)" /usr/local/bin/route \ 33 | && ln -s "$(which busybox)" /usr/local/bin/ping \ 34 | && apt-get -y autoremove && apt-get clean \ 35 | && rm -rf /var/lib/apt/lists/* 36 | 37 | ADD ./easyconnect.sh /usr/bin/easyconnect.sh 38 | RUN chmod +x /usr/bin/easyconnect.sh 39 | 40 | ENTRYPOINT ["/usr/bin/tini", "--"] 41 | 42 | CMD ["easyconnect.sh", "2"] 43 | -------------------------------------------------------------------------------- /easyconnect-in-docker/dpkg.cfg.excludes: -------------------------------------------------------------------------------- 1 | # put me /etc/dpkg/dpkg.cfg.d/01_excludes 2 | 3 | # Drop documents, keep copyright 4 | path-exclude /usr/share/doc/* 5 | path-include /usr/share/doc/*/copyright 6 | 7 | # Drop all manual pages 8 | path-exclude /usr/share/man/* 9 | 10 | # Drop translations 11 | path-exclude /usr/share/locale/* 12 | path-include /usr/share/locale/en_US/* 13 | path-include /usr/share/locale/locale.alias 14 | -------------------------------------------------------------------------------- /easyconnect-in-docker/ec-example.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=EC{{VERSION}} 3 | Comment=EC{{VERSION}} 4 | # edit options, like tag, port 5 | Exec="{{HOSTECDIR}}/start.sh" -p 127.0.0.1:3600:1080 6 | Icon={{HOSTECDIR}}/resources/EasyConnect.png 7 | Terminal=false 8 | Type=Application 9 | StartupNotify=true 10 | Categories=Network; 11 | -------------------------------------------------------------------------------- /easyconnect-in-docker/only-cli/Dockerfile.cli: -------------------------------------------------------------------------------- 1 | # debian 10 buster 2 | # https://hub.docker.com/_/debian/ 3 | 4 | FROM debian:buster-slim 5 | 6 | LABEL maintainer="shmilee.zju@gmail.com" \ 7 | release.version="buster" \ 8 | ec.versions="7.6.3 7.6.7 7.6.8" \ 9 | description="buster with EasyConnect & run prerequisites" 10 | 11 | ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \ 12 | DEBIAN_CODENAME=buster \ 13 | DEBIAN_MIRROR=http://mirrors.163.com/debian 14 | 15 | COPY dpkg.cfg.excludes /etc/dpkg/dpkg.cfg.d/01_excludes 16 | RUN echo "deb $DEBIAN_MIRROR $DEBIAN_CODENAME main contrib" > /etc/apt/sources.list \ 17 | && echo "deb $DEBIAN_MIRROR $DEBIAN_CODENAME-updates main contrib" >> /etc/apt/sources.list \ 18 | && apt-get update \ 19 | && apt-get install -y --no-install-recommends --no-install-suggests \ 20 | tini busybox iptables psmisc dante-server \ 21 | && rm /usr/bin/tini-static \ 22 | && ln -s "$(which busybox)" /usr/local/bin/ps \ 23 | && ln -s "$(which busybox)" /usr/local/bin/ip \ 24 | && ln -s "$(which busybox)" /usr/local/bin/ifconfig \ 25 | && ln -s "$(which busybox)" /usr/local/bin/route \ 26 | && ln -s "$(which busybox)" /usr/local/bin/ping \ 27 | && apt-get -y autoremove && apt-get clean \ 28 | && rm -rf /var/lib/apt/lists/* 29 | 30 | ADD ./easyconn_resources_x64_7.6-378.tar.gz /usr/share/sangfor/EasyConnect/ 31 | ADD ./easyconnect.sh /usr/bin/easyconnect.sh 32 | RUN chmod +x /usr/bin/easyconnect.sh \ 33 | && /usr/share/sangfor/EasyConnect/change_authority.sh 34 | 35 | ENTRYPOINT ["/usr/bin/tini", "--"] 36 | 37 | CMD ["easyconnect.sh", "2"] 38 | -------------------------------------------------------------------------------- /easyconnect-in-docker/only-cli/dpkg.cfg.excludes: -------------------------------------------------------------------------------- 1 | # put me /etc/dpkg/dpkg.cfg.d/01_excludes 2 | 3 | # Drop documents, keep copyright 4 | path-exclude /usr/share/doc/* 5 | path-include /usr/share/doc/*/copyright 6 | 7 | # Drop all manual pages 8 | path-exclude /usr/share/man/* 9 | 10 | # Drop translations 11 | path-exclude /usr/share/locale/* 12 | path-include /usr/share/locale/en_US/* 13 | path-include /usr/share/locale/locale.alias 14 | -------------------------------------------------------------------------------- /easyconnect-in-docker/only-cli/readme.md: -------------------------------------------------------------------------------- 1 | # 参考致谢 2 | https://github.com/Hagb/docker-easyconnect 3 | 4 | # build 5 | 6 | * [7.6.3](http://download.sangfor.com.cn/download/product/sslvpn/pkg/linux_01/EasyConnect_x64.deb) 7 | * [7.6.7](http://download.sangfor.com.cn/download/product/sslvpn/pkg/linux_767/EasyConnect_x64_7_6_7_3.deb) 8 | * [7.6.8](https://github.com/shmilee/scripts/releases/download/v0.0.1/easyconn_7.6.8.2-ubuntu_amd64.deb) 9 | 10 | ```bash 11 | ./get_cli_resources.sh 12 | export TAG=$(date +%y%m%d) 13 | docker build --rm -t shmilee/easyconnect-cli:$TAG -f Dockerfile.cli . 14 | ``` 15 | 16 | ``` 17 | $ dockre images 18 | REPOSITORY TAG IMAGE ID CREATED SIZE 19 | shmilee/easyconnect-cli 210307 b85eb30e8d2a 9 minutes ago 106MB 20 | ``` 21 | 22 | # run 23 | 24 | ```bash 25 | docker run --rm --device /dev/net/tun --cap-add NET_ADMIN -i -t \ 26 | -p 127.0.0.1:3600:1080 \ 27 | -e ECADDRESS=xxx.cn:443 \ 28 | -e ECUSER=xxx \ 29 | -e VERSION=7.6.7 \ 30 | shmilee/easyconnect-cli:$TAG 31 | # output 32 | Running default main ... 33 | Run hook_resources_conf 34 | '/usr/share/sangfor/EasyConnect/resources/conf' -> 'conf-v7.6.7' 35 | Run hook_danted 36 | Run CMD: /usr/share/sangfor/EasyConnect/resources/bin/ECAgent --resume & 37 | Start ECAgent success! 38 | Run CMD: /usr/share/sangfor/EasyConnect/resources/bin/easyconn login -v -d xxx:443 -u xxx 39 | No previous user logged in! 40 | No previous user logged in! 41 | vpn adress: vpn.xxx.cn:443 42 | Get https://vpn.xxx.cn:443/por/login_auth.csp ... 43 | Get https://vpn.xxx.cn:443/por/login_auth.csp Done, code=200 44 | Cipher Suite: AES128-SHA 45 | Begin detect listen port of ECAgent ... 46 | Read listen port of ECAgent from file: 54530 47 | Done detect listen port of ECAgent, result: 54530! 48 | Get https://127.0.0.1:54530/ECAgent ... 49 | Get https://127.0.0.1:54530/ECAgent Done, code=200 50 | password: xxxx 51 | Authenticating user "xxxx" by password ... 52 | Post https://vpn.xxx.cn:443/por/login_psw.csp ... 53 | Post https://vpn.xxx.cn:443/por/login_psw.csp Done, code=200 54 | Get https://127.0.0.1:54530/ECAgent ... 55 | Get https://127.0.0.1:54530/ECAgent Done, code=200 56 | Get https://127.0.0.1:54530/ECAgent ... 57 | Get https://127.0.0.1:54530/ECAgent Done, code=200 58 | user "xxx" login successfully! 59 | ==> WARNING: Please run 'clear' to hide you password!!! 60 | ╭─[root@8ec67df00663]-(22:51:45) 61 | ╰─[Enter login/logout/mylogin/bash/exit/??] 62 | ╭─[root@8ec67df00663]-[tun0:10.xxx.1.xxx]-(22:51:51) 63 | ╰─[Enter login/logout/mylogin/bash/exit/??] exit 64 | Run CMD: /usr/share/sangfor/EasyConnect/resources/bin/easyconn logout 65 | user "xxx" is already logged out! 66 | ``` 67 | -------------------------------------------------------------------------------- /easyconnect-in-docker/slim_ecdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2021 shmilee 3 | 4 | # EC versions to slim, 7.6.3, 7.6.7 5 | VERSIONa="${1:-7.6.3}" 6 | VERSIONb="${2:-7.6.7}" 7 | # EC data repo dir 8 | DATAREPO="${3:-./ECDATA}" 9 | 10 | HOSTECDIRa="${DATAREPO}/EasyConnect_x64_v$VERSIONa" 11 | HOSTECDIRb="${DATAREPO}/EasyConnect_x64_v$VERSIONb" 12 | 13 | # ln $relativea/* $realpathb/* if md5sum equal 14 | ln_equal() { 15 | relativea="$1" 16 | realpathb="$2" 17 | oldPWD="$PWD" 18 | cd "${realpathb}" 19 | for f in `ls .`; do 20 | if [ -f "${relativea}/$f" ]; then 21 | md5a=`md5sum ${relativea}/$f | awk '{print $1}'` 22 | md5b=`md5sum $f | awk '{print $1}'` 23 | if [ "$md5a" = "$md5b" ]; then 24 | mv $f $f-bk 25 | ln -v "${relativea}/$f" $f && rm $f-bk || mv $f-bk $f 26 | fi 27 | fi 28 | done 29 | cd "${oldPWD}" 30 | } 31 | 32 | 33 | if [ ! -d $HOSTECDIRa ]; then 34 | echo ">> lost Dir $HOSTECDIRa of version $VERSIONa!" 35 | exit 1 36 | fi 37 | if [ ! -d $HOSTECDIRb ]; then 38 | echo ">> lost Dir $HOSTECDIRb of version $VERSIONb!" 39 | exit 1 40 | fi 41 | ln_equal "../EasyConnect_x64_v$VERSIONa" "$HOSTECDIRb" 42 | ln_equal "../../../EasyConnect_x64_v$VERSIONa/resources/lib64" \ 43 | "$HOSTECDIRb/resources/lib64" 44 | ln_equal "../../../EasyConnect_x64_v$VERSIONa/resources/bin-cli768" \ 45 | "$HOSTECDIRb/resources/bin-cli768" 46 | -------------------------------------------------------------------------------- /easyconnect-in-docker/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2021 shmilee 3 | 4 | # image tag 5 | TAG="${TAG:-210306}" 6 | # X11, VNC, CLI 7 | USEUI="${USEUI:-X11}" 8 | 9 | if [ x"$1" = x"-h" -o x"$1" = x"--help" ]; then 10 | cat <> Usage: 12 | $0 13 | TAG= USEUI= $0 14 | >> default TAG: ${TAG} 15 | >> default USEUI: ${USEUI} 16 | >> params example: 17 | # iptable : -e IPTABLES=1 -e IPTABLES_LEGACY=1 18 | # danted : -e NODANTED=1 OR -p 127.0.0.1:1080:1080 19 | # USEUI=VNC : -e PASSWORD=x -e ECPASSWORD= -p 127.0.0.1:5901:5901 20 | # sshd : -e SSHD=1 -e ROOTPASSWD=x1 -p 127.0.0.1:2222:22 21 | # USEUI=CLI : -e ECADDRESS=x:p -e ECUSER= -e ECPASSWORD= 22 | EOF 23 | exit 0 24 | fi 25 | 26 | EasyConnectDir=/usr/share/sangfor/EasyConnect 27 | HOSTECDIR="$(dirname $(realpath $0))" 28 | echo ">>> Host Dir to mount: ${HOSTECDIR}" 29 | 30 | watch_url() { 31 | echo "Start watching url." 32 | echo >"${HOSTECDIR}"/tmp-url 33 | while true; do 34 | tail -n 0 -f "${HOSTECDIR}"/tmp-url | grep 'NEWURL:' -m1 >/dev/null 35 | if grep '#BREAK#' "${HOSTECDIR}"/tmp-url >/dev/null; then 36 | break 37 | fi 38 | xdg-open "$(tail -n1 ${HOSTECDIR}/tmp-url)" 39 | done 40 | echo "Stop watching url." 41 | rm "${HOSTECDIR}"/tmp-url 42 | } 43 | 44 | common_opts="--rm --device /dev/net/tun \ 45 | --cap-add NET_ADMIN \ 46 | --ulimit nofile=65535:65535 \ 47 | -v ${HOSTECDIR}:${EasyConnectDir}" 48 | # params, like -p, -e etc. 49 | params="-e USEUI=$USEUI ${@}" 50 | if [ x"$USEUI" = xVNC ]; then 51 | watch_url & 52 | docker run $common_opts $params -t \ 53 | shmilee/easyconnect:$TAG 54 | echo 'NEWURL: #BREAK#' >>"${HOSTECDIR}"/tmp-url 55 | elif [ x"$USEUI" = xCLI ]; then 56 | docker run $common_opts $params -i -t \ 57 | shmilee/easyconnect:$TAG 58 | else 59 | # default USEUI=X11 60 | watch_url & 61 | xhost +LOCAL: 62 | docker run $common_opts $params \ 63 | -v /tmp/.X11-unix:/tmp/.X11-unix \ 64 | -v $HOME/.Xauthority:/root/.Xauthority \ 65 | -e DISPLAY=$DISPLAY \ 66 | shmilee/easyconnect:$TAG 67 | xhost -LOCAL: 68 | echo 'NEWURL: #BREAK#' >>"${HOSTECDIR}"/tmp-url 69 | fi 70 | 71 | exit 0 72 | -------------------------------------------------------------------------------- /ffmpeg-flv-hevc-support/010-add-av_stream_get_first_dts-for-chromium.patch: -------------------------------------------------------------------------------- 1 | diff '--color=auto' -rupN ffmpeg.orig/libavformat/avformat.h ffmpeg/libavformat/avformat.h 2 | --- ffmpeg.orig/libavformat/avformat.h 2022-08-19 17:42:47.323422603 +0200 3 | +++ ffmpeg/libavformat/avformat.h 2022-08-19 17:42:51.347130436 +0200 4 | @@ -1128,6 +1128,10 @@ struct AVCodecParserContext *av_stream_g 5 | */ 6 | int64_t av_stream_get_end_pts(const AVStream *st); 7 | 8 | +// Chromium: We use the internal field first_dts vvv 9 | +int64_t av_stream_get_first_dts(const AVStream *st); 10 | +// Chromium: We use the internal field first_dts ^^^ 11 | + 12 | #define AV_PROGRAM_RUNNING 1 13 | 14 | /** 15 | diff '--color=auto' -rupN ffmpeg.orig/libavformat/mux_utils.c ffmpeg/libavformat/mux_utils.c 16 | --- ffmpeg.orig/libavformat/mux_utils.c 2022-08-19 17:42:47.346758108 +0200 17 | +++ ffmpeg/libavformat/mux_utils.c 2022-08-19 17:47:28.549589002 +0200 18 | @@ -37,6 +37,13 @@ int64_t av_stream_get_end_pts(const AVSt 19 | return AV_NOPTS_VALUE; 20 | } 21 | 22 | +// Chromium: We use the internal field first_dts vvv 23 | +int64_t av_stream_get_first_dts(const AVStream *st) 24 | +{ 25 | + return cffstream(st)->first_dts; 26 | +} 27 | +// Chromium: We use the internal field first_dts ^^^ 28 | + 29 | int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, 30 | int std_compliance) 31 | { 32 | -------------------------------------------------------------------------------- /getboottime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | T1=`date +%s` &&\ 3 | T2=`uptime | awk '{if($4 = "days,")print $3*24*60*60+$5*60*60}'` &&\ 4 | T3=`expr ${T1} - ${T2}` &&\ 5 | T4=`perl -le "print scalar gmtime ${T3}"` 6 | zenity --info --text="开机日期:\n$T4" 7 | -------------------------------------------------------------------------------- /gitrc/gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = shmilee 3 | email = shmilee.zju@gmail.com 4 | [alias] 5 | ci = commit 6 | st = status 7 | co = checkout 8 | br = branch 9 | lg = log -p 10 | stage = add 11 | unstage = reset HEAD 12 | plog = log --pretty=tformat:'%h %Cblue%cr%Creset %cn %Cgreen%s%Creset' 13 | graph = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all 14 | timmeh = commit -am'TIMMEH\\!' 15 | subs = submodule foreach git pull origin master¬ 16 | local = log --numstat --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --first-parent --no-merges 17 | ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate 18 | ll = log --numstat --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate 19 | [color] 20 | ui = auto 21 | [color "branch"] 22 | current = yellow reverse 23 | local = yellow 24 | remote = green 25 | [color "diff"] 26 | meta = yellow bold 27 | frag = magenta bold 28 | old = red bold 29 | new = green bold 30 | [color "status"] 31 | added = yellow 32 | changed = green 33 | untracked = cyan 34 | [push] 35 | default = current 36 | [core] 37 | editor = vim 38 | excludesfile = ~/.gitignore_global 39 | -------------------------------------------------------------------------------- /gitrc/gitignore_global: -------------------------------------------------------------------------------- 1 | *~ 2 | .DS_* 3 | -------------------------------------------------------------------------------- /goldendict-pkg/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: slbtty 2 | 3 | pkgname=goldendict-ng 4 | pkgver=24.05.05 5 | true_ver=24.05.05-LiXia.ecd1138c 6 | pkgrel=4 7 | pkgdesc="The next generation GoldenDict (Supports Qt WebEngine & Qt6)." 8 | arch=('i686' 'x86_64' 'aarch64') 9 | url="https://github.com/xiaoyifang/goldendict-ng" 10 | license=('GPL3') 11 | depends=( 12 | # ffmpeg 13 | hunspell 14 | libvorbis 15 | libxtst 16 | lzo 17 | zlib 18 | xz 19 | # libeb 20 | tomlplusplus 21 | fmt 22 | opencc 23 | xapian-core 24 | libzim 25 | qt6-base 26 | qt6-svg 27 | qt6-multimedia 28 | qt6-webengine 29 | qt6-speech 30 | qt6-5compat 31 | ) 32 | makedepends=( 33 | git 34 | cmake 35 | ninja 36 | qt6-tools 37 | ) 38 | conflicts=('goldendict' 'goldendict-git' 'goldendict-ng-git' 'goldendict-svn' 'goldendict-git-opt') 39 | provides=('goldendict') 40 | replaces=('goldendict-svn' 'goldendict-git-opt' 'goldendict-webengine-git') 41 | source=("${pkgname}-${pkgver}.tar.gz::https://github.com/xiaoyifang/goldendict-ng/archive/refs/tags/v${true_ver}.tar.gz") 42 | sha256sums=('e7cf55fef4ddf00d87b4e54489ec33a605b1d5634d0b7c46ddcdd261c3113790') 43 | 44 | prepare() { 45 | # This flag leads to crashs around Oct 2022, remove this in future. 46 | export CXXFLAGS+=" -Wp,-U_GLIBCXX_ASSERTIONS" 47 | } 48 | 49 | build(){ 50 | cd "$srcdir/$pkgname-${true_ver}" 51 | cmake -B build_dir -S . -G Ninja \ 52 | -DCMAKE_INSTALL_PREFIX='/usr' \ 53 | -DUSE_SYSTEM_FMT=ON \ 54 | -DUSE_SYSTEM_TOML=ON \ 55 | -DWITH_EPWING_SUPPORT=OFF \ 56 | -DWITH_FFMPEG_PLAYER=OFF \ 57 | -Wno-dev 58 | cmake --build build_dir 59 | } 60 | 61 | package() { 62 | cd "$srcdir/$pkgname-${true_ver}" 63 | DESTDIR="$pkgdir" cmake --install ./build_dir/ 64 | } 65 | -------------------------------------------------------------------------------- /goldendict-pkg/PKGBUILD-old: -------------------------------------------------------------------------------- 1 | # Maintainer: shmilee 2 | # Contributor: Jaroslav Lichtblau 3 | # Contributor: m0rph 4 | 5 | pkgname=goldendict 6 | pkgver="1.5.0" 7 | pkgrel=4 8 | pkgdesc='A feature-rich dictionary lookup program, supporting multiple dictionary formats and online dictionaries' 9 | arch=('x86_64') 10 | url="https://github.com/goldendict/goldendict" 11 | license=('GPL3') 12 | depends=( 13 | 'libvorbis' 'libxtst' 'libao' 'libtiff' 14 | #'libeb' # for epwing etc. 15 | 'qt5-webkit' 'qt5-svg' 'qt5-x11extras' 'qt5-tools' 'qt5-multimedia' 16 | 'hunspell' 'ffmpeg' 'opencc' 17 | 'bzip2' 'lzo' 'xz' 'zlib' 'zstd' 18 | ) 19 | source=( 20 | "${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/${pkgver}.tar.gz" 21 | hidpi-icon.patch 22 | ) 23 | sha256sums=('f9f8e068ece74cc026fdc5f56615246228b4e70c97c7197ccd4c14ceae412c7c' 24 | '635759e4e4e3049bd5cb2f8b72878826266a62446cf85737f490789b808c9b5d') 25 | 26 | prepare() { 27 | cd "${pkgname}-${pkgver}" 28 | patch -Np1 -i "$srcdir"/hidpi-icon.patch 29 | msg "Fixing QMake in goldendict.pro file..." 30 | echo "QMAKE_CXXFLAGS_RELEASE = ${CFLAGS}" >> goldendict.pro 31 | echo "QMAKE_CFLAGS_RELEASE = ${CXXFLAGS}" >> goldendict.pro 32 | msg "Setting default version string..." 33 | sed -i "s/^\(VERSION = .*\)+git/\1/" goldendict.pro 34 | qmake-qt5 PREFIX='/usr' \ 35 | 'CONFIG+=no_epwing_support' \ 36 | 'CONFIG+=chinese_conversion_support' \ 37 | 'CONFIG+=zim_support' \ 38 | goldendict.pro 39 | } 40 | 41 | build(){ 42 | cd "${pkgname}-${pkgver}" 43 | make ${MAKEFLAGS} -j4 44 | } 45 | 46 | package() { 47 | cd "${pkgname}-${pkgver}" 48 | make INSTALL_ROOT="${pkgdir}" install 49 | } 50 | -------------------------------------------------------------------------------- /goldendict-pkg/PKGBUILD-test: -------------------------------------------------------------------------------- 1 | # Maintainer: shmilee 2 | # Contributor: Jaroslav Lichtblau 3 | # Contributor: m0rph 4 | 5 | _pkgname=goldendict 6 | pkgname="${_pkgname}" 7 | _commit=d9e25834b2841860056fed92c09f8f837598480d 8 | _commit_ver="r$((3470-2016)).g${_commit:0:8}" 9 | pkgver="1.5.0rc2.${_commit_ver}" 10 | pkgrel=1 11 | pkgdesc='A feature-rich dictionary lookup program, supporting multiple dictionary formats and online dictionaries' 12 | arch=('x86_64') 13 | url="http://goldendict.org" 14 | license=('GPL3') 15 | depends=('libvorbis' 'zlib' 'hunspell' 'libxtst' 'lzo' 'bzip2' 16 | 'libao' 'libtiff' 17 | #'libeb' 18 | 'qt5-webkit' 'qt5-svg' 'qt5-x11extras' 'qt5-tools' 'qt5-multimedia' 19 | 'ffmpeg' 20 | 'opencc' 21 | 'xz' 'zstd' 22 | ) 23 | provides=("stardict" "${_pkgname}") 24 | conflicts=("${_pkgname}") 25 | source=("${_pkgname}-${pkgver}.tar.gz::https://github.com/xiaoyifang/${_pkgname}/archive/${_commit}.tar.gz") 26 | sha256sums=('6b76c954a3e0cfd5354bc6c6c27345eb38da2135de98f1e977858e8cc88fb497') 27 | 28 | prepare() { 29 | cd "${_pkgname}-${_commit}" 30 | msg "Remove winlibs/ " 31 | rm -r winlibs/ 32 | msg "Fixing QMake in goldendict.pro file..." 33 | echo "QMAKE_CXXFLAGS_RELEASE = ${CFLAGS}" >> goldendict.pro 34 | echo "QMAKE_CFLAGS_RELEASE = ${CXXFLAGS}" >> goldendict.pro 35 | msg "Setting default version string..." 36 | sed -i "s/^\(VERSION = \).*/\1-${pkgver}/" goldendict.pro 37 | qmake-qt5 PREFIX='/usr' \ 38 | 'CONFIG+=no_epwing_support' \ 39 | 'CONFIG+=chinese_conversion_support' \ 40 | 'CONFIG+=zim_support' \ 41 | goldendict.pro 42 | } 43 | 44 | build(){ 45 | cd "${_pkgname}-${_commit}" 46 | make ${MAKEFLAGS} -j4 47 | } 48 | 49 | package() { 50 | cd "${_pkgname}-${_commit}" 51 | make INSTALL_ROOT="${pkgdir}" install 52 | } 53 | -------------------------------------------------------------------------------- /goldendict-pkg/hidpi-icon.patch: -------------------------------------------------------------------------------- 1 | --- a/main.cc 2022-06-27 00:01:13.000000000 +0800 2 | +++ b/main.cc 2022-06-26 23:59:48.000000000 +0800 3 | @@ -235,6 +235,19 @@ 4 | #endif 5 | #endif 6 | 7 | +// test AA_EnableHighDpiScaling 8 | +// https://doc.qt.io/qt-5/highdpi.html#high-dpi-support-in-qt 9 | +#if QT_VERSION >= QT_VERSION_CHECK( 5, 6, 0 ) 10 | + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 11 | +#endif 12 | +// test AA_UseHighDpiPixmaps 13 | +// https://www.qt.io/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11 14 | +// https://github.com/goldendict/goldendict/issues/1441 15 | +#if QT_VERSION >= QT_VERSION_CHECK( 5, 1, 0 ) 16 | + //gdWarning("!!!!! test AA_UseHighDpiPixmaps"); 17 | + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); 18 | +#endif 19 | + 20 | // The following clause fixes a race in the MinGW runtime where throwing 21 | // exceptions for the first time in several threads simultaneously can cause 22 | // an abort(). This code throws first exception in a safe, single-threaded 23 | -------------------------------------------------------------------------------- /image2mp4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2021 shmilee 3 | 4 | #1)控制视频帧率 5 | # -r fps 帧率,可以指定两个帧率,输入帧率,输出帧率; 6 | # 输入帧率:-i之前,设定读入帧率,比如 -r 0.5 ,也就是说1秒要播0.5个图片,那么一个图也就是要播2s 7 | # 输出频率:-i之后,真正的输出视频播放帧率,不写话,是默认和输入频率一样。 8 | # 比如设 -r 30 ,对应上面的设定,一个图播2s,那么输出文件播放时,这2s内,都是这张图,但是播放了6 9 | 10 | #2)输出的视频画质下降,原因:影响视频质量的最重要因素是视频码率,输出视频的码率是默认的,只有200kbits/s 11 | # 解决方案:修改默认的视频码率属性-b:v -bufsize 12 | # 注意:当不清楚输出码率应该设置为多少,可以指定一个比较大的数字 13 | 14 | #3)其他参数 15 | # -f image2 指定fmt 16 | # -start_number 500 指定从拿一张图片开始合成视频 17 | # -threads 2 以两个线程进行运行,加快处理的速度。 18 | # -y 对输出文件进行覆盖 19 | # -vcodec libx264; -vcodec mpeg4 指定视频解码器 20 | # -i image-%04d.jpg 输入文件格式,0001, 0002 ... 21 | 22 | #4)加字幕解说 23 | # -vf subtitles=./xxx.ass 24 | # -b:a 160k 25 | echo "example: ffmpeg -f image2 -r 5 -i "./%06d.jpg" -vcodec libx264 -r 5 -b:v 2000k -bufsize 2000k out.mp4" 26 | 27 | out="${2:-out.mp4}" 28 | ffmpeg -f image2 -r 5 -i "$1" -vcodec libx264 -r 5 -b:v 2000k -bufsize 2000k $out 29 | -------------------------------------------------------------------------------- /ipv6.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function setupipv6 4 | { 5 | echo 6 | myip=`ifconfig eth0 | awk '/inet / {print $2}'` 7 | ip tunnel add is0 mode sit remote 10.10.5.56 local $myip 8 | ip link set is0 up 9 | ip addr add 2001:da8:e000:90:0:5efe:$myip/64 dev is0 10 | ip route add default via 2001:da8:e000:90::1 dev is0 11 | echo 12 | if ifconfig | grep is0 >/dev/null 13 | then 14 | echo "Success to set up IPv6 Tunnel !" 15 | else 16 | echo "Fail to set up IPv6 Tunnel !" 17 | fi 18 | echo 19 | } 20 | 21 | if [ $# -lt 1 ]; then 22 | setupipv6 23 | elif [ "$1" == "-r" ]; then 24 | ip tunnel del is0 25 | setupipv6 26 | elif [ "$1" == "-d" ]; then 27 | ip tunnel del is0 28 | else 29 | echo 30 | echo "Usage: ipv6 : set up ipv6 tunnel" 31 | echo " ipv6 -d : unset ipv6 tunnel" 32 | echo " ipv6 -r : reset up ipv6 tunnel" 33 | echo 34 | fi 35 | -------------------------------------------------------------------------------- /ipython-notebook/PKGBUILD-nbviewer-git: -------------------------------------------------------------------------------- 1 | # Maintainer: shmilee 2 | 3 | #remove google-analytics ... 4 | _rm_ga=yes 5 | 6 | _pkgname=nbviewer 7 | pkgname=python-nbviewer-git 8 | pkgver=r863.8ea799f 9 | pkgrel=1 10 | pkgdesc="A webservice rendering ipynb to static HTML, the web application behind nbviewer.ipython.org" 11 | arch=('any') 12 | url="https://github.com/jupyter/nbviewer" 13 | license=('BSD') 14 | depends=('ipython>=3.0.0' 'python-tornado>=3.1.1' 'python-pycurl' 'python-markdown' 'python-elasticsearch' 'python-sphinx>=0.3' 'python-jsonschema' 'python-mistune') 15 | # 'python-pygments' 'python-jinja' 'python2-futures' 16 | makedepends=('invoke' 'nodejs-less' 'nodejs-bower' 'python<3.5') 17 | optdepends=('python-pylibmc: improvement with memcache' 18 | 'python-newrelic: New Relic performance monitoring' 19 | 'mathjax: display mathematics' ) 20 | options=(!emptydirs) 21 | install= 22 | source=("git+https://github.com/jupyter/${_pkgname}.git" "${_pkgname}.service") 23 | md5sums=('SKIP' 24 | '4d11e0118c436aabc2536c2b39a78d35') 25 | 26 | pkgver() { 27 | cd "$srcdir/${_pkgname}" 28 | printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" 29 | } 30 | 31 | build() { 32 | cd "$srcdir/${_pkgname}" 33 | 34 | sed -i 's|^NPM_BIN.*$|NPM_BIN = "/usr/bin"|' tasks.py 35 | invoke bower 36 | 37 | cp -r /usr/lib/node_modules/less/ less 38 | cd less/ 39 | npm install less-plugin-autoprefix less-plugin-clean-css --save-dev 40 | cd .. 41 | sed -i 's|^NPM_BIN.*$|NPM_BIN = os.path.join(APP_ROOT, "less", "bin")|' tasks.py 42 | invoke less 43 | } 44 | 45 | package() { 46 | cd "$srcdir/${_pkgname}" 47 | python setup.py install --root="$pkgdir/" --optimize=1 48 | cd "$srcdir/" 49 | # systemd 50 | install -Dm 644 ${_pkgname}.service \ 51 | "$pkgdir/usr/lib/systemd/system/${_pkgname}.service" 52 | # mathjax & path with python<3.5 53 | cd "$pkgdir"/usr/lib/python3.4/site-packages/nbviewer/ 54 | ln -s /usr/share/mathjax static/mathjax 55 | msg2 "replace cdn.mathjax." 56 | sed -i 's|https://cdn.mathjax.org/mathjax/latest|/static/mathjax|' templates/notebook.html 57 | 58 | if [[ $_rm_ga == yes ]]; then 59 | msg2 "remove google-analytics ..." 60 | if grep -A10 -B10 -n UA-38683231-2 templates/layout.html; then 61 | _line=$(grep UA-38683231-2 templates/layout.html -n|awk -F: '{print $1}') 62 | _ln1=$(expr $_line - 5) 63 | _ln2=$(expr $_line + 2) 64 | msg2 "from line $_ln1 to $_ln2. Check this." 65 | sed -i "${_ln1},${_ln2}d" templates/layout.html 66 | else 67 | msg2 "Not found the script for google-analytics." 68 | fi 69 | fi 70 | } 71 | 72 | # vim:set ts=2 sw=2 et: 73 | -------------------------------------------------------------------------------- /ipython-notebook/cjk_tplx/cjk.tplx: -------------------------------------------------------------------------------- 1 | % Default to the notebook output style 2 | ((* if not cell_style is defined *)) 3 | ((* set cell_style = 'style_ipython.tplx' *)) 4 | ((* endif *)) 5 | % Inherit from the specified cell style. 6 | ((* extends cell_style *)) 7 | 8 | %=============================================================================== 9 | % xeCJK xeLatex 10 | %=============================================================================== 11 | 12 | ((* block packages *)) 13 | ((( super() ))) 14 | \usepackage[boldfont,slantfont,CJKchecksingle]{xeCJK} % SUPPORT for CJK 15 | \usepackage{indentfirst} % 首段缩进 16 | %\setlength{\parindent}{0pt} 17 | ((* endblock packages *)) 18 | ((* block definitions *)) 19 | % Fonts 20 | \punctstyle{quanjiao} 21 | \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} 22 | \setCJKmainfont[BoldFont=SimHei,ItalicFont=KaiTi]{SimSun} 23 | \setCJKsansfont[Mapping=tex-text]{KaiTi} 24 | \setCJKmonofont{WenQuanYi Micro Hei Mono} 25 | \setmainfont{Times New Roman} % 衬线 26 | \setmonofont{Monaco} % 等宽 27 | \setsansfont{DejaVu Sans} % 无衬线 28 | ((( super() ))) 29 | ((* endblock definitions *)) 30 | ((* block title *)) 31 | \title{((( resources.metadata.name | escape_latex )))} 32 | ((* endblock title *)) 33 | ((* block author *)) 34 | \author{Shengming Lee, IFTS} 35 | ((* endblock author *)) 36 | ((* block margins *)) 37 | \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} 38 | ((* endblock margins *)) 39 | ((* block predoc *)) 40 | ((( super() ))) 41 | \tableofcontents 42 | \newpage 43 | ((* endblock predoc *)) 44 | ((* block bibliography *)) 45 | \bibliographystyle{unsrt} 46 | \bibliography{ipython} 47 | ((* endblock bibliography *)) 48 | -------------------------------------------------------------------------------- /ipython-notebook/cjk_tplx/cjkart.tplx: -------------------------------------------------------------------------------- 1 | ((= IPython CJK Article =)) 2 | 3 | ((*- extends 'cjk.tplx' -*)) 4 | 5 | %=============================================================================== 6 | % Latex Article 7 | %=============================================================================== 8 | 9 | ((* block docclass *)) 10 | \documentclass[12pt,a4paper]{article} 11 | ((* endblock docclass *)) 12 | -------------------------------------------------------------------------------- /ipython-notebook/cjk_tplx/cjkrep.tplx: -------------------------------------------------------------------------------- 1 | ((= IPython CJK Report =)) 2 | 3 | ((*- extends 'cjk.tplx' -*)) 4 | 5 | %=============================================================================== 6 | % Latex Report 7 | %=============================================================================== 8 | 9 | ((* block docclass *)) 10 | \documentclass[12pt,a4paper]{report} 11 | ((* endblock docclass *)) 12 | -------------------------------------------------------------------------------- /ipython-notebook/nb2pdf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/sh 2 | usage() { 3 | cat <&1 >/dev/null; then 15 | if [ "$1" == '-clean' ]; then 16 | rm -v *.pdf *.toc *.tex *.out *.log *.aux 17 | rm -rv *_files 18 | exit 0 19 | fi 20 | if [ "$1" == '-rep' ]; then 21 | TPLX='cjkrep' 22 | _out='Report' 23 | fi 24 | shift 25 | fi 26 | 27 | if [ ${#@} == 0 ]; then 28 | usage 29 | exit 0 30 | fi 31 | 32 | ##BEGIN 33 | for _f in $@; do 34 | if [ -f "$_f" ];then 35 | echo 36 | echo "==> Converting '$_f' to '$_out' ..." 37 | ipython nbconvert --to pdf --PDFExporter.latex_command="['xelatex', '{filename}']" --LatexExporter.template_file="$TPLX" --LatexExporter.template_path="['cjk_tplx/']" "$_f" 38 | else 39 | echo "==> No file '$_f'!" 40 | fi 41 | done 42 | -------------------------------------------------------------------------------- /linuxqq/app_launcher-index-lite.js: -------------------------------------------------------------------------------- 1 | const liteloader_dir = require("path").join( 2 | '/opt/QQ/resources/app', 3 | // or user's XDG_CONFIG_HOME 4 | //require("os").homedir(), '.config', 5 | 'LiteLoaderQQNT' 6 | ); 7 | if (require("fs").existsSync(liteloader_dir)) { 8 | console.log('Use LiteLoaderQQNT in %s', liteloader_dir); 9 | if (process.env.LITELOADERQQNT_PROFILE) { 10 | console.log('Use LITELOADERQQNT_PROFILE in %s', process.env.LITELOADERQQNT_PROFILE); 11 | } else { 12 | console.warn('!!!!! LITELOADERQQNT_PROFILE not set!'); 13 | } 14 | require(liteloader_dir); 15 | } else { 16 | // default QQ 17 | require(require("path").join(process.resourcesPath, "app/app_launcher/index.js")); 18 | setTimeout(() => { 19 | // qqnt.buildVersion >= 28060 20 | global.launcher.installPathPkgJson.main = "./application/app_launcher/index.js"; 21 | }, 0); 22 | } 23 | -------------------------------------------------------------------------------- /linuxqq/linuxqq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -d ~/.config/QQ/versions ]; then 4 | find ~/.config/QQ/versions -name sharp-lib -type d -exec rm -r {} \; 2>/dev/null 5 | fi 6 | 7 | rm -rf ~/.config/QQ/crash_files/* 8 | 9 | XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config} 10 | 11 | if [[ -f "${XDG_CONFIG_HOME}/qq-flags.conf" ]]; then 12 | mapfile -t QQ_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/qq-flags.conf")" 13 | echo "User flags:" ${QQ_USER_FLAGS[@]} 14 | fi 15 | 16 | # set default LITELOADERQQNT_PROFILE for LiteLoaderQQNT data plugins 17 | LITELOADERQQNT_PROFILE=${LITELOADERQQNT_PROFILE:-~/.config/LiteLoaderQQNT} 18 | export LITELOADERQQNT_PROFILE 19 | 20 | exec /opt/QQ/qq ${QQ_USER_FLAGS[@]} "$@" 21 | -------------------------------------------------------------------------------- /m3u8-xmap-download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | url="${1}" 4 | out="${2:-./output.mp4}" 5 | 6 | if [ -z "$url" ]; then 7 | echo "usage: $0 " 8 | else 9 | wget -c "$url" 10 | index=$(basename "$url") 11 | xmap=$(sed -n '/#EXT-X-MAP:URI=/p' "$index" | sed 's|.*URI="\(.*\)"|\1|') 12 | dir=$(dirname "$url") 13 | names=($(sed '/^#/d' "$index")) 14 | echo "index: $index" 15 | echo "xmap: $xmap" 16 | echo "dir: $dir" 17 | echo "names(${#names[@]}): ${names[@]}" 18 | echo -e "\nStart ...\n" 19 | wget -c "$dir/$xmap" 20 | for seg in ${names[@]}; do 21 | wget -c "$dir/$seg" 22 | done 23 | cat $xmap ${names[@]} > $out 24 | fi 25 | -------------------------------------------------------------------------------- /make_A_mess.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # touch file, write file, create directory, delete directory ... , do all I can do where I have the permission. 3 | 4 | usage() { 5 | cat < Nothing?! Kidding me? I will make the '/' as target! " 17 | elif [ x"$1" == x"-L" -o x"$1" == x"--log" ]; then 18 | echo "!? => I promise all will be LOGGED!" 19 | echo "!? => Trust ME! GOOD LUCK for U! ^_^" 20 | else 21 | echo "!? => Thanks for your test! " 22 | fi 23 | -------------------------------------------------------------------------------- /mediawiki/get-mediawiki: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git mediawiki 3 | #git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions.git 4 | #cd extensions 5 | #git submodule update --init --recursive 6 | git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Math.git 7 | -------------------------------------------------------------------------------- /mediawiki/get-wiki-dumps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | URL=http://download.wikipedia.com 4 | # specieswiki enwiki zhwiki enwiktionary enwikivoyage enwikinews enwikiversity zhwikibooks zhwikiquote 5 | # See more: http://download.wikipedia.com/backup-index.html 6 | DUMPS=('enwikibooks' 'enwikiquote' 'zhwikisource' 'enwikisource' 'specieswiki' 'zhwiki') 7 | # Current revisions only, no talk or user pages. 8 | # See more: http://en.wikipedia.org/wiki/Wikipedia:Database_download 9 | SUFFIX=('pages-articles.xml.bz2') 10 | Files=() 11 | Urls=() 12 | Sizes=() 13 | ask() { 14 | read -n1 -t10 -p " -> $1 [y/n]" ans 15 | if [ x$ans != xy -a x$ans != x ]; then 16 | echo " SKIP." 17 | return 1 18 | else 19 | echo 20 | fi 21 | } 22 | 23 | echo "ALL files will be downloaded to the current directory." 24 | [[ -d info ]] || mkdir info 25 | [[ -d files ]] || mkdir files 26 | echo "==> Collecting Information ..." 27 | >info/md5sums.txt 28 | >files/No.pages-articles 29 | for dump in ${DUMPS[@]}; do 30 | echo " -> About $dump ..." 31 | curl -LfGs $URL/$dump/latest/$dump-latest-md5sums.txt >tmp-md5s.txt 32 | ver=$(sed -n '1s/.* //p' tmp-md5s.txt|cut -d- -f2) 33 | curl -LfGs $URL/$dump/$ver/ >tmp-info.html 34 | for suf in ${SUFFIX[@]}; do 35 | line=$(sed -n "/$suf$/p" tmp-md5s.txt) 36 | file=$(echo $line|sed 's/.*\ //') 37 | md5=$(echo $line|sed 's/\ .*//') 38 | size=$(cat tmp-info.html|grep $file | sed 's/.*<\/a> //;s/<.*//') 39 | if [ $suf == "pages-articles.xml.bz2" ];then 40 | # for pages-articles, get numbers of pages 41 | pagenumber=$(cat tmp-info.html|grep "Articles"|sed 's/.*ID.*) //;s/ pages.*//') 42 | echo "$dump-$ver $pagenumber $size" >>files/No.pages-articles 43 | fi 44 | echo "File: $file, version $ver, size $size" 45 | echo "$md5 $file" >>info/md5sums.txt 46 | Files+=($file) 47 | Urls+=($dump/$ver) 48 | Sizes+=("$size") 49 | done 50 | mv tmp-md5s.txt info/$dump-$ver-md5sums.txt 51 | mv tmp-info.html info/$dump-$ver-info.html 52 | done 53 | echo "==> Files to be downloaded:" 54 | i=0 55 | while [ $i -lt ${#Files[@]} ];do 56 | echo " -> $(expr $i + 1)) ${Files[$i]}, ${Sizes[$i]};" 57 | ((i++)) 58 | done 59 | if ! ask "Continue?";then 60 | exit 1 61 | fi 62 | echo "==> Downloading Files ..." 63 | i=0 64 | >files/md5sums.txt 65 | while [ $i -lt ${#Files[@]} ];do 66 | echo " -> ($(expr $i + 1)/${#Files[@]}) ${Files[$i]} ..." 67 | if ask "Continue?";then 68 | axel -a -n 2 $URL/${Urls[$i]}/${Files[$i]} -o files/${Files[$i]} 69 | sed -n "/${Files[$i]}/p" info/md5sums.txt >>files/md5sums.txt 70 | fi 71 | ((i++)) 72 | done 73 | echo "==> Checking Files ..." 74 | cd files 75 | if [ -s md5sums.txt ];then 76 | if md5sum --quiet -c md5sums.txt;then 77 | echo " -> All is OK." 78 | else 79 | echo " -> Some files are broken!" 80 | fi 81 | fi 82 | echo "==> DONE." 83 | exit 0 84 | -------------------------------------------------------------------------------- /mediawiki/import-wikidb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JarFile=mwdumper-1.16.jar 4 | 5 | # SQL 6 | USER=mysql user 7 | Host=localhost 8 | DB=your mysql db 9 | PassWD=your passwd 10 | str="-u $USER -h$Host -p$PassWD $DB" 11 | 12 | # $@ = all xml.bz2 Files, sort by your self 13 | Files=() 14 | for file in $@; do 15 | if [ -f $file ];then 16 | Files+=($file) 17 | else 18 | echo "!!! File: $file not found." 19 | fi 20 | done 21 | echo "==> 0) TODO: ${#Files[@]} files." 22 | i=0 23 | for file in ${Files[@]}; do 24 | ((i++)) 25 | echo " -> $i) $file;" 26 | done 27 | echo "==> 1) 防止主键重复 (duplicate entry), 导入表字段字符集改为binary (page,revision,text)" 28 | read -n1 -p " -> Continue? [y/n]" ans 29 | if [ x$ans != xy ];then 30 | echo " SKIP." 31 | else 32 | echo 33 | mysql $str -v -e 'ALTER TABLE page DEFAULT CHARACTER SET BINARY;' ||echo "ERROR" 34 | mysql $str -v -e 'ALTER TABLE revision DEFAULT CHARACTER SET BINARY;' ||echo "ERROR" 35 | mysql $str -v -e 'ALTER TABLE text DEFAULT CHARACTER SET BINARY;' ||echo "ERROR" 36 | fi 37 | echo "==> 2) Delete from page,revision,text tables of database ${DB}." 38 | read -n1 -p " -> Continue? [y/n]" ans 39 | if [ x$ans != xy ];then 40 | echo " SKIP." 41 | else 42 | echo 43 | mysql $str -v -e 'delete from page;' ||echo "ERROR" 44 | mysql $str -v -e 'delete from revision;' ||echo "ERROR" 45 | mysql $str -v -e 'delete from text;' ||echo "ERROR" 46 | fi 47 | echo "==> 3) import ${#Files[@]} xml files." 48 | i=0 49 | for file in ${Files[@]}; do 50 | ((i++)) 51 | echo " -> ($i/${#Files[@]}) File: $file ..." 52 | read -n1 -p " -> Continue? [y/n]" ans 53 | if [ x$ans == xy ]; then 54 | echo 55 | java -jar $JarFile --format=sql:1.5 $file |mysql $str 56 | else 57 | echo " SKIP." 58 | fi 59 | done 60 | exit 0 61 | -------------------------------------------------------------------------------- /mediawiki/mwdumper-1.16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/mediawiki/mwdumper-1.16.jar -------------------------------------------------------------------------------- /meiriyiwen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2022 shmilee 5 | 6 | import os 7 | import time 8 | import datetime 9 | import requests 10 | import contextlib 11 | import json 12 | 13 | URL = 'https://interface.meiriyiwen.com/article/day?dev=1&date=' 14 | 15 | 16 | def get_day_data(date): 17 | ''' 18 | Get data by date: 20110308 -> 20200909 19 | ''' 20 | url = URL+str(date) 21 | try: 22 | with contextlib.closing(requests.get(url)) as rp: 23 | if rp.status_code == 404: 24 | print('\033[31m[Download %s 404 Not Found]\033[0m' % url) 25 | return 40404 26 | elif rp.status_code == 200: 27 | return json.loads(rp.text)['data'] 28 | except Exception as err: 29 | print('\033[31m[Download %s Error]\033[0m' % url, err) 30 | 31 | 32 | def dates(start, stop): 33 | '''date str generator, from start=(2011,3,18) to stop=(2020,9,9)''' 34 | start = datetime.date(*start) 35 | stop = datetime.date(*stop) 36 | delta = datetime.timedelta(days=1) 37 | while start <= stop: 38 | yield start.strftime(r'%Y%m%d') 39 | start = start + delta 40 | 41 | 42 | def main(output, start=(2011, 3, 8), stop=(2020, 9, 9), dt=3): 43 | ''' 44 | Get all data, save them to output. 45 | ''' 46 | old_results = {} 47 | if os.path.exists(output): 48 | try: 49 | with open(output, 'r', encoding='utf8') as out: 50 | old_results = json.load(out) 51 | except Exception: 52 | pass 53 | old_L = len(old_results) 54 | print("[Info] Read %d results from '%s'." % (old_L, output)) 55 | results = {} 56 | for day in dates(start, stop): 57 | try: 58 | if day not in old_results: 59 | data = get_day_data(day) 60 | if data: 61 | print("[Info] Get data of day: %s" % day) 62 | results[day] = data 63 | time.sleep(dt) 64 | elif type(old_results[day]) != dict: 65 | print(day, ':', old_results[day]) 66 | except KeyboardInterrupt: 67 | ask = input("\n[Interrupt] Stop downloading?") 68 | if ask in ('y', 'Y'): 69 | break 70 | if results: 71 | results.update(old_results) 72 | with open(output, 'w', encoding='utf8') as out: 73 | print() 74 | print("[Info] Save %d results to %s ..." % (len(results), output)) 75 | json.dump(results, out, ensure_ascii=False) 76 | 77 | 78 | if __name__ == '__main__': 79 | main('./meiriyiwen-all.json', dt=2) 80 | -------------------------------------------------------------------------------- /merge_pdf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | # Purpose: Merge pdf file downloaded from Wanfang dissertation database 5 | # (http://g.wanfangdata.com.cn/) 6 | # Author: Xiao Hanyu(xiaohanyu1988@gmail.com) 7 | # Depends: 8 | # pdftk: merge multiple pdf files, pdftk is also a useful pdf 9 | # manipulation tools 10 | # ps2pdf/pdftops: pdf --> ps then ps --> pdf to remove encryption 11 | ################################################################################ 12 | 13 | function usage 14 | { 15 | cat << EOF 16 | `basename $0`: A utility to merge encryted pdf files into one single pdf 17 | 18 | Usage: `basename $0` [Options] 19 | Example: 20 | `basename $0` -f "file1.pdf file2.pdf" -o merged.pdf 21 | `basename $0` -d input_pdf_dir -o merged.pdf 22 | `basename $0` -d input_pdf_dir 23 | Options: 24 | -f: set the input pdf file list 25 | -d: set the input pdf directory 26 | -o: set the output pdf filename 27 | -h: show this help 28 | EOF 29 | } 30 | 31 | function merge_pdfs 32 | { 33 | echo "######## Convert begin!! ########" 34 | for pdf in $pdf_list 35 | do 36 | ## do not use pdf_name = `basename $pdf .pdf` 37 | ## since basename will remove the directory prefix of $pdf 38 | pdf_name=`echo $pdf | sed -e "s/\.pdf//"` 39 | 40 | ## add some animation ^_^ 41 | echo -n "$pdf_name.pdf ---->> $pdf_name.ps " 42 | pdftops $pdf_name.pdf $pdf_name.ps 43 | 44 | echo "---->> $pdf_name.pdf" 45 | ps2pdf $pdf_name.ps $pdf_name.pdf 46 | rm -rf $pdf_name.ps 47 | done 48 | echo "######## Convert end!! ########" 49 | 50 | echo "######## Merge begin!! ########" 51 | pdftk $pdf_list cat output $pdf_merge 52 | echo "######## Merge success, open $pdf_merge to see the result. Bye!! ########" 53 | } 54 | 55 | while getopts "d:f:o:h" arg 56 | do 57 | case $arg in 58 | d) 59 | pdf_dir=$OPTARG 60 | pdf_list=`ls $pdf_dir/*pdf` 61 | ;; 62 | f) 63 | pdf_list=$OPTARG 64 | ;; 65 | o) 66 | pdf_merge=$OPTARG 67 | ;; 68 | h) 69 | usage 70 | exit 0 71 | ;; 72 | ?) 73 | echo "!!Wrong command options" 74 | usage 75 | exit 1 76 | ;; 77 | esac 78 | done 79 | 80 | # if pdf_dir is not set yet, then it's set to default(that is, current directory) 81 | pdf_dir=${pdf_dir:-"."} 82 | 83 | # set default output pdf filename, plus $pdf_dir prefix 84 | pdf_merge="${pdf_dir}/${pdf_merge:-"single_merged_pdf.pdf"}" 85 | merge_pdfs -------------------------------------------------------------------------------- /mpv/mpv-url-debug.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=mpv-url-handler-debug 4 | GenericName=Multimedia player 5 | Comment=Play URL Scheme mpv:// for website videos and songs with mpv & yt-dlp (Debug) 6 | Exec=mpv --log-file=/tmp/mpv-url.log -- %U 7 | Icon=mpv 8 | MimeType=x-scheme-handler/mpv-debug; 9 | # xdg-mime default mpv-url-debug.desktop x-scheme-handler/mpv-debug [multiple x-scheme-handler/mpv??] 10 | # remove from file ~/.config/mimeapps.list 11 | Categories=AudioVideo;Audio;Video;Player;TV; 12 | Terminal=true 13 | NoDisplay=true 14 | -------------------------------------------------------------------------------- /mpv/mpv-url.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=mpv-url-handler 4 | GenericName=Multimedia player 5 | Comment=Play URL Scheme mpv:// for website videos and songs with mpv & yt-dlp 6 | Exec=mpv -- %U 7 | Icon=mpv 8 | MimeType=x-scheme-handler/mpv; 9 | # xdg-mime default mpv-url.desktop x-scheme-handler/mpv 10 | Categories=AudioVideo;Audio;Video;Player;TV; 11 | Terminal=false 12 | NoDisplay=true 13 | -------------------------------------------------------------------------------- /mpv/mpv.conf: -------------------------------------------------------------------------------- 1 | volume=150 2 | volume-max=500 3 | sub-auto=fuzzy 4 | #no-ytdl # broken mpv-handler 5 | hwdec=auto-safe 6 | hwdec-codecs=all 7 | #referrer="https://www.bilibili.com/" 8 | user-agent="Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0" 9 | -------------------------------------------------------------------------------- /mpv/readme.md: -------------------------------------------------------------------------------- 1 | split mpv scripts files & history to a new git repo 2 | 3 | * https://github.com/shmilee/config-mpv 4 | 5 | * [partial-git-clone-with-relevant-history](https://stackoverflow.com/questions/28357056/) 6 | 7 | ```bash 8 | repo=~/project/scripts 9 | subdir=mpv 10 | 11 | mkdir -v /tmp/split-repo-test/ 12 | cd /tmp/split-repo-test/ 13 | 14 | git clone $repo copy-tmp-repo 15 | cd /tmp/split-repo-test/copy-tmp-repo/ 16 | git subtree split -P $subdir -b split-$subdir 17 | git branch | grep split- 18 | 19 | git init --bare ../repo-split-$subdir 20 | git push ../repo-split-$subdir split-$subdir:master 21 | 22 | cd /tmp/split-repo-test/repo-split-$subdir/ 23 | git log 24 | 25 | newrepo=~/project/config-mpv 26 | git clone /tmp/split-repo-test/repo-split-$subdir/ $newrepo 27 | ``` 28 | -------------------------------------------------------------------------------- /mpv/script-opts/mpv_url_scheme.conf: -------------------------------------------------------------------------------- 1 | # The default config file for mpv_url_scheme 2 | 3 | # enable mpv_url_scheme hook or not, 4 | enable=yes 5 | 6 | # type of mp.add_hook(type,priority,fn) 7 | # https://mpv.io/manual/master/#lua-scripting-mp-add-hook(type,-priority,-fn) 8 | hook_type=on_load 9 | 10 | # priority of mp.add_hook(type,priority,fn) 11 | # <10, run before ytdl_hook/on_load (priority=10) 12 | hook_priority=8 13 | 14 | # labels of registered protocols, like 'play-base64|url-opts|play-msix' 15 | # Each protocol label must be seperated by a '|' character. 16 | # Do not leave spaces around the | unless they are part of the label string 17 | # 18 | # 1. play-base64: (https://github.com/akiirui/mpv-handler) 19 | # mpv://play/safe-base64-encoded-URL/?param1=value1¶m2=value2 20 | # Parameters (Optional): cookies, profile, quality, v_codec, subfile 21 | # 22 | # 2. url-opts: (https://github.com/LuckyPuppy514/Play-With-MPV) 23 | # mpv:// 24 | # mpv://"${videoUrl}" --audio-file="${audioUrl}" \ 25 | # --sub-file="${subtitleUrl}" \ 26 | # --force-media-title="${title}" --start=${startTime} \ 27 | # --http-header-fields="referer: ${referer}" \ 28 | # --http-header-fields="origin: ${origin}" \ 29 | # --http-proxy=${proxy} --ytdl-raw-options=proxy=[${proxy}] ${other} 30 | # 31 | # 3. play-msix: (https://github.com/SilverEzhik/mpv-msix) 32 | # mpv://play?file=https%3A%2F%2Fyoutu.be%2FXCs7FacjHQY&file= 33 | # 34 | # 4. open-iina: like iina protocol (https://github.com/Baldomo/open-in-mpv) 35 | # mpv:///open?url=https%3A%2F%2Fxxx.com%2F&pip=1&flags=--profile%3Dxxx' 36 | # Parameters: url, full_screen, pip, flags(--profile recommended) 37 | # 38 | # 5. open-m3u8: 39 | # mpv://https://url.com/path/to/video.m3u8 40 | # 41 | protocols=play-base64|url-opts|play-msix|open-iina|open-m3u8 42 | 43 | # directories for searching cookies file, seperated by a ';' character 44 | # Paths starting with the prefix '~' '~~' can be recognized, 45 | # like, '~~home/' for mpv config dir (~/.config/mpv/). 46 | # seealso: 47 | # https://mpv.io/manual/master/#paths 48 | # https://greasyfork.org/zh-CN/scripts/416271-play-with-mpv 49 | # 50 | cookies_path=~~home/cookies/;~/.config/mpv-handler/cookies/ 51 | 52 | # prefixing http(s) URLs with 'ytdl://' forces it to be processed by 53 | # the script youtube-dl. This is used for protocol labels: play-base64, 54 | # play-msix and open-iina. 55 | # VS: ytdl_hook-try_ytdl_first=yes 56 | ytdl_prefix=yes 57 | -------------------------------------------------------------------------------- /mpv/script-opts/test_show_options.conf: -------------------------------------------------------------------------------- 1 | # The default test config file for show-options 2 | 3 | # ' not needed 4 | API_path='https://www.api.com/v99999/' 5 | 6 | # attempt this API if the default fails 7 | #fallback_API_path= 8 | 9 | # none key, overwrite o.API_key in .lua script 10 | API_key= 11 | 12 | # add a blacklist for error messages to not print to the OSD 13 | # each statement must be seperated by a '|' character. Do not leave 14 | # spaces around the | unless they are part of the blacklisted string 15 | # can be either the command prefix, a.k.a "ffmpeg" 16 | # or the error text, but not both. 17 | # Error text is all of the text after the "[prefix] " part of the message 18 | blacklist=ba|bb|bc|qwert 19 | 20 | # yes/no 21 | warnings=yes 22 | 23 | # number of seconds to show the OSD messages 24 | timeout=33 25 | -------------------------------------------------------------------------------- /mpv/scripts/test_show_options.lua: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------- 2 | -- 3 | -- test mpv script options 4 | -- 5 | -- Copyright (c) 2024 shmilee 6 | -- Licensed under GNU General Public License v2: 7 | -- https://opensource.org/licenses/GPL-2.0 8 | -- 9 | -- Ref: 10 | -- 1. https://github.com/CogentRedTester/mpv-scripts/blob/master/show-errors.lua 11 | -- 2. https://github.com/CogentRedTester/mpv-scripts/blob/master/youtube-search.lua 12 | --------------------------------------------------------------------------- 13 | 14 | local msg = require "mp.msg" 15 | local opts = require "mp.options" 16 | 17 | local o = { 18 | --the default url to send API calls to 19 | API_path = "https://www.googleapis.com/youtube/v3/", 20 | 21 | --attempt this API if the default fails 22 | fallback_API_path = "https://fall.api.com/", 23 | 24 | API_key = "wrong key", 25 | --add a blacklist for error messages to not print to the OSD 26 | blacklist = "", -- no table support 27 | 28 | --also show warning messages on the OSD 29 | warnings = false, 30 | 31 | --number of seconds to show the OSD messages 32 | timeout = 4 33 | } 34 | 35 | opts.read_options(o, 'test_show_options') 36 | 37 | msg.warn('-> API_path is [[' .. o.API_path .. ']]') 38 | msg.warn('-> fallback_API_path is [[' .. o.fallback_API_path .. ']]') 39 | msg.warn('-> API_key is [[' .. o.API_key .. ']]') 40 | 41 | --splits the string into a table on the semicolons 42 | local blacklist = {} 43 | for str in string.gmatch(o.blacklist, "([^|]+)") do 44 | msg.warn('-> adding [[' .. str .. ']] to blacklist') 45 | blacklist[str] = true 46 | end 47 | 48 | msg.warn('-> warnings = [[' .. tostring(o.warnings) .. ']]') 49 | msg.warn('-> timeout == [[' .. tostring(o.timeout) .. ']]') 50 | -------------------------------------------------------------------------------- /myapp.sh/allstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | PACKAGES=(git::https://www.kernel.org/pub/software/scm/git/git-2.3.1.tar.xz \ 4 | tig::http://jonas.nitro.dk/tig/releases/tig-2.1.1.tar.gz \ 5 | zsh::http://www.zsh.org/pub/old/zsh-5.0.7.tar.bz2 \ 6 | lapack::http://www.netlib.org/lapack/lapack-3.5.0.tgz \ 7 | petsc::http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.5.3.tar.gz) 8 | 9 | usage() { echo "Usage: $0 [gettar|install]"; } 10 | 11 | get_tar_file() { 12 | name=$1 13 | url=$2 14 | wget -c $url 15 | if [ $name == git ]; then 16 | xz -d $(basename $url) 17 | fi 18 | if [ $name == zsh ]; then 19 | tar czf oh-my-zsh.tar.gz -C /usr/share/ oh-my-zsh/ 20 | git clone --depth=1 https://github.com/shmilee/oh-my-zsh-custom.git 21 | fi 22 | } 23 | 24 | install_package() { 25 | script_cmd=$1.sh 26 | if [ -f $script_cmd ]; then 27 | bash ./$script_cmd e && echo "$script_cmd e OK" >> ./install.log 28 | bash ./$script_cmd b && echo "$script_cmd b OK" >> ./install.log 29 | bash ./$script_cmd i && echo "$script_cmd i OK" >> ./install.log 30 | else 31 | echo "!!!!! NO $script_cmd !!!!!" 32 | return 1 33 | fi 34 | if [ $script_cmd == zsh.sh ]; then 35 | bash ./$script_cmd o && echo "zsh.sh o OK" >> ./install.log 36 | cd oh-my-zsh-custom 37 | make && make install && echo "oh-my-zsh-custom OK" >> ../install.log 38 | cd .. 39 | fi 40 | } 41 | 42 | if [[ -n "$1" ]];then 43 | if [ $1 == gettar -o $1 == g ]; then 44 | for pkg in ${PACKAGES[@]}; do 45 | get_tar_file ${pkg%%::*} ${pkg##*::} 46 | done 47 | elif [ $1 == install -o $1 == i ]; then 48 | echo "BEGIN." > install.log 49 | for pkg in ${PACKAGES[@]}; do 50 | install_package ${pkg%%::*} 51 | done 52 | ./stripmyapp.sh >> ./install.log 53 | echo "END." >> ./install.log 54 | else 55 | usage 56 | fi 57 | else 58 | usage 59 | fi 60 | -------------------------------------------------------------------------------- /myapp.sh/gc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## gc 4 | ## https://github.com/ivmai/bdwgc/releases/download/v${Ver}/gc-${Ver}.tar.gz 5 | ## add_stack_bottom_feature.patch::https://github.com/ivmai/bdwgc/commit/5668de71107022a316ee967162bc16c10754b9ce.patch 6 | ## depends=('gcc-libs') 7 | 8 | Ver=8.0.4 9 | file=./gc-${Ver}.tar.gz 10 | 11 | MYAPP=$HOME/myapp ## /usr 12 | 13 | if [[ -n "$1" ]];then 14 | if [ $1 == extract -o $1 == e ]; then 15 | tar xvf ${file} 16 | elif [ $1 == build -o $1 == b ]; then 17 | cd gc-${Ver}/ 18 | patch -p1 < ../add_stack_bottom_feature.patch 19 | ./configure --prefix=$MYAPP --enable-cplusplus --disable-static \ 20 | || exit 1 21 | sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool 22 | make || exit 2 23 | elif [ $1 == install -o $1 == i ]; then 24 | cd gc-${Ver}/ 25 | make install || exit 4 26 | else 27 | echo "Usage: $0 [extract|build|install]" 28 | fi 29 | else 30 | echo "Usage: $0 [extract|build|install]" 31 | fi 32 | -------------------------------------------------------------------------------- /myapp.sh/git.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## git 4 | ## https://www.kernel.org/pub/software/scm/git/git-$Ver.tar.xz 5 | ## depends=('curl' 'expat>=2.0' 'perl-error' 'perl>=5.14.0' 'openssl' 'pcre') 6 | ## makedepends=('python2' 'libgnome-keyring' 'xmlto' 'asciidoc') 7 | 8 | Ver=2.3.1 9 | file=./git-${Ver}.tar 10 | 11 | MYAPP=$HOME/myapp ## /usr 12 | CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe --param=ssp-buffer-size=4" 13 | LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro" 14 | 15 | export PYTHON_PATH='/usr/bin/python2' 16 | 17 | if [[ -n "$1" ]];then 18 | if [ $1 == extract -o $1 == e ]; then 19 | tar xvf ${file} 20 | elif [ $1 == build -o $1 == b ]; then 21 | cd git-${Ver}/ 22 | make prefix=$MYAPP gitexecdir=$MYAPP/lib/git-core \ 23 | CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \ 24 | USE_LIBPCRE=1 \ 25 | NO_CROSS_DIRECTORY_HARDLINKS=1 \ 26 | MAN_BOLD_LITERAL=1 \ 27 | all || exit 1 28 | make -C contrib/credential/gnome-keyring || exit 2 29 | make -C contrib/subtree prefix=$MYAPP gitexecdir=$MYAPP/lib/git-core all ||exit 3 30 | elif [ $1 == install -o $1 == i ]; then 31 | cd git-${Ver}/ 32 | make prefix=$MYAPP gitexecdir=$MYAPP/lib/git-core \ 33 | CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \ 34 | USE_LIBPCRE=1 \ 35 | NO_CROSS_DIRECTORY_HARDLINKS=1 \ 36 | MAN_BOLD_LITERAL=1 \ 37 | INSTALLDIRS=vendor install || exit 4 38 | # fancy git prompt 39 | install -Dm644 ./contrib/completion/git-prompt.sh $MYAPP/share/git/git-prompt.sh 40 | # gnome credentials helper 41 | install -m755 contrib/credential/gnome-keyring/git-credential-gnome-keyring \ 42 | $MYAPP/lib/git-core/git-credential-gnome-keyring 43 | make -C contrib/credential/gnome-keyring clean 44 | # subtree installation 45 | make -C contrib/subtree prefix=$MYAPP gitexecdir=$MYAPP/lib/git-core install 46 | # the rest of the contrib stuff 47 | cp -a ./contrib/* $MYAPP/share/git/ 48 | # scripts are for python 2.x 49 | sed -i 's|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|' \ 50 | $(find "$MYAPP" -name '*.py') \ 51 | $MYAPP/share/git/gitview/gitview \ 52 | $MYAPP/share/git/remote-helpers/git-remote-bzr \ 53 | $MYAPP/share/git/remote-helpers/git-remote-hg 54 | sed -i 's|#![ ]*/usr/bin/python$|#!/usr/bin/python2|' \ 55 | $MYAPP/share/git/svn-fe/svnrdump_sim.py 56 | 57 | # remove perllocal.pod, .packlist, and empty directories. 58 | rm -rf $MYAPP/lib/perl5 59 | 60 | else 61 | echo "Usage: $0 [extract|build|install]" 62 | fi 63 | else 64 | echo "Usage: $0 [extract|build|install]" 65 | fi 66 | -------------------------------------------------------------------------------- /myapp.sh/lapack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## lapack 4 | ## http://www.netlib.org/lapack/lapack-$Ver.tgz 5 | ## makedepends=('gcc-fortran' 'cmake') 6 | ## depends=('gcc-libs') 7 | 8 | Ver=3.5.0 9 | file=./lapack-$Ver.tgz 10 | 11 | MYAPP=$HOME/myapp ## /usr 12 | 13 | if [[ -n "$1" ]];then 14 | if [ $1 == extract -o $1 == e ]; then 15 | tar zxvf ${file} 16 | elif [ $1 == build -o $1 == b ]; then 17 | cd lapack-${Ver}/ 18 | cmake . \ 19 | -DCMAKE_BUILD_TYPE=Release \ 20 | -DCMAKE_SKIP_RPATH=ON \ 21 | -DBUILD_SHARED_LIBS=ON \ 22 | -DCMAKE_INSTALL_PREFIX=$MYAPP \ 23 | -DCMAKE_Fortran_COMPILER=ifort \ 24 | -DLAPACKE=ON || exit 1 25 | make || exit 2 26 | elif [ $1 == install -o $1 == i ]; then 27 | cd lapack-${Ver}/ 28 | #for libname in liblapack libtmglib liblapacke libblas; do 29 | # install -m755 "lib/${libname}.so" "$MYAPP/lib/" 30 | # ln -sf ${libname}.so "$MYAPP/lib/${libname}.so.${pkgver}" 31 | # ln -sf ${libname}.so "$MYAPP/lib/${libname}.so.3" 32 | #done 33 | #install -m755 bin/* "$MYAPP/bin" 34 | #install -m644 include/* "$MYAPP/include" 35 | make install || exit 3 36 | else 37 | echo "Usage: $0 [extract|build|install]" 38 | fi 39 | else 40 | echo "Usage: $0 [extract|build|install]" 41 | fi 42 | -------------------------------------------------------------------------------- /myapp.sh/libsixel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## libsixel 4 | ## https://github.com/saitoha/libsixel/releases/download/v1.8.6/libsixel-1.8.6.tar.gz 5 | ## depends=('curl' 'libjpeg-turbo' 'libpng') 6 | 7 | Ver=1.8.6 8 | file=./libsixel-${Ver}.tar.gz 9 | 10 | MYAPP=$HOME/myapp ## /usr 11 | 12 | if [[ -n "$1" ]];then 13 | if [ $1 == extract -o $1 == e ]; then 14 | tar xvf ${file} 15 | elif [ $1 == build -o $1 == b ]; then 16 | cd sixel-${Ver}/ 17 | ./configure --prefix=$MYAPP || exit 1 18 | make || exit 2 19 | elif [ $1 == install -o $1 == i ]; then 20 | cd sixel-${Ver}/ 21 | make install || exit 4 22 | else 23 | echo "Usage: $0 [extract|build|install]" 24 | fi 25 | else 26 | echo "Usage: $0 [extract|build|install]" 27 | fi 28 | -------------------------------------------------------------------------------- /myapp.sh/luaprompt.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## lua, argparse, luaprompt 4 | ## https://github.com/dpapavas/luaprompt 5 | ## depends=("lua" "lua-argparse") 6 | sources=( 7 | "https://github.com/dpapavas/luaprompt/archive/v0.7.tar.gz" 8 | "https://www.lua.org/ftp/lua-5.3.6.tar.gz" 9 | "https://raw.githubusercontent.com/luarocks/argparse/0.7.1/src/argparse.lua" 10 | ) 11 | 12 | pkgver=0.7 13 | file=./luaprompt-$pkgver.tar.gz 14 | luafile=./lua-5.3.6.tar.gz 15 | luaver=5.3.6 16 | argparse=./argparse-0.7.1.lua 17 | 18 | ## skip TH3 flags: MYCFLAGS=" " MYLDFLAGS=" " bash luaprompt.sh b 19 | readline_path='/vol7/software/readline/8.0-gcc4.9.3' 20 | MYCFLAGS=${MYCFLAGS:-"-I${readline_path}/include"} 21 | MYLDFLAGS=${MYLDFLAGS:-"-L${readline_path}/lib -lncurses"} 22 | 23 | MYAPP=${MYAPP:-"$HOME/.local"} ## /usr 24 | 25 | if [[ -n "$1" ]];then 26 | if [ $1 == download -o $1 == d ]; then 27 | wget -c ${sources[0]} -O ${file} 28 | wget -c ${sources[1]} -O ${luafile} 29 | wget -c ${sources[2]} -O ${argparse} 30 | elif [ $1 == extract -o $1 == e ]; then 31 | tar zxvf ${file} 32 | tar zxvf ${luafile} 33 | elif [ $1 == build -o $1 == b ]; then 34 | cd lua-$luaver/ 35 | sed -i "s|\(LUA_ROOT.*\)/usr/local/|\1$MYAPP/|" src/luaconf.h 36 | make INSTALL_TOP=$MYAPP linux MYCFLAGS="${MYCFLAGS}" MYLDFLAGS="${MYLDFLAGS}" || exit 91 37 | make INSTALL_TOP=$MYAPP install || exit 92 38 | cd ../ 39 | install -Dm644 ${argparse} $MYAPP/share/lua/5.3/argparse.lua 40 | cd luaprompt-$pkgver/ 41 | make PREFIX=$MYAPP LUA_CFLAGS="-I$MYAPP/include ${MYCFLAGS}" LUA_LDFLAGS="${MYLDFLAGS}" || exit 1 42 | elif [ $1 == install -o $1 == i ]; then 43 | cd luaprompt-$pkgver/ 44 | make PREFIX=$MYAPP install || exit 2 45 | else 46 | echo "Usage: $0 [download|extract|build|install]" 47 | fi 48 | else 49 | echo "Usage: $0 [download|extract|build|install]" 50 | fi 51 | -------------------------------------------------------------------------------- /myapp.sh/petsc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## petsc 4 | ## http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${Ver}.tar.gz 5 | ## depends=('python2' 'openmpi' 'boost' 'lapack') 6 | ## ignore boost, use lapack of ${lapack_dir} 7 | 8 | Ver=3.5.3 9 | file=./petsc-${Ver}.tar.gz 10 | 11 | MYAPP=$HOME/myapp ## /usr 12 | 13 | lapack_dir=$MYAPP 14 | mpi_intel=/usr/local/mpi.intel 15 | _mpis=('openmpi1.6.4') ##'mvapi2_1.8') ##'mpich2_1.5') 16 | 17 | W_DIR=$(pwd) 18 | if [[ -n "$1" ]];then 19 | if [ $1 == extract -o $1 == e ]; then 20 | tar zxvf ${file} 21 | elif [ $1 == build -o $1 == b ]; then 22 | cd petsc-${Ver}/ 23 | for i_mpi in ${_mpis[@]}; do 24 | i_arch=linux-$(echo $i_mpi | sed 's/.\..\..//g;s/_.\..//g')-intel 25 | echo "==> PETSC_ARCH=${i_arch}" 26 | ./configure --prefix=$MYAPP/petsc-${Ver}/${i_arch} \ 27 | --PETSC_ARCH=${i_arch} \ 28 | --with-blas-lapack-dir=${lapack_dir} \ 29 | --with-mpi-dir=${mpi_intel}/${i_mpi} || exit 1 30 | make PETSC_DIR=${W_DIR}/petsc-${Ver} PETSC_ARCH=${i_arch} all || exit 2 31 | echo "==> Done." 32 | done 33 | elif [ $1 == install -o $1 == i ]; then 34 | cd petsc-${Ver}/ 35 | for i_mpi in ${_mpis[@]}; do 36 | i_arch=linux-$(echo $i_mpi | sed 's/.\..\..//g;s/_.\..//g')-intel 37 | echo "==> PETSC_ARCH=${i_arch}" 38 | make PETSC_DIR=${W_DIR}/petsc-${Ver} PETSC_ARCH=${i_arch} install ||exit 3 39 | echo "==> Done." 40 | done 41 | else 42 | echo "Usage: $0 [extract|build|install]" 43 | fi 44 | else 45 | echo "Usage: $0 [extract|build|install]" 46 | fi 47 | -------------------------------------------------------------------------------- /myapp.sh/ranger.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## ranger 4 | ## Simple, vim-like file manager 5 | ## https://ranger.github.io/ranger-${Ver}.tar.gz 6 | ## depends=('python') 7 | ## optdepends=( 8 | ## 'atool: for previews of archives' 9 | ## 'elinks: for previews of html pages' 10 | ## 'ffmpegthumbnailer: for video previews' 11 | ## 'highlight: for syntax highlighting of code' 12 | ## 'libcaca: for ASCII-art image previews' 13 | ## 'lynx: for previews of html pages' 14 | ## 'mediainfo: for viewing information about media files' 15 | ## 'odt2txt: for OpenDocument texts' 16 | ## 'perl-image-exiftool: for viewing information about media files' 17 | ## 'poppler: for pdf previews' 18 | ## 'python-chardet: in case of encoding detection problems' 19 | ## 'sudo: to use the "run as root"-feature' 20 | ## 'transmission-cli: for viewing bittorrent information' 21 | ## 'w3m: for previews of images and html pages') 22 | 23 | Ver=1.9.3 24 | file=./ranger-${Ver}.tar.gz 25 | 26 | MYAPP=$HOME/myapp ## /usr 27 | 28 | if [[ -n "$1" ]];then 29 | if [ $1 == extract -o $1 == e ]; then 30 | tar xvf ${file} 31 | elif [ $1 == build -o $1 == b ]; then 32 | cd ranger-${Ver}/ 33 | python setup.py build || exit 1 34 | elif [ $1 == install -o $1 == i ]; then 35 | cd ranger-${Ver}/ 36 | python setup.py install --user --optimize=1 || exit 2 37 | else 38 | echo "Usage: $0 [extract|build|install]" 39 | fi 40 | else 41 | echo "Usage: $0 [extract|build|install]" 42 | fi 43 | -------------------------------------------------------------------------------- /myapp.sh/stripmyapp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | MYAPP="$HOME/myapp" 4 | 5 | #-- Options to be used when stripping binaries. See `man strip' for details. 6 | STRIP_BINARIES="--strip-all" 7 | #-- Options to be used when stripping shared libraries. See `man strip' for details. 8 | STRIP_SHARED="--strip-unneeded" 9 | #-- Options to be used when stripping static libraries. See `man strip' for details. 10 | STRIP_STATIC="--strip-debug" 11 | 12 | find "$MYAPP" -type f -perm -u+w -print0 2>/dev/null | while read -rd '' binary ; do 13 | echo "$binary ::" 14 | case "$(file -bi "$binary")" in 15 | *application/x-sharedlib*) # Libraries (.so) 16 | strip_flags="$STRIP_SHARED";; 17 | *application/x-archive*) # Libraries (.a) 18 | strip_flags="$STRIP_STATIC";; 19 | *application/x-executable*) # Binaries 20 | strip_flags="$STRIP_BINARIES";; 21 | *) 22 | continue ;; 23 | esac 24 | strip "$binary" ${strip_flags} 25 | done 26 | -------------------------------------------------------------------------------- /myapp.sh/tig.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## tig 4 | ## http://jonas.nitro.dk/tig/releases/tig-$Ver.tar.gz 5 | ## depends=('git' 'ncurses') 6 | ## makedepends=('asciidoc' 'xmlto') 7 | 8 | Ver=2.1.1 9 | file=./tig-${Ver}.tar.gz 10 | 11 | MYAPP=$HOME/myapp ## /usr 12 | 13 | if [[ -n "$1" ]];then 14 | if [ $1 == extract -o $1 == e ]; then 15 | tar zxvf ${file} 16 | elif [ $1 == build -o $1 == b ]; then 17 | cd tig-${Ver}/ 18 | ./configure --prefix=$MYAPP --sysconfdir=$MYAPP/etc || exit 1 19 | make || exit 2 20 | elif [ $1 == install -o $1 == i ]; then 21 | cd tig-${Ver}/ 22 | make install || exit 3 23 | else 24 | echo "Usage: $0 [extract|build|install]" 25 | fi 26 | else 27 | echo "Usage: $0 [extract|build|install]" 28 | fi 29 | -------------------------------------------------------------------------------- /myapp.sh/zsh.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## zsh 4 | ## http://www.zsh.org/pub/old/zsh-${Ver}.tar.bz2 5 | ## depends=('pcre' 'libcap' 'gdbm') 6 | 7 | Ver=5.0.7 8 | file=./zsh-${Ver}.tar.bz2 9 | file2=./oh-my-zsh.tar.gz 10 | 11 | MYAPP=$HOME/myapp ## /usr 12 | 13 | if [[ -n "$1" ]];then 14 | if [ $1 == extract -o $1 == e ]; then 15 | tar jxvf ${file} 16 | elif [ $1 == build -o $1 == b ]; then 17 | cd zsh-${Ver}/ 18 | # Remove unneeded and conflicting completion scripts 19 | for _fpath in AIX BSD Cygwin Darwin Debian Mandriva openSUSE Solaris; do 20 | rm -rf Completion/$_fpath 21 | sed "s#\s*Completion/$_fpath/\*/\*##g" -i Src/Zle/complete.mdd 22 | done 23 | rm -f Completion/Linux/Command/_{pkgtool,rpmbuild,yast} 24 | rm -f Completion/Unix/Command/_{osc,systemd} 25 | 26 | ./configure --prefix=$MYAPP \ 27 | --docdir=$MYAPP/share/doc/zsh \ 28 | --htmldir=$MYAPP/share/doc/zsh/html \ 29 | --enable-maildir-support \ 30 | --with-term-lib='ncursesw' \ 31 | --enable-multibyte \ 32 | --enable-function-subdirs \ 33 | --enable-fndir=$MYAPP/share/zsh/functions \ 34 | --enable-scriptdir=$MYAPP/share/zsh/scripts \ 35 | --with-tcsetpgrp \ 36 | --enable-pcre \ 37 | --enable-cap \ 38 | --enable-zsh-secure-free || exit 1 39 | make || exit 2 40 | elif [ $1 == install -o $1 == i ]; then 41 | cd zsh-${Ver}/ 42 | make install ||exit 3 43 | elif [ $1 == o ]; then 44 | echo "Install oh-my-zsh" 45 | tar -zxvf $file2 -C $MYAPP/share/ 46 | echo "Done." 47 | else 48 | echo "Usage: $0 [extract|build|install|o]" 49 | fi 50 | else 51 | echo "Usage: $0 [extract|build|install|o]" 52 | fi 53 | -------------------------------------------------------------------------------- /nanorc/fortran.nanorc: -------------------------------------------------------------------------------- 1 | ## Here is an example for Fortran 90/95 2 | 3 | syntax "fortran" "\.(f|f90|f95|F90|F95)$" 4 | 5 | #color red "\<[A-Z_]a[0-9A-Z_]+\>" 6 | color red "\<[0-9]+\>" 7 | 8 | icolor green "\<(action|advance|all|allocatable|allocated|any|apostrophe)\>" 9 | icolor green "\<(append|asis|assign|assignment|associated|character|common)\>" 10 | icolor green "\<(complex|data|default|delim|dimension|double precision)\>" 11 | icolor green "\<(elemental|epsilon|external|file|fmt|form|format|huge)\>" 12 | icolor green "\<(implicit|include|index|inquire|integer|intent|interface)\>" 13 | icolor green "\<(intrinsic|iostat|kind|logical|module|none|null|only)>" 14 | icolor green "\<(operator|optional|pack|parameter|pointer|position|private)\>" 15 | icolor green "\<(program|public|real|recl|recursive|selected_int_kind)\>" 16 | icolor green "\<(selected_real_kind|subroutine|status)\>" 17 | 18 | icolor cyan "\<(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\>" 19 | icolor cyan "\<(close|contains|count|cpu_time|cshift|date_and_time)\>" 20 | icolor cyan "\<(deallocate|digits|dot_product|eor|eoshift|function|iachar)\>" 21 | icolor cyan "\<(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\>" 22 | icolor cyan "\<(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\>" 23 | icolor cyan "\<(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\>" 24 | icolor cyan "\<(open|pad|present|print|product|pure|quote|radix)\>" 25 | icolor cyan "\<(random_number|random_seed|range|read|readwrite|replace)\>" 26 | icolor cyan "\<(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\>" 27 | icolor cyan "\<(spread|sum|system_clock|target|transfer|transpose|trim)\>" 28 | icolor cyan "\<(ubound|unpack|verify|write|tiny|type|use|yes)\>" 29 | 30 | icolor yellow "\<(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\>" 31 | icolor yellow "\<(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\>" 32 | icolor yellow "\<(.or.|repeat|select case|then|where|while)\>" 33 | 34 | icolor magenta "\<(continue|cycle|exit|go?to|result|return)\>" 35 | 36 | ## String highlighting. 37 | icolor yellow "<[^= ]*>" ""(\\.|[^"])*"" 38 | 39 | ## Comment highlighting 40 | icolor blue "!.*" 41 | 42 | -------------------------------------------------------------------------------- /nanorc/nanorc: -------------------------------------------------------------------------------- 1 | ## C/C++ 2 | include "/usr/share/nano/c.nanorc" 3 | 4 | ## HTML 5 | include "/usr/share/nano/html.nanorc" 6 | 7 | ## Patch files 8 | include "/usr/share/nano/patch.nanorc" 9 | 10 | ## Manpages 11 | include "/usr/share/nano/man.nanorc" 12 | 13 | ## Groff 14 | include "/usr/share/nano/groff.nanorc" 15 | 16 | ## Perl 17 | include "/usr/share/nano/perl.nanorc" 18 | 19 | ## Python 20 | include "/usr/share/nano/python.nanorc" 21 | 22 | ## Ruby 23 | include "/usr/share/nano/ruby.nanorc" 24 | 25 | ## TeX 26 | include "/usr/share/nano/tex.nanorc" 27 | 28 | ## Bourne shell scripts 29 | include "/usr/share/nano/sh.nanorc" 30 | 31 | ## Fortran 32 | include "/public/home/users/smli/upload/nanorc/fortran.nanorc" 33 | -------------------------------------------------------------------------------- /netinfocap/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 shmilee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /netinfocap/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE README.rst 2 | #recursive-exclude tests * 3 | -------------------------------------------------------------------------------- /netinfocap/README.rst: -------------------------------------------------------------------------------- 1 | Intro 2 | ===== 3 | 4 | Collect net packets from the network interface, 5 | then choose infor from each packet and save them to json. 6 | -------------------------------------------------------------------------------- /netinfocap/netinfocap/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright (c) 2021-2022 shmilee 4 | 5 | from .infocapture import InfoCapture 6 | from .__main__ import main 7 | from .convert_json import json2html 8 | -------------------------------------------------------------------------------- /netinfocap/netinfocap/extractor/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright (c) 2021 shmilee 4 | 5 | from .extractor import Extractor 6 | all_extractors = ['bilive', 'hls', 'rtmpt'] 7 | 8 | 9 | def _get_valid_kws(kwargs, keys): 10 | kws = {k: kwargs[k] for k in keys if k in kwargs} 11 | return kws 12 | 13 | 14 | def get_extractor(name, **kwargs): 15 | if name == 'bilive': 16 | from .bilive import Bilive_Url_Extractor 17 | kws = _get_valid_kws(kwargs, ('player', 'ffmpeg')) 18 | return Bilive_Url_Extractor(**kws) 19 | elif name == 'hls': 20 | from .hls import HLS_Url_Extractor 21 | kws = _get_valid_kws(kwargs, ('player', 'ffmpeg')) 22 | return HLS_Url_Extractor(**kws) 23 | elif name == 'rtmpt': 24 | from .rtmpt import RTMPT_Url_Extractor 25 | kws = _get_valid_kws(kwargs, ('player', 'ffmpeg')) 26 | return RTMPT_Url_Extractor(**kws) 27 | else: 28 | print('[Error] invalid extractor name!') 29 | -------------------------------------------------------------------------------- /netinfocap/netinfocap/extractor/bilive.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright (c) 2021 shmilee 4 | 5 | import re 6 | from .extractor import Streaming_Extractor 7 | 8 | 9 | class Bilive_Url_Extractor(Streaming_Extractor): 10 | '''Get Bilibili live(HTTP-FLV) URI from Packet.''' 11 | display_filter = 'http.request.method==GET' 12 | 13 | def __init__(self, player=None, ffmpeg=None): 14 | field_keys = ('fullurl',) 15 | workers = ('get_http_live',) 16 | super(Bilive_Url_Extractor, self).__init__( 17 | field_keys=field_keys, workers=workers, 18 | player=player, ffmpeg=ffmpeg) 19 | 20 | def __match_uri(self, request_uri): 21 | uri = request_uri.split('?')[0] 22 | if re.match('^/live-bvc/.*flv$', uri): 23 | return True 24 | elif re.match('^/live/.*flv$', uri): 25 | return True 26 | else: 27 | return False 28 | 29 | def __get_id(self, request_full_uri): 30 | for pat in ( 31 | '.*/live-bvc/(.*)/live_([_\d]+)\.flv\?.*', 32 | '.*/live/flv\?.*stream=(\d+)_.*', 33 | '.*/live/(.*)\.flv.*', 34 | ): 35 | m = re.match(pat, request_full_uri) 36 | if m: 37 | return '-'.join(m.groups()) 38 | return '/'.join(request_full_uri.split('?')[0].split('/')[-2:]) 39 | 40 | def get_http_live(self, packet): 41 | '''Get fullurl from packet''' 42 | try: 43 | if self.__match_uri(packet.http.request_uri): 44 | fulluri = packet.http.request_full_uri 45 | self.result['id'] = self.__get_id(fulluri) 46 | self.result['fullurl'] = fulluri 47 | except Exception: 48 | pass 49 | -------------------------------------------------------------------------------- /netinfocap/netinfocap/extractor/rtmpt.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright (c) 2021 shmilee 4 | 5 | import os 6 | import re 7 | 8 | from .extractor import Streaming_Extractor 9 | 10 | 11 | class RTMPT_Url_Extractor(Streaming_Extractor): 12 | '''Get RTMPT connect/play url from Packet.''' 13 | display_filter = 'rtmpt' 14 | 15 | def __init__(self, player=None, ffmpeg=None): 16 | field_keys = ('connect', 'play', 'fullurl') 17 | workers = ('get_rtmpt_connect', 'get_rtmpt_play') 18 | super(RTMPT_Url_Extractor, self).__init__( 19 | field_keys=field_keys, workers=workers, 20 | player=player, ffmpeg=ffmpeg) 21 | 22 | def get_rtmpt_connect(self, packet): 23 | ''' TCP/RTMPT Packet -> Layer RTMPT -> amf_string 'connect' ''' 24 | try: 25 | if packet.rtmpt.amf_string == 'connect': 26 | alt = packet.rtmpt.amf_string.alternate_fields 27 | for i in range(len(alt)): 28 | if alt[i].get_default_value() == 'tcUrl': 29 | self.result['connect'] = alt[i+1].get_default_value() 30 | self.join_connect_play() 31 | break 32 | except Exception: 33 | pass 34 | 35 | def get_rtmpt_play(self, packet): 36 | ''' TCP/RTMPT Packet -> Layer RTMPT -> amf_string 'play' ''' 37 | try: 38 | for l in packet.layers: 39 | if l.layer_name == 'rtmpt' and 'amf_string' in l.field_names: 40 | if l.amf_string == 'play': 41 | alt = l.amf_string.alternate_fields 42 | self.result['play'] = alt[0].get_default_value() 43 | play = self.result['play'].split('?')[0] 44 | self.result['id'] = play.split('_')[0] 45 | self.join_connect_play() 46 | break 47 | except Exception: 48 | pass 49 | 50 | def join_connect_play(self): 51 | '''join connect/play -> fullurl''' 52 | if 'connect' in self.result and 'play' in self.result: 53 | fullurl = '/'.join((self.result['connect'], self.result['play'])) 54 | if (re.match('rtmp.*live/s.*wsSecret=.*wsTime=.*sign.*', fullurl) 55 | and len(fullurl) > 250): 56 | fullurl = fullurl.split(' ')[0] + os.linesep 57 | self.result['fullurl'] = fullurl 58 | -------------------------------------------------------------------------------- /netinfocap/netinfocap/vcsi/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2019 amietn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /netinfocap/netinfocap/vcsi/__init__.py: -------------------------------------------------------------------------------- 1 | from . import vcsi 2 | 3 | 4 | def main(argv=None): 5 | vcsi.main(argv=None) 6 | -------------------------------------------------------------------------------- /netinfocap/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | python-tag = py3 3 | -------------------------------------------------------------------------------- /netinfocap/setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright (c) 2020 shmilee 4 | 5 | import os 6 | from setuptools import setup, find_packages 7 | 8 | here = os.path.abspath(os.path.dirname(__file__)) 9 | with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f: 10 | long_description = '\n' + f.read() 11 | 12 | setup( 13 | name='netinfocap', 14 | version='0.9.6', 15 | description='Netinfo Capture', 16 | long_description=long_description, 17 | long_description_content_type='text/x-rst', 18 | author='shmilee', 19 | url='https://github.com/shmilee/scripts/netinfocap', 20 | license='MIT', 21 | keywords='Netinfo, pyshark', 22 | package_dir={'netinfocap': 'netinfocap'}, 23 | packages=find_packages(where=here), 24 | platforms=[ 25 | 'Linux', 26 | ], 27 | classifiers=[ 28 | 'Development Status :: 4 - Beta', 29 | 'Environment :: Console', 30 | 'Intended Audience :: Other Audience', 31 | 'License :: OSI Approved :: MIT License', 32 | 'Operating System :: POSIX :: Linux', 33 | 'Programming Language :: Python', 34 | 'Programming Language :: Python :: 3.9', 35 | 'Programming Language :: Python :: 3.10', 36 | 'Programming Language :: Python :: 3.11', 37 | 'Topic :: Internet', 38 | 'Topic :: Multimedia :: Video' 39 | ], 40 | install_requires=[ 41 | 'pyshark>=0.4.0', 42 | 'py>=1.11.0', 43 | 'requests>=2.0.0', 44 | ] + [ 45 | # video-thumbnails, 46 | # for sub package vcsi from 'https://github.com/amietn/vcsi' 47 | 'numpy>=1.24.3', 48 | 'pillow>=10.0.0', 49 | 'jinja2>=3.1.2', 50 | 'texttable>=1.6.7', 51 | 'parsedatetime>=2.6', 52 | ], 53 | extras_require={}, 54 | package_data={}, 55 | data_files=[], 56 | entry_points={ 57 | 'console_scripts': [ 58 | 'netinfocap = netinfocap.__main__:main', 59 | 'netinfocap-json2html = netinfocap.convert_json:main', 60 | 'netinfocap-vcsi = netinfocap.vcsi:main', 61 | ], 62 | }, 63 | ) 64 | -------------------------------------------------------------------------------- /novel123: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #将txt小说分按章节切割,txt要用utf-8编码, 标题格式满足"第{一,三十}集",单独一行,前面可有空格,不能有其他字符 3 | #author:lishengming 4 | #date:20111212 5 | novel="$1" 6 | a=(`grep -E '^\ {0,}第.{1,5}集' $novel -n |cut -d: -f1`) # 每一集的标题所在行数记入数组a 7 | a+=($(expr $(wc -l $novel |cut -d ' ' -f1) + 1)) # 总行数加 1 8 | for (( i = 1;i < ${#a[*]} ;i++ )); do 9 | echo 第$i集从 ${a[i-1]}行 到 `expr ${a[i]} - 1`行. 10 | sed -n "${a[i-1]},`expr ${a[i]} - 1`p" $novel >第$i集.txt #循环,第i集放入i.txt里 11 | done 12 | echo The $novel has been cut into `expr ${#a[@]} - 1` parts. 13 | -------------------------------------------------------------------------------- /obsolete/1015.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() 4 | { 5 | int a,b,k; 6 | while(1) 7 | { 8 | scanf("%d %d %d",&a,&b,&k); 9 | if((a==0)&&(b==0)) 10 | { 11 | return 0; 12 | } 13 | k=pow(10,k); 14 | if((a%k)==(b%k)) 15 | { 16 | printf("-1\n"); 17 | } 18 | else 19 | { 20 | printf("%d\n",a+b); 21 | } 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /obsolete/1015.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | bool is_Prime(int a){ 7 | int i; 8 | if(a==0 || a==1) return false; 9 | for(i=2; i <= sqrt((double)a); i++){ 10 | if( a%i == 0) return false; 11 | } 12 | 13 | return true; 14 | } 15 | 16 | int change(int n,int d){ 17 | int total = 0; 18 | while(n != 0){ 19 | total = total*d + n%d; 20 | n/=d; 21 | } 22 | return total; 23 | } 24 | 25 | int main() 26 | { 27 | int N,D; 28 | while(cin>>N){ 29 | if( N<0 ) break; 30 | cin>>D; 31 | cout<<"R:"< 2 | /*题库[1026] 输入两个不超过整型定义的非负10进制整数A和B(<=2^31-1),输出A+B的m (1 < m <10)进制数。*/ 3 | int main() 4 | { 5 | unsigned int a,b,m,sum; 6 | while(1) 7 | { 8 | short stack[34] = {0},top = 0; 9 | scanf("%d",&m); 10 | if(m == 0) 11 | break; 12 | scanf("%d%d",&a,&b); 13 | sum = a + b; 14 | if(sum == 0) 15 | { 16 | stack[top++] = 0; 17 | } 18 | while(sum != 0) 19 | { 20 | stack[top++] = sum%m; 21 | sum /= m; 22 | } 23 | for(int i = top-1;i >= 0;i--) 24 | printf("%d",stack[i]); 25 | printf("\n"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /obsolete/bdsl.c: -------------------------------------------------------------------------------- 1 | /*读完这个题,我的第一感觉是:这是个dp问题。如果用普通方法做,时间复杂度是O(n^2),会超时。 2 | 后来想了一下,只需要判断是递增或递减就行了,O(n)时间复杂度。 3 | 即:对于当前的点,1、如果要找递增序列:如果下一个点比当前的点大,序列长度加1,更新下一个点为当前点; 4 | 如果下一个点比当前点小,长度不变,同样更新下一个点为当前点,而且有利于找出递增序列 5 | 找递减序列的方法与找递增序列的方法一致。*/ 6 | #include 7 | int a[30003]; 8 | int main() 9 | { 10 | int T,N,i,flag,len,now; 11 | scanf("%d",&T); 12 | while(T--) 13 | { 14 | scanf("%d",&N); 15 | for(i=0;inow) 23 | { 24 | flag=1; 25 | len++; 26 | } 27 | else if(flag&&a[i]/dev/null; then 25 | echo -e "\n==> $SSH_HOST Start.\n" 26 | backup 27 | scp_mod 644 group group- passwd passwd- 28 | scp_mod 000 gshadow gshadow- shadow shadow- 29 | echo -e "\n==> $SSH_HOST Done.\n" 30 | else 31 | echo -e "\n==> $SSH_HOST Skip/lost?!\n" 32 | fi 33 | -------------------------------------------------------------------------------- /obsolete/d2m.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | short m=2; 5 | int n; 6 | scanf("%d",&n); 7 | short stack[34]={0},top=0; 8 | if(n==0){ 9 | stack[top++]=0; 10 | } 11 | while(n!=0){ 12 | stack[top++]=n%m; 13 | n=n/m; 14 | } 15 | while(top!=0){ 16 | top-=1; 17 | printf("%d",stack[top]); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /obsolete/example_link_so/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | int c; 5 | scanf("%d",&c); 6 | printf("%c",test(c)); 7 | return 1; 8 | } 9 | -------------------------------------------------------------------------------- /obsolete/example_link_so/makefile: -------------------------------------------------------------------------------- 1 | all: mstatic mshare 2 | 3 | mstatic: 4 | cc -I ./ -c mod.c 5 | cc -I ./ -o mstatic main.c mod.o 6 | rm mod.o 7 | 8 | mshare: 9 | cc -I ./ -shared -fPIC -o libmod.so mod.c 10 | cc -I ./ -L ./ -lmod -o mshare main.c 11 | 12 | runmshare: 13 | -LD_LIBRARY_PATH=./ ./mshare 14 | 15 | clean: 16 | -rm -f libmod.so mshare mstatic mod.o 17 | -------------------------------------------------------------------------------- /obsolete/example_link_so/mod.c: -------------------------------------------------------------------------------- 1 | #include 2 | char test(int c) { 3 | if (c != 1) { 4 | printf("%d",c); 5 | } else { 6 | printf("asd"); 7 | } 8 | return 'a'; 9 | } 10 | -------------------------------------------------------------------------------- /obsolete/example_link_so/mod.h: -------------------------------------------------------------------------------- 1 | #ifndef _mod_h 2 | #define _mod_h 3 | 4 | #include 5 | 6 | #endif 7 | char test(int c); 8 | -------------------------------------------------------------------------------- /obsolete/ext-1089.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Python3 Program to check the given number for my 1089 trick. 5 | # more like: 6 | # https://arxiv.org/html/2410.11784v2 7 | # https://oeis.org/A008919 8 | 9 | # Max Iterations 10 | MAX_ITERATIONS = 20 11 | 12 | PM_ORDER = ('+', '-') 13 | 14 | def checking(number): 15 | #if (isPalindrome(number)): 16 | # return "No" 17 | sig = '+' 18 | for i in range(1, MAX_ITERATIONS+1): 19 | rev = reverse(number) 20 | if sig == PM_ORDER[0]: 21 | new = number + rev 22 | print(f'i={i}): {number} + {rev} = {new}') 23 | else: 24 | new = number - rev 25 | print(f'i={i}): {number} - {rev} = {new}') 26 | #print(f'i={i}') 27 | #if (isPalindrome(new)): 28 | # return "No" 29 | number = new 30 | sig = '-' if sig == '+' else '+' 31 | return "Maybe" 32 | 33 | # Function to check whether the number is Palindrome 34 | def isPalindrome(number): 35 | return number == reverse(number) 36 | 37 | cache_on, reverse_cache = True, {} 38 | 39 | # Function to reverse the number 40 | def reverse(number): 41 | if cache_on: 42 | if number in reverse_cache: 43 | # print(f'using cache for {number}') 44 | return reverse_cache[number] 45 | reverse = 0 46 | num = -number if number < 0 else number 47 | while (abs(num) > 0): 48 | remainder = num % 10 49 | reverse = (reverse * 10) + remainder 50 | num = num // 10 # int(num / 10) 51 | if number < 0: 52 | reverse = -reverse 53 | if cache_on: 54 | reverse_cache[number] = reverse 55 | reverse_cache[reverse] = number 56 | return reverse 57 | 58 | if __name__ == '__main__': 59 | import sys 60 | if len(sys.argv) >= 3: 61 | n1, n2 = int(sys.argv[1]), int(sys.argv[2]) 62 | for number in range(n1, n2+1): 63 | print('\n'+'='*16) 64 | ans = checking(number) 65 | elif len(sys.argv) >= 2: 66 | number = int(sys.argv[1]) 67 | ans = checking(number) 68 | else: 69 | ans = checking(21078) 70 | -------------------------------------------------------------------------------- /obsolete/k_max.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | 4 | int N,K,i,j,len; 5 | int a[1000]; 6 | scanf("%d %d",&N,&K); 7 | while(N!=0){ 8 | for(i=0;ia[i]) a[0]=a[i]; 22 | } 23 | printf("%d",a[0]); 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /obsolete/lychrel.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Python3 Program to check whether the given number 5 | # is Lychrel Number or not with given limit on number of iterations. 6 | # This code is contributed by mits. 7 | # ref https://www.geeksforgeeks.org/lychrel-number-implementation/ 8 | 9 | # Max Iterations 10 | MAX_ITERATIONS = 1000 11 | 12 | # Function to check whether number is Lychrel Number 13 | def isLychrel(number): 14 | if (isPalindrome(number)): 15 | return "No" 16 | for i in range(1, MAX_ITERATIONS+1): 17 | rev = reverse(number) 18 | new = number + rev 19 | print(f'i={i}): {number} + {rev} = {new}') 20 | #print(f'i={i}') 21 | if (isPalindrome(new)): 22 | return "No" 23 | number = new 24 | return "Maybe" 25 | 26 | # Function to check whether the number is Palindrome 27 | def isPalindrome(number): 28 | return number == reverse(number) 29 | 30 | # %timeit !python ./lychrel.py 196677 # Iterations=10000 31 | # 43s vs 84s => 48.8% 32 | cache_on, reverse_cache = True, {} 33 | 34 | # Function to reverse the number 35 | def reverse(number): 36 | if cache_on: 37 | if number in reverse_cache: 38 | # print(f'using cache for {number}') 39 | return reverse_cache[number] 40 | reverse = 0 41 | num = number 42 | while (num > 0): 43 | remainder = num % 10 44 | reverse = (reverse * 10) + remainder 45 | num = num // 10 # int(num / 10) 46 | if cache_on: 47 | reverse_cache[number] = reverse 48 | reverse_cache[reverse] = number 49 | return reverse 50 | 51 | if __name__ == '__main__': 52 | import sys 53 | if len(sys.argv) >= 3: 54 | n1, n2 = int(sys.argv[1]), int(sys.argv[2]) 55 | for number in range(n1, n2+1): 56 | print('\n'+'='*16) 57 | ans = isLychrel(number) 58 | print(f"==> {number} is lychrel? {ans}") 59 | elif len(sys.argv) >= 2: 60 | number = int(sys.argv[1]) 61 | ans = isLychrel(number) 62 | print(f"==> {number} is lychrel? {ans}") 63 | else: 64 | ans = isLychrel(196) 65 | print(f"==> 196 is lychrel? {ans}") 66 | -------------------------------------------------------------------------------- /obsolete/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #define HI "Hello world!" 7 | 8 | int main(void) { 9 | //开始 10 | printf("Hello "); 11 | printf("World!\n"); 12 | printf("----------------------\n"); 13 | 14 | //整数 15 | short int i=pow(2,8*sizeof(short)-1)-1; 16 | int j=pow(2,8*sizeof(int)-1)-1; 17 | long k=pow(2,8*sizeof(long)-1)-1; 18 | long long kk=pow(2,8*sizeof(long long)-1)-1; 19 | int8_t i8=pow(2,8*sizeof(int8_t)-1)-1; 20 | intmax_t im=pow(2,8*sizeof(intmax_t)-1)-1; 21 | printf("int DT\t\tSize\tMax\t\t\tMin\n"); 22 | printf("short\t\t%u\t%hd\t\t\t%d\n",sizeof(i),i,i+1); 23 | printf("int\t\t%u\t%d\t\t%d\n",sizeof(j),j,j+1); 24 | printf("long\t\t%u\t%ld\t%ld\n",sizeof(k),k,k+1); 25 | printf("long long\t%u\t%lld\t%lld\n",sizeof(kk),kk,kk+1); 26 | printf("int8_t\t\t%u\t%"PRId8"\t\t\t%"PRId8"\n",sizeof(i8),i8,-i8-1); 27 | printf("intmax_t\t%u\t%lld\t%lld\n",sizeof(im),im,im+1); 28 | printf("----------------------\n"); 29 | 30 | /*字符*/ 31 | char c='ABCDE'; 32 | j='ABCDE'; 33 | printf("Set c='ABCDE', then c='%c'\nsizeof('ABCDE')=%d, sizeof(c)=%d\ncode of 'ABCDE' is %d, code of c is %d\n",c,sizeof('ABCDE'),sizeof(c),j,c); 34 | printf("explain the code of 'ABCDE':\n"); 35 | printf("1)%d != %d + %d*2^%d + %d*2^%d + %d*2^%d + %d*2^%d\n",j,'E','D',8*sizeof(c),'C',2*8*sizeof(c),'B',3*8*sizeof(c),'A',4*8*sizeof(c)); 36 | printf("2)%d == %d + %d*2^%d + %d*2^%d + %d*2^%d\n",j,'E','D',8*sizeof(c),'C',2*8*sizeof(c),'B',3*8*sizeof(c)); 37 | printf("----------------------\n"); 38 | 39 | //浮点数 40 | float f=M_PI; 41 | long double lf=M_PI; 42 | printf("size of float is %d\nsize of 3.14 is %d\nsize of 3.14f is %d\nsize of 3.14L is %d\n",sizeof(f),sizeof(3.14),sizeof(3.14f),sizeof(3.14L)); 43 | printf("Set pi=%.22lf, then\n",M_PI); 44 | printf("float pi is %.22f = %.22e = %.22a\n",f,f,f); 45 | printf("long double pi is %.22Lf\n",lf); 46 | f=2.0e20; 47 | float ff=2.0e20 + 1.0; 48 | printf("overflow: 2.0e20 + 1.0 - 2.0e20 = %f\n",ff-f); 49 | printf("----------------------\n"); 50 | 51 | //复数 52 | float _Complex Z=3.145+315*I; 53 | printf("size of _Complex %f+%fi is %d\n",creal(Z),cimag(Z),sizeof(Z)); 54 | printf("----------------------\n"); 55 | 56 | //字符串 57 | printf("%s\n",HI); 58 | char str[20]; 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /obsolete/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | char c; 5 | std::cout << "Mission One : Compare 2 numbers ? (y/n)" << std::endl; 6 | std::cin >> c; 7 | while(c == 'y' || c == 'Y') { 8 | std::cout << "Enter a number: " << std::endl; 9 | double n; 10 | std::cin >> n; 11 | std::cout << "Your first number is " << n << "." << std::endl; 12 | std::cout << "Enter another number: " << std::endl; 13 | double m; 14 | std::cin >> m; 15 | std::cout << "Your second number is " << m << "." << std::endl; 16 | std::cout << "Set n= " << n << ", m= " << m << ". So" << std::endl; 17 | if (n>m) { 18 | std::cout << "n>m." << std::endl; 19 | } else if (n> c; 27 | } 28 | 29 | std::cout << "Mission Two : Sort numbers ? (y/n)" << std::endl; 30 | std::cin >> c; 31 | while(c == 'y' || c == 'Y') { 32 | std::cout << "Enter less than 100 numbers one by one and end with 'E'.\nFor example, 2 3 56 4.6 78 E " << std::endl; 33 | double arr[100]; 34 | std::cout << arr << std::endl; 35 | 36 | c='N'; 37 | } 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /obsolete/num2str.f90: -------------------------------------------------------------------------------- 1 | program num2str 2 | implicit none 3 | 4 | write(*,*) '-i4= '//trim(int2str(-2**30-2**30-1)) 5 | write(*,*) '+i4= '//trim(int2str(2**32)) 6 | write(*,*) '-i8= '//trim(int82str(-2_8**62-2_8**62-1)) 7 | write(*,*) '+i8= '//trim(int82str(2_8**64)) 8 | write(*,*) 9 | write(*,*) '-i4= '//trim(int2str(-2**30-2**30)) 10 | write(*,*) '+i4= '//trim(int2str(2**32-1)) 11 | write(*,*) '-i8= '//trim(int82str(-2_8**62-2_8**62)) 12 | write(*,*) '+i8= '//trim(int82str(2_8**64-1)) 13 | write(*,*) '5r4= '//trim(real2str(5000.123456789)) 14 | write(*,*) 'er4= '//trim(real2str(0.0000000000012345678)) 15 | write(*,*) 'er4= '//trim(real2str(9.999**38.533)) 16 | 17 | contains 18 | 19 | function int2str(i) result(str) 20 | integer, intent(in) :: i 21 | character(len=12) :: str 22 | write(str, '(I12)') i 23 | str = adjustl(str) 24 | end function 25 | 26 | function int82str(i) result(str) 27 | integer(kind=8), intent(in) :: i 28 | character(len=22) :: str 29 | write(str, '(I22)') i 30 | str = adjustl(str) 31 | end function 32 | 33 | function real2str(r) result(str) 34 | real, intent(in) :: r 35 | character(len=20) :: str 36 | if (r<10000 .and. r>0.1) then 37 | write(str, '(F18.7)') r 38 | else 39 | write(str, '(E20.7)') r 40 | endif 41 | str = adjustl(str) 42 | end function 43 | 44 | end program 45 | -------------------------------------------------------------------------------- /obsolete/prime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int N,i,j,step=1,is=1; 6 | printf("Input N: "); 7 | scanf("%d",&N); 8 | 9 | printf("2\n3\n"); 10 | step=2; 11 | for (i=5;i<=N;i+=step) { 12 | for (j=3;j<=sqrt(i);j+=step) { 13 | if (i%j==0){ 14 | is=0; 15 | break; 16 | } 17 | } 18 | if (is){ 19 | printf("%d\n",i); 20 | } 21 | is=1; 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /obsolete/py3.12+logging-queue-handler-bug.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2024 shmilee 5 | 6 | # Related [bug](https://github.com/python/cpython/issues/111615) 7 | # Related [pull](https://github.com/python/cpython/pull/111638) 8 | # Related [codes](https://github.com/python/cpython/blob/3.12/Lib/logging/config.py#L789-L804) 9 | # python 3.12+ 10 | # issue: https://github.com/python/cpython/issues/119819 11 | 12 | import logging.config 13 | import multiprocessing as mp 14 | import asyncio 15 | 16 | 17 | def main(q): 18 | config = { 19 | 'version': 1, 20 | 'handlers': { 21 | 'sink': { 22 | 'class': 'logging.handlers.QueueHandler', 23 | 'queue': q, 24 | }, 25 | }, 26 | 'root': { 27 | 'handlers': ['sink'], 28 | }, 29 | } 30 | logging.config.dictConfig(config) 31 | 32 | 33 | if __name__ == '__main__': 34 | main(mp.Manager().Queue()) 35 | main(asyncio.Queue()) 36 | -------------------------------------------------------------------------------- /obsolete/py3.12+logging-queue-handler-fix.patch: -------------------------------------------------------------------------------- 1 | --- config.py 2024-05-31 10:16:24.905893630 +0800 2 | +++ config.py-fix3.12 2024-05-31 13:18:07.223555882 +0800 3 | @@ -786,8 +786,11 @@ 4 | # raise ValueError('No handlers specified for a QueueHandler') 5 | if 'queue' in config: 6 | from multiprocessing.queues import Queue as MPQueue 7 | + from multiprocessing.managers import BaseProxy as MPBaseProxy 8 | qspec = config['queue'] 9 | - if not isinstance(qspec, (queue.Queue, MPQueue)): 10 | + print('============', isinstance(qspec, MPBaseProxy)) 11 | + print(qspec, type(qspec)) 12 | + if not isinstance(qspec, (queue.Queue, MPQueue, MPBaseProxy)): 13 | if isinstance(qspec, str): 14 | q = self.resolve(qspec) 15 | if not callable(q): 16 | @@ -800,6 +803,7 @@ 17 | else: 18 | raise TypeError('Invalid queue specifier %r' % qspec) 19 | config['queue'] = q 20 | + print('===============') 21 | if 'listener' in config: 22 | lspec = config['listener'] 23 | if isinstance(lspec, type): 24 | -------------------------------------------------------------------------------- /obsolete/py3.12+logging-queue-handler-patch-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2024 shmilee 3 | 4 | TEST_DIR='/tmp/py3.12-logging-queue-fdjsa' 5 | mkdir -v $TEST_DIR 6 | cd $TEST_DIR/ 7 | 8 | wget -c https://github.com/python/cpython/pull/120030.patch 9 | filterdiff --include=a/Lib/logging/config.py ./120030.patch > ./120030-part.patch 10 | 11 | cat > ./test-mp.py < PASS. Manager().Queue()') 33 | #print('-'*20) 34 | #main(mp.Manager().JoinableQueue()) 35 | #print('===> PASS. Manager().JoinableQueue()') 36 | EOF 37 | 38 | echo -e '\n--------before and test--------\n' 39 | python3.12 $TEST_DIR/test-mp.py 40 | 41 | echo -e '\n--------patch and test--------\n' 42 | md5sum /usr/lib/python3.12/logging/*.py 43 | sudo cp -iv /usr/lib/python3.12/logging/config.py /usr/lib/python3.12/logging/config.py-backup 44 | sudo patch -p3 -i $TEST_DIR/120030-part.patch -d /usr/lib/python3.12/logging 45 | diff -Nur /usr/lib/python3.12/logging/config.py-backup /usr/lib/python3.12/logging/config.py 46 | python3.12 $TEST_DIR/test-mp.py 47 | 48 | echo -e '\n--------back--------\n' 49 | sudo mv -iv /usr/lib/python3.12/logging/config.py-backup /usr/lib/python3.12/logging/config.py 50 | sudo rm -iv /usr/lib/python3.12/logging/config.py.orig 51 | md5sum /usr/lib/python3.12/logging/*.py 52 | -------------------------------------------------------------------------------- /obsolete/py3.12+logging-queue-handler.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2024 shmilee 5 | 6 | # Related [bug](https://github.com/python/cpython/issues/111615) 7 | # Related [pull](https://github.com/python/cpython/pull/111638) 8 | # Related [codes](https://github.com/python/cpython/blob/3.12/Lib/logging/config.py#L789-L804) 9 | # python 3.12+ 10 | # issue: https://github.com/python/cpython/issues/119819 11 | 12 | import logging.config 13 | import multiprocessing as mp 14 | import asyncio 15 | 16 | def main(i, qd): 17 | print('%d. qspec dict: ' % i, qd) 18 | config = { 19 | 'version': 1, 20 | 'handlers': { 21 | 'sink': { 22 | 'class': 'logging.handlers.QueueHandler', 23 | 'queue': qd, 24 | }, 25 | }, 26 | 'root': { 27 | 'handlers': ['sink'], 28 | }, 29 | } 30 | logging.config.dictConfig(config) 31 | l = logging.getLogger() 32 | s = l.handlers[0] 33 | print('USE: ', id(s.queue), s.queue, type(s.queue)) 34 | print('------') 35 | 36 | def get_mp_queue(manager=None, maxsize=None): 37 | q = manager.Queue(maxsize) 38 | print('GET: ', id(q), q) 39 | return q 40 | 41 | def get_asy_queue(maxsize=None): 42 | q = asyncio.Queue(maxsize) 43 | print('GET: ', id(q), q) 44 | return q 45 | 46 | if __name__ == '__main__': 47 | m = mp.Manager() 48 | main(1, {'()': get_mp_queue, 'manager': m, 'maxsize': 10}) 49 | main(2, {'()': m.Queue, 'maxsize': 20}) 50 | main(3, {'()': get_asy_queue, 'maxsize': 10}) 51 | -------------------------------------------------------------------------------- /obsolete/ring.c: -------------------------------------------------------------------------------- 1 | // Author: Wes Kendall 2 | // Copyright 2011 www.mpitutorial.com 3 | // This code is provided freely with the tutorials on mpitutorial.com. Feel 4 | // free to modify it for your own use. Any distribution of the code must 5 | // either provide a link to www.mpitutorial.com or keep this header intact. 6 | // 7 | // Example using MPI_Send and MPI_Recv to pass a message around in a ring. 8 | // mpirun --host localhost:8 -np 8 --bind-to :overload-allowed ./a.out 9 | // 10 | #include 11 | #include 12 | #include 13 | 14 | int main(int argc, char** argv) { 15 | // Initialize the MPI environment 16 | MPI_Init(NULL, NULL); 17 | // Find out rank, size 18 | int world_rank; 19 | MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); 20 | int world_size; 21 | MPI_Comm_size(MPI_COMM_WORLD, &world_size); 22 | 23 | int token; 24 | // Receive from the lower process and send to the higher process. Take care 25 | // of the special case when you are the first process to prevent deadlock. 26 | if (world_rank != 0) { 27 | MPI_Recv(&token, 1, MPI_INT, world_rank - 1, 0, MPI_COMM_WORLD, 28 | MPI_STATUS_IGNORE); 29 | printf("Process %d received token %d from process %d\n", world_rank, token, 30 | world_rank - 1); 31 | } else { 32 | // Set the token's value if you are process 0 33 | token = -1; 34 | } 35 | MPI_Send(&token, 1, MPI_INT, (world_rank + 1) % world_size, 0, 36 | MPI_COMM_WORLD); 37 | // Now process 0 can receive from the last process. This makes sure that at 38 | // least one MPI_Send is initialized before all MPI_Recvs (again, to prevent 39 | // deadlock) 40 | if (world_rank == 0) { 41 | MPI_Recv(&token, 1, MPI_INT, world_size - 1, 0, MPI_COMM_WORLD, 42 | MPI_STATUS_IGNORE); 43 | printf("Process %d received token %d from process %d\n", world_rank, token, 44 | world_size - 1); 45 | } 46 | MPI_Finalize(); 47 | } 48 | -------------------------------------------------------------------------------- /obsolete/test-gdpy3-animation.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from gdpy3 import get_visplter 3 | import matplotlib.animation as animation 4 | 5 | plotter = get_visplter("mpl::/test") 6 | plotter.style = ['gdpy3-paper-aip'] 7 | 8 | cos = np.cos 9 | sin = np.sin 10 | pi = np.pi 11 | 12 | 13 | def add_ani(fig, axesdict, artistdict, **fkwargs): 14 | line = artistdict[4][0] 15 | srcx, srcy = artistdict[13][0].get_data() 16 | 17 | def update_line(num): 18 | # line.set_marker('*') 19 | line.set_data(srcx[:num], srcy[:num]) 20 | return line, 21 | L = srcx.size 22 | fig.gdpy3_animation = animation.FuncAnimation( 23 | fig, update_line, np.arange(0, L), interval=100, blit=True) 24 | fig.gdpy3_animation_paused = False 25 | 26 | def toggle_pause(event): 27 | if fig.gdpy3_animation_paused: 28 | fig.gdpy3_animation.resume() 29 | else: 30 | fig.gdpy3_animation.pause() 31 | fig.gdpy3_animation_paused = not fig.gdpy3_animation_paused 32 | fig.canvas.mpl_connect('button_press_event', toggle_pause) 33 | 34 | 35 | x = np.linspace(-8, 8, 1000) 36 | 37 | fig = plotter.create_figure('test', {'layout': [111, dict(xlim=[-8, 8], projection='polar')], 'data': [ 38 | [1, 'plot', (x, 4*np.exp(-x**2/8)), dict()], 39 | [2, 'plot', (x, -4*np.exp(-x**2/8)), dict()], 40 | [-3, 'plot', (x, 2*np.exp(-x**2/16)), dict()], 41 | [4, 'plot', (x[0], 0, 'k'), dict(label='black', lw=1)], 42 | [13, 'plot', (x, 4*cos(2*pi*x)*np.exp(-x**2/8)), dict()], 43 | [-14, 'plot', (x, 2*sin(pi*x)*np.exp(-x**2/16)), dict()], 44 | [33, 'revise', add_ani, {}], 45 | ]}) 46 | 47 | # long time 15min? 48 | # fig.gdpy3_animation.save('a.mp4') 49 | 50 | fig.show() 51 | input('Enter') 52 | -------------------------------------------------------------------------------- /obsolete/test_error_handle.F90: -------------------------------------------------------------------------------- 1 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2 | ! ! 3 | ! module mm for Fortran/error handling 4 | ! https://en.wikibooks.org/wiki/Fortran/error_handling ! 5 | ! ! 6 | ! Copyright (c) 2023 shmilee 7 | ! Licensed under GNU General Public License v3 8 | ! ! 9 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 10 | 11 | module mm 12 | implicit none 13 | contains 14 | 15 | subroutine test_open_file(path) 16 | character(len=*), intent(in) :: path 17 | integer :: my_iostat 18 | character (256) :: my_iomsg 19 | 20 | open(file=trim(path), unit=10, iostat=my_iostat, iomsg=my_iomsg, status='replace') 21 | if (my_iostat/=0) then 22 | write (*,*) 'Open(replace) ', trim(path), ' failed with iostat = ', my_iostat, ' iomsg = '//trim(my_iomsg) 23 | else 24 | write(10,101)1 25 | close(10) 26 | end if 27 | 101 format(i6) 28 | end subroutine 29 | 30 | end module 31 | 32 | program XX 33 | use mm 34 | implicit none 35 | 36 | write(*,*) 'Permission' 37 | call test_open_file('/root/a') 38 | 39 | write(*,*) 'path error' 40 | call test_open_file('/tmp/aaaaaa/b/c') 41 | 42 | write(*,*) 'here ./abcde' 43 | call test_open_file('./abcde') 44 | end program 45 | -------------------------------------------------------------------------------- /obsolete/test_get_command_argument.F90: -------------------------------------------------------------------------------- 1 | program test_get_command_argument 2 | integer :: i 3 | character(len=255) :: arg 4 | character(len=255) :: conf 5 | logical :: ex 6 | 7 | !! https://gcc.gnu.org/onlinedocs/gfortran/GET_005fCOMMAND_005fARGUMENT.html#GET_005fCOMMAND_005fARGUMENT 8 | 9 | i = command_argument_count() 10 | write (*,*) '=> count: ', i 11 | i = 0 12 | do 13 | call get_command_argument(i, arg) 14 | if (len_trim(arg) == 0) exit 15 | 16 | write (*,*) trim(arg) 17 | i = i+1 18 | end do 19 | call get_command(arg) 20 | write (*,*) '=> cmd: ', trim(arg) 21 | i = len(trim(arg)) 22 | write (*,*) '=> len(cmd): ', i 23 | 24 | call get_command_argument(0, arg) 25 | i = len(trim(arg)) 26 | write (*,*) '=> len(arg(0)): ', i 27 | if (command_argument_count() > 0) then 28 | call get_command_argument(1, conf) 29 | conf = trim(arg(1:i-len('a.out')))//trim(conf) 30 | else 31 | conf = trim(arg(1:i-len('a.out')))//'.conf/input' 32 | endif 33 | !! https://software.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/a-to-z-reference/h-to-i/inquire.html#inquire 34 | inquire(file=conf, exist=ex) 35 | if (.not. ex) then 36 | write (*,'(2A/)') '>> Cannot find conf file: ', trim(conf) 37 | else 38 | write (*,'(2A/)') '=> Use conf file: ', trim(conf) 39 | endif 40 | 41 | end program 42 | -------------------------------------------------------------------------------- /obsolete/test_reshape_order.F90: -------------------------------------------------------------------------------- 1 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2 | ! ! 3 | ! fortran-reshape-n-dimensional-transpose 4 | ! https://stackoverflow.com/questions/37442346/ 5 | ! ! 6 | ! Copyright (c) 2023 shmilee 7 | ! Licensed under GNU General Public License v3 8 | ! ! 9 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 10 | 11 | 12 | program test_reshape4d 13 | implicit none 14 | integer :: nf,j,i,k 15 | real, dimension(:,:,:,:), allocatable :: zp3d 16 | 17 | allocate(zp3d(5, 2, 4, 3)) 18 | zp3d(:,:,:,:)=0.0 19 | do nf=1,3 20 | do j=1,4 21 | do i=1,2 22 | do k=1,5 23 | if (nf==1) then 24 | zp3d(k,i,j,nf) = 1.0 25 | else if (nf==2) then 26 | zp3d(k,i,j,nf) = real(i)*sin(real(k*k+j)) 27 | else if (nf==3) then 28 | zp3d(k,i,j,nf) = real(i)*exp(real(k*j)) 29 | end if 30 | end do 31 | end do 32 | end do 33 | end do 34 | 35 | WRITE(*,*) SHAPE(zp3d) 36 | WRITE(*,*) SHAPE(RESHAPE(zp3d, (/5*2*4*3/))) 37 | 38 | WRITE(*,*) 'shape=(5, 2, 4, 3), F order' 39 | ! np.array(list(map(float, out1.split()))).reshape((5, 2, 4, 3),order='F') 40 | WRITE(*,*) RESHAPE(zp3d, (/5*2*4*3/)) 41 | 42 | WRITE(*,*) 'shape=(3, 4, 2, 5).T, like C order' 43 | ! np.array(list(map(float, out2.split()))).reshape((5, 2, 4, 3),order='C') 44 | WRITE(*,*) RESHAPE(zp3d, (/3, 4, 2, 5/), order=[4, 3, 2, 1]) 45 | end program 46 | -------------------------------------------------------------------------------- /obsolete/testmod.lua: -------------------------------------------------------------------------------- 1 | local mod = { 2 | a = 8, 3 | show = function(self, i) 4 | print('show: a=', self.a, 'and i=', i) 5 | end, 6 | } 7 | 8 | function mod.fun1(i) 9 | print(tostring(mod), 'mod fun1: i=', i, 'a=', mod.a) 10 | end 11 | 12 | function mod.fun2(i) 13 | print(tostring(mod), 'mod fun2: i^2=', i^2) 14 | end 15 | 16 | function mod:fun3(i) 17 | print(tostring(self), 'mod fun3: i^3=', i^3) 18 | end 19 | 20 | function mod:fun4(i) 21 | print(tostring(self), 'mod fun4: i^4=', i^4) 22 | end 23 | 24 | function mod.do_all(i) 25 | mod.fun1(i) 26 | mod.fun2(i) 27 | mod:fun3(i) 28 | mod:fun4(i) 29 | end 30 | 31 | mod:show(999) 32 | 33 | return mod 34 | -------------------------------------------------------------------------------- /obsolete/testnewmod.lua: -------------------------------------------------------------------------------- 1 | local mod = dofile('./testmod.lua') 2 | local newmod = setmetatable({}, {__index=mod}) 3 | 4 | function newmod.fun1(i) 5 | print(tostring(mod), 'new mod fun1: i=', i, 'a=', mod.a) 6 | end 7 | 8 | 9 | function newmod:fun4(i) 10 | print(tostring(self), 'new mod fun4: i^4=', i^4, 'a=',self.a) 11 | print(tostring(self), 'new mod call fun1 in fun4:') 12 | self.fun1(i) 13 | print(tostring(self), 'new mod call fun2 in fun4:') 14 | self.fun2(i) 15 | print(tostring(self), 'new mod call fun3 in fun4:') 16 | self:fun3(i) 17 | end 18 | 19 | i=5 20 | print('i=',i) 21 | newmod.do_all(i) 22 | 23 | print('---') 24 | newmod:fun4(i) 25 | 26 | return newmod 27 | -------------------------------------------------------------------------------- /obsolete/testnewmod2.lua: -------------------------------------------------------------------------------- 1 | local mod = dofile('./testmod.lua') 2 | 3 | local old_fun1 = mod.fun1 4 | function mod.fun1(i) 5 | old_fun1(i) 6 | print(tostring(mod), 'new mod fun1: i=', i, 'a=', mod.a) 7 | print(tostring(old_fun1), 'vs', tostring(mod.fun1)) 8 | end 9 | 10 | local old_fun4 =mod.fun4 11 | function mod:fun4(i) 12 | old_fun4(self, i) 13 | print(tostring(self), 'new mod fun4: i^4=', i^4, 'a=',self.a) 14 | print(tostring(old_fun4), 'vs', tostring(mod.fun4)) 15 | end 16 | 17 | i=3 18 | print('i=',i) 19 | mod.do_all(i) 20 | 21 | return mod 22 | -------------------------------------------------------------------------------- /obsolete/x2.m: -------------------------------------------------------------------------------- 1 | close all;clear all; clc; 2 | 3 | x=-5:0.1:5; 4 | 5 | A=-2*ones(1,length(x)); 6 | B=ones(1,length(x)-1); 7 | D=diag(A)+diag(B,1)+diag(B,-1); 8 | V=diag(x.*x); 9 | H=V-2*D; 10 | [PHI,E]=eig(H); 11 | 12 | plot(x,diag(V),'LineWidth',2); 13 | hold on; 14 | plot(x,PHI(:,1)'+10*E(1,1),'r','LineWidth',2) 15 | for i=2:1:7 16 | plot(x,(-1)^i*PHI(:,i)'+10*E(i,i),'r','LineWidth',2) 17 | end 18 | xlabel('x[a.u.]'); 19 | ylabel('E[a.u.]'); 20 | filename=['v-x2-',datestr(now,30),'.png']; 21 | print(gcf,'-dpng',filename); 22 | -------------------------------------------------------------------------------- /obsolete/x2_5cosx_5x.m: -------------------------------------------------------------------------------- 1 | close all;clear all; clc; 2 | 3 | x=-8:0.05:3; 4 | 5 | A=-2*ones(1,length(x)); 6 | B=ones(1,length(x)-1); 7 | D=diag(A)+diag(B,1)+diag(B,-1); 8 | V=diag(x.*x-5*cos(x)+5*x); 9 | H=V-2*D; 10 | [PHI,E]=eig(H); 11 | 12 | plot(x,diag(V),'b','LineWidth',2); 13 | hold on; 14 | plot(x,PHI(:,1)'+1*0.4+E(1,1),'r','LineWidth',2) 15 | for i=2:1:10 16 | plot(x,PHI(:,i)'+i*0.4+E(i,i),'r','LineWidth',2) 17 | end 18 | for i=[35,36] 19 | plot(x,PHI(:,i)'+E(i,i),'g','LineWidth',2) 20 | end 21 | for i=[45,50,55,60,65] 22 | plot(x,PHI(:,i)'+E(i,i),'k','LineWidth',2) 23 | end 24 | xlim([-6,2]); 25 | ylim([-8,3]); 26 | filename=['v-x2_5cosx-',datestr(now,30),'.png']; 27 | print(gcf,'-dpng',filename); 28 | -------------------------------------------------------------------------------- /option/getopt-test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | usage() { 3 | echo --help 4 | } 5 | OPT_SHORT="A:ChR:s:U" 6 | OPT_LONG="add:,check,help,remove:,sign:,update" 7 | if ! OPT_TEMP="$(getopt -q -o $OPT_SHORT -l $OPT_LONG -- "$@")";then 8 | echo;usage;exit 1 9 | fi 10 | eval set -- "$OPT_TEMP" 11 | unset OPT_SHORT OPT_LONG OPT_TEMP 12 | echo all opt is $@ 13 | while true 14 | do 15 | case $1 in 16 | -A|--add) pkg=$2; shift ;; 17 | -C|--check) ck=1 ;; 18 | -R|--remove) pkg=$2; shift ;; 19 | -s|--sign) u=$2; shift ;; 20 | -U|--update) upda=1 ;; 21 | -h|--help) usage ;; 22 | --) echo end ;break ;; 23 | *)echo unknown $1;exit 1;; 24 | esac 25 | shift 26 | done 27 | echo \$pkg is $pkg 28 | echo \$check==$ck; echo \$update=$upda 29 | echo \$user=$u 30 | -------------------------------------------------------------------------------- /option/getopts-test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | while getopts ":f:n:d:" opt; do 4 | case $opt in 5 | d) 6 | day=$OPTARG #get the value 7 | ;; 8 | f) 9 | file=$OPTARG 10 | ;; 11 | n) 12 | name=$OPTARG 13 | ;; 14 | \?) 15 | echo "How to use: $0 [-d DAY] [-f out] [-n name]" >&2 16 | exit 1 17 | ;; 18 | :) 19 | echo "Option -$OPTARG requires an argument." >&2 20 | exit 1 21 | ;; 22 | esac 23 | done 24 | echo day $day 25 | echo file $file 26 | echo name $name 27 | echo \$@ is $@ 28 | echo $OPTIND 29 | shift $((OPTIND-1)) 30 | echo after shift\: 31 | echo \$1 is $1 32 | echo \$@ is $@ 33 | -------------------------------------------------------------------------------- /pandocker/bash.bashrc: -------------------------------------------------------------------------------- 1 | # If not running interactively, don't do anything 2 | #[[ $- != *i* ]] && return 3 | 4 | shopt -s extglob 5 | 6 | # Load profiles from /etc/profile 7 | test -r /etc/profile && . /etc/profile 8 | 9 | [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion 10 | 11 | export PROMPT_COMMAND='PS_result=`RET=$?;[ $RET == 0 ]&&echo -ne "\033[0;32m:) $RET"||echo -ne "\e[0;31m:( $RET"`' 12 | PS1='(\A) \[\e[0;34m\]\u\[\e[0;0m\]@\[\e[0;33m\]\h\[\e[0;0m\] \w $PS_result\[\e[0;0m\]\n\$ ' 13 | 14 | # ls 15 | alias ls='ls -hF --color=auto' 16 | alias lr='ls -r' # recursive ls 17 | alias ll='ls -l' 18 | alias la='ll -A' 19 | alias lz='ll -rS' # sort by size 20 | alias lt='ll -rt' # sort by date 21 | alias lm='la | more' 22 | -------------------------------------------------------------------------------- /pandocker/dockerfile: -------------------------------------------------------------------------------- 1 | # pandoc + citeproc + crossref + pip3 + make + ... 2 | # pandoc-{codeblock-include,include,minted,mustache} + ... 3 | # pandoc-{xnos,latex-extensions,numbering} + ... 4 | # 5 | # docker build --network=host --force-rm --no-cache --rm -t shmilee/pandoc:2.16.2 . 6 | # docker run --rm -i -t -v $PWD:/home/pandoc/work shmilee/pandoc:2.16.2 CMD 7 | # 8 | 9 | FROM pandoc/alpine-crossref:2.16.2 10 | 11 | LABEL maintainer="shmilee " version="1.0" 12 | ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \ 13 | TIMEZONE=Asia/Shanghai \ 14 | TERM=xterm-color \ 15 | PIP_INDEX_URL=https://mirrors.ustc.edu.cn/pypi/web/simple 16 | 17 | RUN VER=`awk -F'[=.]' '/VERSION_ID/{print $2"."$3}' /etc/os-release` \ 18 | && echo https://mirrors.tuna.tsinghua.edu.cn/alpine/v${VER}/main > /etc/apk/repositories \ 19 | && echo https://mirrors.tuna.tsinghua.edu.cn/alpine/v${VER}/community >> /etc/apk/repositories \ 20 | && echo "==> tini py3-pip ..." \ 21 | && apk --no-cache add tini py3-pip bash make tzdata \ 22 | py3-psutil \ 23 | && cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \ 24 | && echo "${TIMEZONE}" > /etc/timezone \ 25 | && pip3 --no-cache-dir install -i ${PIP_INDEX_URL} \ 26 | pandocfilters==1.5.0 \ 27 | panflute==2.1.3 \ 28 | pypandoc==1.6.4 \ 29 | pandoc-codeblock-include==0.1.1 \ 30 | pandoc-include==1.2.0 \ 31 | pandoc-minted==0.2 \ 32 | pandoc-mustache==0.1 \ 33 | pandoc-fignos==2.4.0 \ 34 | pandoc-eqnos==2.5.0 \ 35 | pandoc-tablenos==2.3.0 \ 36 | pandoc-secnos==2.2.2 \ 37 | pandoc-xnos==2.5.0 \ 38 | pandoc-latex-extensions==0.2.2 \ 39 | pandoc-numbering==3.4.0.0 \ 40 | && adduser -u 1000 -D -G users -s /bin/bash pandoc \ 41 | && su pandoc -c "mkdir -p /home/pandoc/work" \ 42 | && echo "==> clean ..." \ 43 | && pip3 freeze > /py3-requirements.txt \ 44 | && find /usr/lib/python3* \ 45 | \( -type d -a -name test -o -name tests \) \ 46 | -exec rm -rf '{}' + ; \ 47 | rm -rf /usr/share/man/ /usr/share/doc/ /root /tmp \ 48 | && install -d -m1777 /tmp \ 49 | && install -d -m0700 /root 50 | 51 | ADD ./bash.bashrc /home/pandoc/.bashrc 52 | WORKDIR /home/pandoc/work 53 | USER pandoc 54 | 55 | ENTRYPOINT ["/sbin/tini", "--"] 56 | CMD ["/usr/local/bin/pandoc"] 57 | -------------------------------------------------------------------------------- /pipe/test-srun-genlog.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2023 shmilee 5 | 6 | import sys 7 | import time 8 | 9 | N = 5 10 | 11 | for i in range(N): 12 | print('#MONITOR-PARAMETER-GTC# {"istep": %d, "ETAh": %d}' %(i, N-i-1)) 13 | print('EMERGENCY-BREAK-EOF:', i) 14 | sys.stdout.flush() 15 | 16 | for j in range(N): 17 | print('writing %d/%d' % (j, N-1)) 18 | if len(sys.argv) > 1 and sys.argv[1] == 'flush': 19 | sys.stdout.flush() 20 | time.sleep(j) 21 | -------------------------------------------------------------------------------- /pipe/test-srun-genlog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2023 shmilee 3 | 4 | # 1. wandb finished, srun still write pipe 5 | # => srun write part data in '.log' 6 | # => BrokenPipeError: [Errno 32] Broken pipe 7 | python test-srun-genlog.py flush \ 8 | | tee /tmp/test-srun-genlog.log \ 9 | | python ~/project/gtc-config/scripts/wandb-joblog.py \ 10 | --dryrun 11 | 12 | # 2. wandb finished, srun still write to buffer first, not pipe 13 | # => srun write data, buffer lost in '.log' 14 | python test-srun-genlog.py \ 15 | | tee /tmp/test-srun-genlog.log \ 16 | | python ~/project/gtc-config/scripts/wandb-joblog.py \ 17 | --dryrun 18 | 19 | # 3. wandb wait srun, untill genlog.py finished 20 | # => ok, all saved in '.log' 21 | # => best 22 | python test-srun-genlog.py flush \ 23 | | tee /tmp/test-srun-genlog.log \ 24 | | python ~/project/gtc-config/scripts/wandb-joblog.py \ 25 | --dryrun --eofstr 'EOF-BY-PIPE' 26 | 27 | # 4. wandb wait srun, untill genlog.py finished and its buffer saved in '.log' 28 | # => ok, all saved in '.log' 29 | python test-srun-genlog.py \ 30 | | tee /tmp/test-srun-genlog.log \ 31 | | python ~/project/gtc-config/scripts/wandb-joblog.py \ 32 | --dryrun --eofstr 'EOF-BY-PIPE' 33 | -------------------------------------------------------------------------------- /random-desktop.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | ##当且仅当第一个参数为正数,脚本成功,默认为0 4 | 5 | $picpath='/usr/share/random-desktop/picture/'; #图片目录 6 | $bgpath='/usr/share/random-desktop/wall/'; #壁纸目录 7 | 8 | chdir $bgpath; 9 | my @bgs = glob "bg*"; 10 | $background=$bgpath.$bgs[int rand(@bgs)]; # 随机壁纸 11 | if($ARGV[1]){$background=$bgpath."bg20.jpg";} 12 | print "$background\n"; 13 | 14 | chdir $picpath; 15 | $num=int $ARGV[0]+rand(3); ##随机取得 $ARGV[0] +2张 png格式,第一个参数,设定最少几张图片 16 | print "$num\n"; 17 | my @files = glob "*.png"; 18 | unlink glob "/tmp/d-*.png"; 19 | 20 | for(1..$num){ 21 | $in=$files[int rand(@files)]; 22 | $out="/tmp/d-$in.png"; 23 | if(grep /$in/,@do){redo;} # 确保不重复使用文件 24 | push @do,$in; 25 | 26 | my $size=int 120+rand(80); # 缩放120-200之间 27 | `convert \"$in\" -scale \"$size>\" \"$out\"`; 28 | 29 | my $mess=int rand(3); # 不同效果处理 ,效果4右侧偶尔有阴影,不采用,效果3,灰色,与人物肖像不搭 30 | if($mess == 0){ 31 | print "mess\t-> $in\n"; 32 | `convert \"$out\" \\( +clone -threshold -1 -virtual-pixel black -spread 30 -blur 0x3 -threshold 40% -spread 2 -blur 10x.7 \\) -compose Copy_Opacity -composite \"$out\"`; 33 | } 34 | if($mess == 1) { 35 | print "frame\t-> $in\n"; 36 | `convert \"$out\" -bordercolor "#C2C2C2" -border 5 -bordercolor "#323232" -border 1 \"$out\"`; 37 | } 38 | if($mass == 2) { 39 | print "raise\t-> $in\n"; 40 | `convert \"$out\" +raise 5x5 -swirl 60 \"$out\"`; 41 | } 42 | if($mess == 3) { 43 | print "edge\t-> $in\n"; 44 | `convert \"$out\" -colorspace Gray -edge 1 -negate -scale 120 \"$out\"`; 45 | } 46 | if($mess == 4) { 47 | print "distort\t-> $in\n"; 48 | `convert \"$out\" -matte -virtual-pixel transparent -distort Perspective '0,0,0,0 0,90,0,90 90,0,90,25 90,90,90,65' \"$out\"`; 49 | } 50 | #更多效果请登录http://www.imagemagick.org/Usage/mapping/ 51 | 52 | `convert \"$out\" -background black \\( +clone -shadow 60x4+4+4 \\) +swap -background none -flatten \"$out\"`; # 阴影 53 | 54 | my $rot=int rand(90)-45; # 旋转选择正负45度 55 | `convert \"$out\" -background none -rotate $rot \"$out\"`; 56 | } 57 | 58 | chdir '/tmp/'; 59 | my @files = glob "d-*.png"; 60 | my $cmd="habak -ms $background"; 61 | #my $cmd="habak -ms $background -mp 550,800 weather.png"; 62 | foreach(@files){ 63 | my $x=int rand(1000); 64 | my $y=int rand(720); 65 | $cmd=$cmd." -mp $x,$y $_"; 66 | } 67 | print "$cmd\n"; 68 | `$cmd`; 69 | -------------------------------------------------------------------------------- /screenrc: -------------------------------------------------------------------------------- 1 | # Deactivate the startup message of screen 2 | startup_message off 3 | 4 | # Setup hardstatus 5 | hardstatus off 6 | hardstatus alwayslastline 7 | hardstatus string '%{= .g} %H |%=%{K}%{= w}%?%{K}%-Lw%?%{r}(%{W}%{w}%n%{w}*%f%t%?(%u)%?%{r})%{w}%?%{K}%+Lw%?%= %{g}|%{B} %m-%d %{W}%c %{g} ' 8 | 9 | # Fix for residual editor text 10 | altscreen on 11 | 12 | # Fix for Name column in windowlist only show "bash" 13 | windowlist string "%4n %h%=%f" 14 | 15 | # Indicate 256 color screen 16 | term screen-256color 17 | -------------------------------------------------------------------------------- /setup-QChatGPT.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2024 shmilee 3 | 4 | DIST_path=~/qq-QChatGPT 5 | LABEL=QChatGPT 6 | 7 | # install for ~user 8 | python3 -m venv "$DIST_path" --prompt $LABEL 9 | sed -e "/PS1=.*($LABEL)/ s/PS1/#PS1/" \ 10 | -e "/PS1=.*($LABEL)/a\ PS1=\"\$(echo \"\${PS1:-}\" \| sed 's\|^\|($LABEL)\|g')\"" \ 11 | -i $DIST_path/bin/activate 12 | source "$DIST_path/bin/activate" 13 | 14 | cd "$DIST_path" 15 | git clone --depth 1 https://github.com/RockChinQ/QChatGPT 16 | python3 -m pip install -r QChatGPT/requirements.txt 17 | 18 | # 配置 19 | cat << EOF 20 | QChatGPT/data/config/platform.json 21 | 22 | { 23 | "adapter": "aiocqhttp", 24 | "enable": true, 25 | "host": "127.0.0.1", 26 | "port": 9574, 27 | "access-token": "" 28 | }, 29 | 30 | "force-delay": [1, 5], 31 | 32 | QChatGPT/data/config/provider.json 33 | 34 | "keys": { 35 | "openai": [ 36 | "sk-AAAAAAAAAAAABBBBBBBBBBBBCCCCCCCCCCCCCDDDDDDDDD" 37 | ], 38 | "anthropic": [], 39 | "moonshot": [], 40 | "deepseek": [] 41 | }, 42 | 43 | "openai-chat-completions": { 44 | "base-url": "https://api.chatanywhere.com.cn/v1", 45 | "args": {}, 46 | "timeout": 120 47 | }, 48 | 49 | "model": "gpt-4o-mini", 50 | 51 | 52 | QChatGPT/data/config/system.json 53 | 54 | "admin-sessions": [ 55 | "person_9xxxxxxxx" 56 | ], 57 | 58 | EOF 59 | 60 | # start 61 | cd QChatGPT/ 62 | python3 main.py 63 | -------------------------------------------------------------------------------- /setup-Umi-OCR.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2025 shmilee 3 | 4 | pkgname=Umi-OCR 5 | pkgver=2.1.5 6 | src_url="https://github.com/hiroi-sora/Umi-OCR/releases/download/v${pkgver}/${pkgname}_Linux_Paddle_${pkgver}.tar.xz" 7 | src_tmp=/tmp/"$(basename $src_url)" 8 | start_sh=umi-ocr.sh 9 | 10 | dist_PATH=~/.local/lib 11 | dist_BIN=~/.local/bin 12 | dist_SHR=~/.local/share 13 | 14 | download_app() { 15 | wget -c $src_url -O $src_tmp 16 | } 17 | 18 | install_app() { 19 | tar Jxvf $src_tmp -C $dist_PATH 20 | APP_DIR="$(/bin/ls -d $dist_PATH/${pkgname}_*_${pkgver} | tail -n1)" 21 | APP_DIR="$(basename $APP_DIR)" 22 | # start script 23 | cat >$dist_BIN/$start_sh <$dist_SHR/applications/umi-ocr.desktop < DONE." 44 | } 45 | 46 | # main 47 | download_app 48 | install_app 49 | -------------------------------------------------------------------------------- /setup-gpt4free.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2024 shmilee 3 | 4 | gpt4free_path=~/gpt4free 5 | 6 | # install for ~user 7 | python3 -m venv "$gpt4free_path" --prompt GPT4Free 8 | sed -e "/PS1=.*(GPT4Free)/ s/PS1/#PS1/" \ 9 | -e "/PS1=.*(GPT4Free)/a\ PS1=\"\$(echo \"\${PS1:-}\" \| sed 's\|^\|(GPT4Free)\|g')\"" \ 10 | -i $gpt4free_path/bin/activate 11 | source "$gpt4free_path/bin/activate" 12 | 13 | cd "$gpt4free_path/" 14 | python3 -m pip install -U g4f[all] 15 | #python3 -m pip install -U g4f[webdriver] 16 | 17 | # start 18 | # python3 -m g4f.cli gui -port 8989 -debug 19 | BIND="$(ifconfig eth0 | grep 'inet ' | awk '{printf $2}'):9416" 20 | g4f api --bind $BIND --ignore-cookie-files 21 | -------------------------------------------------------------------------------- /setup-gpt_academic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2024 shmilee 3 | 4 | gptac_path=~/gpt_academic 5 | 6 | # install for ~user 7 | python3 -m venv "$gptac_path" --prompt GPT 8 | sed -e "/PS1=.*(GPT)/ s/PS1/#PS1/" \ 9 | -e "/PS1=.*(GPT)/a\ PS1=\"\$(echo \"\${PS1:-}\" \| sed 's\|^\|(GPT)\|g')\"" \ 10 | -i $gptac_path/bin/activate 11 | source "$gptac_path/bin/activate" 12 | 13 | git clone --depth=1 https://github.com/binary-husky/gpt_academic.git "$gptac_path/gpt_academic" 14 | python3 -m pip install -r "$gptac_path/gpt_academic/requirements.txt" 15 | 16 | # config 17 | cp -i -v "$gptac_path/gpt_academic/config.py" \ 18 | "$gptac_path/gpt_academic/config_private.py" 19 | echo "Input API_KEY, LLM_MODEL, API_URL_REDIRECT in $gptac_path/gpt_academic/config_private.py" 20 | 21 | # start 22 | cd "$gptac_path/" 23 | python3 gpt_academic/main.py 24 | -------------------------------------------------------------------------------- /setup-label-studio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2024 shmilee 3 | 4 | studio_path=~/label-studio 5 | 6 | # install for ~user 7 | python3 -m venv "$studio_path" --prompt LABEL 8 | sed -e "/PS1=.*(LABEL)/ s/PS1/#PS1/" \ 9 | -e "/PS1=.*(LABEL)/a\ PS1=\"\$(echo \"\${PS1:-}\" \| sed 's\|^\|(LABEL)\|g')\"" \ 10 | -i $studio_path/bin/activate 11 | source "$studio_path/bin/activate" 12 | python3 -m pip install label-studio 13 | echo "export LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true" >> "$studio_path/bin/activate" 14 | echo "export LABEL_STUDIO_BASE_DATA_DIR=$studio_path/data" >> "$studio_path/bin/activate" 15 | mkdir "$studio_path/data" 16 | 17 | # add localhost usernames 18 | for i in `seq 1 10`; do 19 | who="$(tr -dc a-z > "$studio_path/user-info" 22 | label-studio start -b --username "$who" --password "$key" 23 | done 24 | 25 | # check 26 | #label-studio user --username ?name?from?user-info? 27 | #label-studio start 28 | -------------------------------------------------------------------------------- /setup-pdf2zh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2025 shmilee 3 | 4 | pdf2zh_path=~/PDFMathTranslate 5 | 6 | # pdf2zh 1.9.0 w/ python 3.12.8 7 | export PYENV_ROOT="$HOME/.pyenv" 8 | [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" 9 | eval "$(pyenv init - zsh)" 10 | pyenv shell 3.12.8 11 | 12 | # install for ~user 13 | python3 -m venv "$pdf2zh_path" --prompt pdf2zh 14 | sed -e "/PS1=.*(pdf2zh)/ s/PS1/#PS1/" \ 15 | -e "/PS1=.*(pdf2zh)/a\ PS1=\"\$(echo \"\${PS1:-}\" \| sed 's\|^\|(pdf2zh)\|g')\"" \ 16 | -i $pdf2zh_path/bin/activate 17 | echo "export HF_ENDPOINT=https://hf-mirror.com" >>"$pdf2zh_path/bin/activate" 18 | echo "alias pdf2zh_ds='pdf2zh -s deepseek:deepseek-chat'" >>"$pdf2zh_path/bin/activate" 19 | source "$pdf2zh_path/bin/activate" 20 | 21 | cd "$pdf2zh_path/" 22 | python3 -m pip install -U pdf2zh 23 | 24 | # start 25 | pdf2zh -i 26 | -------------------------------------------------------------------------------- /setwp/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: shmilee 2 | 3 | pkgname=setwp 4 | pkgver=0.1 5 | pkgrel=1 6 | pkgdesc="Set random root desktop wallpaper by program habak and imagemagick." 7 | arch=('any') 8 | url=none 9 | license=('GPL') 10 | depends=('python' 'habak' 'imagemagick') 11 | source=('setwp.py' 'setwp.conf') 12 | md5sums=('8568966056ac6f2a7b38e1ebe9b4a5a1' 13 | '8663dd75111e192eca1a1d9cc3f1d70e') 14 | 15 | package() { 16 | cd "$srcdir" 17 | install -Dm755 setwp.py "$pkgdir"/usr/bin/setwp.py 18 | ln -s setwp.py "$pkgdir"/usr/bin/setwp 19 | install -Dm644 setwp.conf "$pkgdir"/etc/setwp.conf.example 20 | } 21 | -------------------------------------------------------------------------------- /setwp/TODO: -------------------------------------------------------------------------------- 1 | >= 2 screens 2 | 3 | 1. 4 | http://www.imagemagick.org/Usage/ 5 | http://www.imagemagick.org/Usage/layers/ 6 | 7 | convert -> wallpaper1.jpg and wallpaper2.jpg 8 | 9 | 2. 10 | feh --bg-fill wallpaper1.jpg --bg-fill wallpaper2.jpg ... 11 | -------------------------------------------------------------------------------- /setwp/setwp.conf: -------------------------------------------------------------------------------- 1 | [path] 2 | # single wallpaper 3 | single_wp = /usr/share/wallpapers-shmilee/1200/think-1920x1200.jpg 4 | 5 | # random wallpaper, directory and file 6 | random_wp = /usr/share/wallpapers-shmilee/1200|/usr/share/wallpapers-shmilee/1600|/usr/share/wallpapers-shmilee/1200/think-1920x1200.jpg 7 | 8 | # random pictures stacked on wallpaper, directory and file 9 | picture = /usr/share/pictures-shmilee|~./pictures 10 | cache = ~/.cache/wallpapers-pictures 11 | 12 | [picture] 13 | # convert setting 14 | size_min = 100 15 | size_max = 170 16 | rotation_min = -45 17 | rotation_max = 45 18 | # No. of random pictures stacked on wallpaper 19 | single_num = 0 20 | random_num = 5 21 | # effects to use: mess|frame|raise|edge|distort 22 | effects = mess|frame|edge 23 | # stack area, [0,0] -> 24 | x_max = 900 25 | y_max = 600 26 | -------------------------------------------------------------------------------- /splitmv/TODO: -------------------------------------------------------------------------------- 1 | # 只要添加-allowed_extensions ALL就可以直接使用本地的key.key文件了,完整代码如下 2 | 3 | ffmpeg -allowed_extensions ALL -protocol_whitelist "file,http,crypto,tcp" -i index.m3u8 -c copy out.mp4 4 | 5 | # 旋转 0123, 6 | 0 = 90CounterCLockwise and Vertical Flip (default) 7 | 1 = 90Clockwise 8 | 2 = 90CounterClockwise 9 | 3 = 90Clockwise and Vertical Flip 10 | 11 | # 缩放scale, -1 auto 12 | -vf "transpose=1,scale=720:-1" 13 | 14 | # 录屏 15 | ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4 16 | https://wiki.archlinux.org/title/FFmpeg#Screen_capture 17 | 18 | # 去水印 19 | ffmpeg -i in.mp4 -vf "delogo=x=23:y=12:w=200:h=45:show=0, delogo=x=780:y=18:w=152:h=28:show=0" -c:a copy out.mp4 20 | https://stackoverflow.com/questions/67552620/how-can-i-apply-delogo-for-a-duration-of-video-in-ffmpeg-or-apply-delogo-in-muti 21 | 22 | # Hanging M3U8 downloads in ffmpeg 23 | ffmpeg has a flag named "rw_timeout" in microseconds, 10,000,000 24 | ffmpeg -rw_timeout 10000000 -i ... 25 | -------------------------------------------------------------------------------- /splitmv/setting.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | File = './old/5minout.f4v' 4 | 5 | Tlist = ( 6 | ('00:00:01', '00:00:14'), # 0 7 | ('00:00:26', '00:00:33'), # 1 8 | ('00:00:42', '00:00:47'), 9 | ('00:00:52', '00:01:00'), 10 | ('00:01:07', '00:01:13'), 11 | ('00:01:32', '00:01:40'), 12 | ('00:01:44', '00:01:58'), 13 | ('00:02:04', '00:02:15'), 14 | ('00:02:18', '00:02:22'), # 8 15 | ('00:02:31', '00:02:43'), 16 | ('00:04:05', '00:04:15'), 17 | ('00:04:21', '00:04:24'), 18 | ('00:04:27', '00:04:40'), 19 | ('00:04:43', '00:04:46'), 20 | ('00:04:49', '00:05:09'), # 14 21 | ) 22 | 23 | Template = 0 24 | 25 | tmpsuffix = None 26 | 27 | outfile = './test.f4v' 28 | -------------------------------------------------------------------------------- /subprocess-ctrl-C.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2021 shmilee 5 | 6 | import subprocess 7 | 8 | 9 | def subruncmd(cmd, **kwargs): 10 | with subprocess.Popen(cmd, **kwargs) as process: 11 | try: 12 | print('b here') 13 | stdout, stderr = process.communicate() 14 | print('c here') 15 | except KeyboardInterrupt: 16 | process.kill() 17 | #process.terminate() 18 | # We don't call process.wait() as .__exit__ does that for us. 19 | # raise # ctrl-c stop here 20 | print('kill sub') 21 | retcode = process.poll() 22 | #res = subprocess.run(cmd, shell=False) 23 | # p.terminate() 24 | print('finish sub') 25 | return retcode 26 | 27 | 28 | if __name__ == '__main__': 29 | for i in range(3): 30 | subruncmd(['sleep', '10']) 31 | -------------------------------------------------------------------------------- /synergy/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # file: init.sh customexec.conf synergy.conf 3 | 4 | if [ x$1 == xS -o x$1 == xs ]; then 5 | echo "==> Server for user: $USER" 6 | echo " -> rm old ~/.synergy/, create new one." 7 | rm -r ~/.synergy/ 8 | mkdir -pv ~/.synergy/{plugins,SSL/Fingerprints} 9 | ln -sv /usr/lib/synergy/libns.so ~/.synergy/plugins/libns.so 10 | openssl req -x509 -nodes -days 365 -subj /CN=Synergy -newkey rsa:1024 \ 11 | -keyout ~/.synergy/SSL/Synergy.pem -out ~/.synergy/SSL/Synergy.pem 12 | openssl x509 -fingerprint -sha1 -noout -in ~/.synergy/SSL/Synergy.pem \ 13 | > ~/.synergy/SSL/Fingerprints/Local.txt 14 | sed -e "s/.*=//" -i ~/.synergy/SSL/Fingerprints/Local.txt 15 | echo " -> add configuration file" 16 | cp -v ./synergy.conf ~/.synergy/synergy.conf 17 | install -Dvm644 ./usynergys.service ~/.config/systemd/user/usynergys.service 18 | systemctl --user daemon-reload 19 | systemctl --user enable usynergys 20 | echo " -> !! Edit your /etc/hosts, by yourself!" 21 | echo " -> !! Do not forget add the fingerprint to your client!!!" 22 | echo " -> !! Here it is: $(<~/.synergy/SSL/Fingerprints/Local.txt)" 23 | echo "==> Done." 24 | elif [ x$1 == xC -o x$1 == xc ]; then 25 | echo "==> Client for user: $USER" 26 | echo " -> rm old ~/.synergy/, create new one." 27 | rm -r ~/.synergy/ 28 | mkdir -pv ~/.synergy/{plugins,SSL/Fingerprints} 29 | ln -sv /usr/lib/synergy/libns.so ~/.synergy/plugins/libns.so 30 | echo " -> add the server FingerPrint" 31 | read -p " -> Input FP:" FFPP 32 | echo $FFPP >~/.synergy/SSL/Fingerprints/TrustedServers.txt 33 | echo " -> !! Run command to engoy:" 34 | echo " -> !! \$ synergyc -f --enable-crypto " 35 | echo "==> Done." 36 | else 37 | echo "$0 " 38 | echo " S: Server" 39 | echo " C: Client" 40 | fi 41 | -------------------------------------------------------------------------------- /synergy/mac-crypto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Client in mac os x 3 | 4 | _path="$HOME/Library/Synergy" 5 | libfile=/Applications/Synergy.app/Contents/MacOS/plugins/libns.dylib 6 | 7 | echo "==> Client for user: $USER" 8 | echo " -> rm old $_path, create new one." 9 | [ -d "$_path" ] && rm -r "$_path" 10 | mkdir -pv "$_path"/{plugins,SSL/Fingerprints} 11 | ln -sv $libfile "$_path"/plugins/libns.dylib 12 | echo " -> add the server FingerPrint" 13 | read -p " -> Input FP:" FFPP 14 | echo $FFPP > "$_path"/SSL/Fingerprints/TrustedServers.txt 15 | echo " -> !! Run command to engoy:" 16 | echo " -> !! \$ /path/to/synergyc -f --enable-crypto " 17 | echo "==> Done." 18 | -------------------------------------------------------------------------------- /synergy/synergy.conf: -------------------------------------------------------------------------------- 1 | # +-------+ +--------+ 2 | # |Laptop | |Desktop| 3 | # | | | | 4 | # +-------+ +--------+ 5 | 6 | section: screens 7 | Laptop: 8 | Desktop: 9 | end 10 | 11 | section: links 12 | Desktop: 13 | left = Laptop 14 | Laptop: 15 | right = Desktop 16 | end 17 | 18 | section: aliases 19 | Laptop: 20 | arch-T450 21 | Desktop: 22 | arch-M9201z 23 | end 24 | 25 | section: options 26 | keystroke(Super+ScrollLock) = lockCursorToScreen(toggle) 27 | end 28 | -------------------------------------------------------------------------------- /synergy/usynergys.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Synergy Server Daemon 3 | After=network.target 4 | 5 | [Service] 6 | ExecStart=/usr/bin/synergys --no-daemon --config %h/.synergy/synergy.conf --enable-crypto 7 | Restart=on-failure 8 | 9 | [Install] 10 | WantedBy=default.target 11 | -------------------------------------------------------------------------------- /synergy/win-crypto.bat: -------------------------------------------------------------------------------- 1 | xcopy "%ProgramFiles%\Synergy/Plugins/ns.dll" "%LOCALAPPDATA%\Synergy\Plugins\" /F 2 | md %LOCALAPPDATA%\Synergy\SSL\Fingerprints 3 | set /p FFPP=add the server FingerPrint: 4 | echo %FFPP%>%LOCALAPPDATA%\Synergy\SSL\Fingerprints\TrustedServers.txt 5 | @echo Run Command: 6 | @echo "%ProgramFiles%\Synergy\synergyc.exe -n arch-T450 --enable-crypto " 7 | pause 8 | -------------------------------------------------------------------------------- /systemd/80-runtime-dir-xauthority.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # This makes a link $XDG_RUNTIME_DIR/$UID-Xauthority to XAUTHORITY. 4 | # 5 | # Put this in directory /etc/X11/xinit/xinitrc.d/ 6 | # (man sddm.conf, SessionCommand=/usr/share/sddm/scripts/Xsession) 7 | # 8 | # Why? 9 | # As sddm creates XAUTHORITY=/tmp/xauth_XXXXX (man sddm.conf, UserAuthFile), 10 | # but we need a static XAUTHORITY path for screenlock. 11 | # 12 | # See more: 13 | # https://unix.stackexchange.com/questions/577139 14 | # https://github.com/google/xsecurelock/issues/183 15 | # https://bbs.archlinux.org/viewtopic.php?id=288986 16 | 17 | if [ -n "${XAUTHORITY}" ]; then 18 | if [ -d "${XDG_RUNTIME_DIR}" ]; then 19 | ln -sf "${XAUTHORITY}" "${XDG_RUNTIME_DIR}/${UID}-Xauthority" 20 | fi 21 | fi 22 | -------------------------------------------------------------------------------- /systemd/reload_modules: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # https://wiki.archlinux.org/index.php/Power_management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep 4 | # /usr/lib/systemd/system-sleep/ 5 | _modules=(r8188eu) 6 | 7 | case $1/$2 in 8 | pre/*) 9 | for mod in ${_modules[@]}; do 10 | echo "$1/$2: rmmod $mod ..." 11 | rmmod $mod 12 | done 13 | ;; 14 | post/*) 15 | for mod in ${_modules[@]}; do 16 | echo "$1/$2: modprobe $mod ..." 17 | modprobe $mod 18 | done 19 | ;; 20 | esac 21 | -------------------------------------------------------------------------------- /systemd/sleep@.service: -------------------------------------------------------------------------------- 1 | # path: /etc/systemd/system/sleep@.service 2 | 3 | [Unit] 4 | Description=Call user's sleep service before system suspend/sleep target 5 | Before=sleep.target 6 | 7 | [Service] 8 | # oneshot,forking: user unit up, breaks sleep; simple,exec: ok 9 | Type=simple 10 | ExecStart=/usr/bin/systemctl --user --machine=%i@ start --wait xsecurelock.service 11 | 12 | [Install] 13 | WantedBy=sleep.target 14 | -------------------------------------------------------------------------------- /systemd/tlp.service: -------------------------------------------------------------------------------- 1 | # tlp - systemd startup/shutdown service 2 | # 3 | # Copyright (c) 2015 Thomas Koch 4 | # This software is licensed under the GPL v2 or later. 5 | 6 | [Unit] 7 | Description=TLP system startup/shutdown 8 | Wants=bluetooth.service 9 | After=multi-user.target bluetooth.service 10 | Before=shutdown.target 11 | 12 | [Service] 13 | Type=simple 14 | RemainAfterExit=yes 15 | ExecStart=/usr/bin/tlp init start 16 | ExecStop=/usr/bin/tlp init stop 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /systemd/xsecurelock.service: -------------------------------------------------------------------------------- 1 | # path: ~/.config/systemd/user/xsecurelock.service 2 | 3 | [Unit] 4 | Description=Lock screen before suspend/sleep 5 | Before=sleep.target 6 | 7 | [Service] 8 | Type=simple 9 | Environment=XSECURELOCK_FONT="LXGW Neo XiHei Screen" 10 | Environment=XSECURELOCK_SHOW_DATETIME=1 11 | Environment=XSECURELOCK_DATETIME_FORMAT="%%c" 12 | Environment=XSECURELOCK_PASSWORD_PROMPT=time_hex 13 | Environment=XSECURELOCK_NO_COMPOSITE=1 14 | Environment=LC_ALL=zh_CN.UTF-8 15 | ExecStart=/usr/bin/xsecurelock 16 | -------------------------------------------------------------------------------- /systemd/xsecurelock@.service: -------------------------------------------------------------------------------- 1 | # path: /etc/systemd/system/xsecurelock@.service 2 | # need: XAUTHORITY=/run/user/%i/%i-Xauthority 3 | # cmd: systemctl enable xsecurelock@1000 4 | 5 | [Unit] 6 | Description=Lock screen using xsecurelock for UID %i, before suspend/sleep 7 | Before=sleep.target 8 | After=display-manager.service user@%i.service 9 | 10 | [Service] 11 | Type=simple 12 | User=%i 13 | Environment=DISPLAY=:0 14 | Environment=XAUTHORITY=/run/user/%i/%i-Xauthority 15 | Environment=XSECURELOCK_FONT="LXGW Neo XiHei Screen" 16 | Environment=XSECURELOCK_SHOW_DATETIME=1 17 | Environment=XSECURELOCK_DATETIME_FORMAT="%%c" 18 | Environment=XSECURELOCK_PASSWORD_PROMPT=time_hex 19 | Environment=XSECURELOCK_NO_COMPOSITE=1 20 | Environment=LC_ALL=zh_CN.UTF-8 21 | ExecStart=/usr/bin/xsecurelock 22 | 23 | [Install] 24 | WantedBy=sleep.target 25 | -------------------------------------------------------------------------------- /test_youku_ccode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | URL='https://ups.youku.com/ups/get.json?vid=XMTU0MzA4MDUyNA==&ccode={CCODE}&client_ip=192.168.1.1&utid=3yE%2BE3F5KEMCAT2xOYJYiCX8&client_ts=1521955818' 4 | 5 | for c in `seq 0 99`; do 6 | ccode="05$c" 7 | #ccode="08$c" 8 | url="$(echo $URL | sed "s|{CCODE}|$ccode|")" 9 | out=$(curl "$url" 2>/dev/null | sed '/ccode参数错误/d') 10 | if [[ x"$out" != x ]]; then 11 | echo $ccode : $out 12 | fi 13 | done 14 | 15 | #0590 16 | -------------------------------------------------------------------------------- /th-1a/ecvpn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2021 shmilee 3 | 4 | tag=210223 5 | 6 | if [ x"$1" = x"th" ]; then 7 | # tianhe 8 | $HOME/.ECDATA/EasyConnect_x64_v7.6.7/start.sh $tag \ 9 | -p 127.0.0.1:8413:1080 10 | else 11 | # rvpn 12 | $HOME/.ECDATA/EasyConnect_x64_v7.6.3/start.sh $tag \ 13 | -p 127.0.0.1:3600:1080 14 | fi 15 | -------------------------------------------------------------------------------- /th-1a/keep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | try=0 4 | target=${1:-th1aln2.local} 5 | 6 | while [ $try -lt 20 ]; do 7 | date 8 | ssh $target 9 | if [[ $? == 0 ]]; then 10 | try=20 #正常退出 11 | else 12 | ((try++)) 13 | sleep 60s 14 | fi 15 | done 16 | 17 | date 18 | -------------------------------------------------------------------------------- /trap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | trap 'echo signal is 1' 1 4 | trap 'echo signal is 2' 2 5 | trap 'echo signal is 9' 9 6 | trap 'echo signal is 15' 15 7 | trap 'echo signal is 29' 29 8 | 9 | read in 10 | 11 | echo "\$in is $in" 12 | 13 | -------------------------------------------------------------------------------- /travel-node-s.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | USER=${USER:smli} 4 | usr_ssh="/backup/home/$USER/.ssh" #~/.ssh 5 | id_pr_key="$usr_ssh/id_rsa" 6 | id_pu_key="$usr_ssh/id_rsa.pub" 7 | 8 | node_ln=($(grep -E 'node[1-9].*-ib' /etc/hosts |awk '{print $1":::"$2}')) 9 | node_ln+=($(grep manager-ib /etc/hosts |awk '{print $1":::"$2}')) 10 | 11 | nodes=() 12 | loc_node=$(hostname) 13 | 14 | # ssh copy id 15 | # nodes share /dev/pfs2 --> $usr_ssh 16 | sed -i "s|.*$(awk '{print $2}' $usr_ssh/id_rsa.pub).*||;/^$/d" $usr_ssh/authorized_keys 17 | cat $id_pu_key >> $usr_ssh/authorized_keys 18 | 19 | # known_hosts fingerprint(yes/no) 20 | echo "Input your password: " 21 | read -s PASSWD 22 | apswd=autopswd.$(mktemp -u|sed 's/.*\.//') 23 | cat > $apswd <&1 >/dev/null; then 40 | nodes+=(${name}) 41 | echo "==> ${name}: ${ip_a}. Yes." 42 | #ssh -o StrictHostKeyChecking=no $USER@$name "echo -\> add." 43 | sed -i "s|%%HOST%%|$name|" $apswd 44 | expect -f $apswd 45 | sed -i "s|$name|%%HOST%%|" $apswd 46 | else 47 | echo "==> $name unreachable" 48 | fi 49 | echo 50 | done 51 | rm $apswd 52 | echo "==> ${#nodes[@]} nodes added. They are:" 53 | #echo " -> ${nodes[@]}" 54 | awk '{print $1}' $usr_ssh/known_hosts 55 | -------------------------------------------------------------------------------- /turtle/DeepinScrot-3619.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/turtle/DeepinScrot-3619.png -------------------------------------------------------------------------------- /turtle/doggy.py: -------------------------------------------------------------------------------- 1 | import time 2 | import turtle as t 3 | 4 | t.screensize(500, 500) 5 | for i in range(1, 6): 6 | print(i) 7 | time.sleep(1) 8 | # 【头部轮廓】 9 | t.pensize(5) 10 | t.home() 11 | t.seth(0) 12 | t.pd() 13 | # pendown 14 | t.color('black') 15 | t.circle(20, 80) 16 | # 0 17 | t.circle(200, 30) 18 | # 1 19 | t.circle(30, 60) 20 | # 2 21 | t.circle(200, 29.5) 22 | # 3 23 | t.color('black') 24 | t.circle(20, 60) 25 | # 4 26 | t.circle(-150, 22) 27 | # 5 28 | t.circle(-50, 10) 29 | # 6 30 | t.circle(50, 70) 31 | # 7 32 | # 确定鼻头大概位置 t.xcor和t.ycor乌龟一开始的位置 33 | x_nose = t.xcor() 34 | y_nose = t.ycor() 35 | t.circle(30, 62) 36 | # 8 37 | t.circle(200, 15) 38 | # 9 39 | # 【鼻子】 40 | t.pu() 41 | # penup 42 | t.goto(x_nose, y_nose + 25) 43 | t.seth(90) 44 | t.pd() 45 | t.begin_fill() 46 | t.circle(8) 47 | t.end_fill() 48 | # 【眼睛】 49 | t.pu() 50 | t.goto(x_nose + 48, y_nose + 55) 51 | t.seth(90) 52 | t.pd() 53 | t.begin_fill() 54 | t.circle(8) 55 | t.end_fill() 56 | # 【耳朵】 57 | t.pu() 58 | t.color('#444444') 59 | t.goto(x_nose + 100, y_nose + 110) 60 | t.seth(182) 61 | t.pd() 62 | t.circle(15, 45) 63 | t.color('black') 64 | t.circle(10, 15) 65 | t.circle(90, 70) 66 | t.circle(25, 110) 67 | t.rt(4) 68 | t.circle(90, 70) 69 | t.circle(10, 15) 70 | t.color('#444444') 71 | t.circle(15, 45) 72 | # 【身体】 73 | t.pu() 74 | t.color('black') 75 | t.goto(x_nose + 90, y_nose - 30) 76 | t.seth(-130) 77 | t.pd() 78 | t.circle(250, 28) 79 | t.circle(10, 140) 80 | t.circle(-250, 25) 81 | t.circle(-200, 25) 82 | t.circle(-50, 85) 83 | t.circle(8, 145) 84 | t.circle(90, 45) 85 | t.circle(550, 5) 86 | # 【尾巴】 87 | t.seth(0) 88 | t.circle(60, 85) 89 | t.circle(40, 65) 90 | t.circle(40, 60) 91 | t.lt(150) 92 | # left 93 | t.circle(-40, 90) 94 | t.circle(-25, 100) 95 | t.lt(5) 96 | t.fd(20) 97 | t.circle(10, 60) 98 | # 【背部】 99 | t.rt(80) 100 | # right 101 | t.circle(200, 35) 102 | # 【项圈】 103 | t.pensize(20) 104 | t.color('#F03C3F') 105 | t.lt(10) 106 | t.circle(-200, 25) 107 | # 【爱心铃铛】 108 | t.pu() 109 | t.fd(18) 110 | t.lt(90) 111 | t.fd(18) 112 | t.pensize(6) 113 | t.seth(35) 114 | # setheading 115 | t.color('#FDAF17') 116 | t.begin_fill() 117 | t.lt(135) 118 | t.fd(6) 119 | t.right(180) 120 | # 画笔掉头 121 | t.circle(6, -180) 122 | t.backward(8) 123 | t.right(90) 124 | t.forward(6) 125 | t.circle(-6, 180) 126 | t.fd(15) 127 | t.end_fill() 128 | # 【前小腿】 129 | t.pensize(5) 130 | t.pu() 131 | t.color('black') 132 | t.goto(x_nose + 100, y_nose - 125) 133 | t.pd() 134 | t.seth(-50) 135 | t.fd(25) 136 | t.circle(10, 150) 137 | t.fd(25) 138 | # 【后小腿】 139 | t.pensize(4) 140 | t.pu() 141 | t.goto(x_nose + 314, y_nose - 125) 142 | t.pd() 143 | t.seth(-95) 144 | t.fd(25) 145 | t.circle(-5, 150) 146 | t.fd(2) 147 | t.hideturtle() 148 | t.done() 149 | -------------------------------------------------------------------------------- /turtle/figure_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/turtle/figure_1.png -------------------------------------------------------------------------------- /turtle/leaf-show.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # -*- coding:utf-8 -*- 4 | 5 | from numpy import * 6 | from random import random 7 | import turtle as tt 8 | 9 | tt.reset() 10 | 11 | x = array([0,0]) 12 | 13 | p = [0.85,0.91,0.99,1.00] 14 | 15 | A1 = array([[.83, 0.03],[-0.03,.86]]) 16 | B1 = array([0,1.5]) 17 | 18 | A2 = array([[0.20,-0.25],[0.21,0.23]]) 19 | B2 = array([0,1.5]) 20 | 21 | A3 = array([[-0.15,0.27],[0.25,0.26]]) 22 | B3 = array([0,0.45]) 23 | 24 | A4 = array([[0,0],[0,0.17]]) 25 | B4 = array([0,0]) 26 | 27 | tt.speed(0) 28 | tt.Turtle().screen.delay(0) 29 | tt.color("black") 30 | tt.penup() 31 | 32 | i=0 33 | while i < 50000: 34 | i += 1 35 | r = random() 36 | if r < p[0]: 37 | x = dot(A1 , x) + B1 38 | elif r < p[1]: 39 | x = dot(A2 , x) + B2 40 | elif r < p[2]: 41 | x = dot(A3 , x) + B3 42 | else: 43 | x = dot(A4 , x) + B4 44 | 45 | tt.goto(x[0]*120,x[1]*60-240) 46 | tt.dot(2) 47 | 48 | input("Press to EXIT") 49 | -------------------------------------------------------------------------------- /turtle/leaf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # -*- coding:utf-8 -*- 4 | 5 | from numpy import * 6 | from random import random 7 | import matplotlib.pyplot as plt 8 | 9 | p = [0.85,0.91,0.99,1.00] 10 | A1 = array([[.83, 0.03],[-0.03,.86]]) 11 | B1 = array([0,1.5]) 12 | A2 = array([[0.20,-0.25],[0.21,0.23]]) 13 | B2 = array([0,1.5]) 14 | A3 = array([[-0.15,0.27],[0.25,0.26]]) 15 | B3 = array([0,0.45]) 16 | A4 = array([[0,0],[0,0.17]]) 17 | B4 = array([0,0]) 18 | 19 | i = 0 20 | X = [] 21 | Y = [] 22 | x = array([0,0]) 23 | while i < 500000: 24 | i += 1 25 | r = random() 26 | if r < p[0]: 27 | x = dot(A1 , x) + B1 28 | elif r < p[1]: 29 | x = dot(A2 , x) + B2 30 | elif r < p[2]: 31 | x = dot(A3 , x) + B3 32 | else: 33 | x = dot(A4 , x) + B4 34 | X += [x[0]*120] 35 | Y += [x[1]*60-240] 36 | 37 | plt.plot(X, Y, 'g.', markersize = 1) 38 | plt.show() 39 | -------------------------------------------------------------------------------- /uos-info/apt-sources.list.d/appstore.list: -------------------------------------------------------------------------------- 1 | # Writtten by deepin-home-appstore-client 2 | deb https://home-store-packages.uniontech.com/appstore dragon appstore 3 | -------------------------------------------------------------------------------- /uos-info/apt-sources.list.d/driver.list: -------------------------------------------------------------------------------- 1 | # Written by dde-printer 2 | deb https://pro-driver-packages.uniontech.com eagle non-free 3 | -------------------------------------------------------------------------------- /uos-info/apt-sources.list.d/printer.list: -------------------------------------------------------------------------------- 1 | deb https://home-packages.chinauos.com/printer eagle non-free 2 | -------------------------------------------------------------------------------- /uos-info/debian_version: -------------------------------------------------------------------------------- 1 | 10.10 2 | -------------------------------------------------------------------------------- /uos-info/oem-settings.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | # deb repository entry to be added in the sources.list file. 3 | apt_source_deb = "deb https://home-packages.chinauos.com/home plum main contrib non-free" 4 | # source repository entry to be added in the sources.list file. 5 | apt_source_deb_src = "#deb-src https://home-packages.chinauos.com/home plum main contrib non-free" 6 | -------------------------------------------------------------------------------- /uos-info/os-release: -------------------------------------------------------------------------------- 1 | PRETTY_NAME="UnionTech OS Desktop 20 Home" 2 | NAME="uos" 3 | VERSION_ID="20" 4 | VERSION="20" 5 | ID=uos 6 | HOME_URL="https://www.chinauos.com/" 7 | BUG_REPORT_URL="https://club.uniontech.com" 8 | VERSION_CODENAME=eagle 9 | -------------------------------------------------------------------------------- /uos-info/usr-share-settings-home.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | 3 | # Support aot. Only open it if you use aot data package 4 | SupportAot = false 5 | 6 | # Allow user sign in. 7 | SupportSignIn = true 8 | 9 | # Base url to metadata server. 10 | Server = "https://home-store.chinauos.com" 11 | 12 | # After 5.3, store will auto change region by ip. 13 | # Allow change Region 14 | AllowSwitchRegion = false 15 | 16 | # Default operation region. 17 | DefaultRegion = "CN" 18 | 19 | # Show support by upyun if you use CDN. 20 | UpyunBannerVisible = true 21 | -------------------------------------------------------------------------------- /var.mk: -------------------------------------------------------------------------------- 1 | ##http://coolshell.cn/articles/3790.html 2 | 3 | %: 4 | @echo '$*=$($*)' 5 | 6 | d-%: 7 | @echo '$*=$($*)' 8 | @echo ' origin = $(origin $*)' 9 | @echo ' value = $(value $*)' 10 | @echo ' flavor = $(flavor $*)' 11 | -------------------------------------------------------------------------------- /vim/lua/keymaps.lua: -------------------------------------------------------------------------------- 1 | --" 选中即复制 mouse selection 2 | --" https://github.com/OneOfOne/dotfiles/blob/1082fb7c7752867793a51b04763f79b7347c466f/.config/nvim/lua/config/keymaps.lua#L62-L65 3 | --" https://www.reddit.com/r/neovim/comments/171p7z3/comment/k3s5nlx/ 4 | 5 | local function vmap(keys, fn, desc) 6 | vim.keymap.set('v', keys, fn, { desc = desc, noremap = true }) 7 | end 8 | 9 | vmap('', '"*ygv', 'yank on mouse selection') 10 | --vmap('', '"*ygv', 'yank selection to *') 11 | vmap('', '', '') 12 | vmap('', '"*dgv', 'delete selection to *') 13 | vmap('', '"*P', 'replace selection with *') 14 | -------------------------------------------------------------------------------- /wget-list.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # wget -i url-list 3 | # usage: wget-list.sh list-file 4 | # cat list-file 5 | # name1::url1 6 | # name2::url2 7 | # ... ... 8 | 9 | list="$1" 10 | if [[ ! -f $list ]];then 11 | echo "$list not exit." 12 | exit 1 13 | fi 14 | nlist=$(awk 'END {print NR}' $list) 15 | fail_names=() 16 | fail_lines=() 17 | for i in $(seq 1 1 $nlist) 18 | do 19 | line="$(awk 'NR=='$i'{print $0}' $list)" 20 | if ! echo $line|grep :: 2>&1 >/dev/null ;then 21 | echo "wrong line : $i" 22 | fail_lines+=("$i") 23 | else 24 | name="${line%%::*}" 25 | url="${line##*::}" 26 | wget -t 3 -c -O "$name" "$url" 27 | if [[ "$?" != "0" ]];then 28 | echo "Faild to download ${name}." 29 | fail_names+=("$name") 30 | fi 31 | fi 32 | done 33 | echo "ALL DONE!" 34 | [[ "${#fail_names[@]}" == "0" ]] || echo -e "Faild files:\n ${fail_names[@]}" 35 | [[ "${#fail_lines[@]}" == "0" ]] || echo -e "Faild lines:\n ${fail_lines[@]}" 36 | -------------------------------------------------------------------------------- /wpsforlinux/check_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -d ./data ];then 4 | echo 'no org_data' 5 | exit 1 6 | fi 7 | if [ ! -d ./pkg ];then 8 | echo 'no pkg_data' 9 | exit 1 10 | fi 11 | if [ -d ./temp ];then 12 | rm -r ./temp 13 | fi 14 | mkdir ./temp 15 | 16 | # opt dir 17 | find data/opt |sed 's/^data//g' |sort >./temp/org_data 18 | find pkg/wpsoffice-common/opt |sed 's/^pkg\/wpsoffice-common//g' >./temp/_tmp 19 | find pkg/wpsoffice/opt |sed 's/^pkg\/wpsoffice//g' >>./temp/_tmp 20 | sort ./temp/_tmp >./temp/pkg_data 21 | diff -Nur ./temp/org_data ./temp/pkg_data >./temp/opt_diff 22 | # etc dir 23 | find data/etc |sed 's/^data//g' |sort >./temp/org_data 24 | find pkg/wpsoffice-common/etc |sed 's/^pkg\/wpsoffice-common//g' |sort >./temp/pkg_data 25 | diff -Nur ./temp/org_data ./temp/pkg_data >./temp/etc_diff 26 | # usr dir 27 | find data/usr |sed 's/^data//g' |sort >./temp/org_data 28 | find pkg/wpsoffice-common/usr |sed 's/^pkg\/wpsoffice-common//g' |sort >./temp/pkg_data 29 | diff -Nur ./temp/org_data ./temp/pkg_data >./temp/usr_diff 30 | -------------------------------------------------------------------------------- /wpsforlinux/wpsoffice.install: -------------------------------------------------------------------------------- 1 | icon_mime_hello() { 2 | xdg-icon-resource forceupdate --theme hicolor 3 | update-desktop-database -q 4 | update-mime-database usr/share/mime > /dev/null 2>&1 5 | } 6 | 7 | post_install() { 8 | icon_mime_hello $1 9 | if [ ! -d /usr/share/fonts/wps-office ] ; then 10 | echo "==> Make sure you have installed some ttf fonts." 11 | fi 12 | } 13 | 14 | post_upgrade() { 15 | post_install $1 16 | } 17 | 18 | post_remove() { 19 | icon_mime_hello $1 20 | } 21 | -------------------------------------------------------------------------------- /wpsoffice-PKGBULD/orig_PKGBUILD/wpsoffice-common/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Kingsoft Office 2 | # Maintainer: shmilee 3 | 4 | pkgname=wpsoffice-common 5 | pkgver=1.0 6 | pkgrel=2 7 | arch=('i686' 'x86_64') 8 | groups=('wpsforlinux') 9 | license=('custom:Kingsoft') 10 | pkgdesc="Dependencies and license for Kingsoft Office(WPS office)." 11 | url='http://wps-community.org/' 12 | source=('LICENSE') 13 | sha1sums=('fffe33dc4b2bcd1398a96d6b2cd4e107cbef5fd8') 14 | if [ "$CARCH" = "i686" ]; then 15 | depends=('fontconfig' 'glib2' 'libpng12' 'libsm' 'libxext' 'libxrender' 'libcups') 16 | #optdepends=('libcups: CUPS printing support') 17 | elif [ "$CARCH" = "x86_64" ]; then 18 | depends=('lib32-fontconfig' 'lib32-glib2' 'lib32-libpng12' 'lib32-libsm' 'lib32-libxext' 'lib32-libxrender' 'lib32-libcups') 19 | #optdepends=('lib32-libcups: CUPS printing support') 20 | fi 21 | 22 | package() { 23 | cd "$srcdir" 24 | install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/wpsoffice/LICENSE 25 | } 26 | -------------------------------------------------------------------------------- /wpsoffice-PKGBULD/orig_PKGBUILD/wpsoffice-fonts/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Kingsoft Office 2 | # Maintainer: shmilee 3 | 4 | pkgname=wpsoffice-fonts 5 | pkgver=5.20 6 | _pkgver=%PKGVER% 7 | pkgrel=3 8 | pkgdesc="FangZheng fonts separated from Kingsoft Office(WPS Office)." 9 | url="http://www.foundertype.com/" 10 | arch=('any') 11 | groups=('wpsforlinux') 12 | license=('custom:Kingsoft') 13 | conflicts=('wps-office' 'kingsoft-office') 14 | source=("%SRC_url%/kingsoft-office_${_pkgver}_i386.deb") 15 | sha1sums=('%SHA1SUMS%') 16 | depends=('fontconfig') 17 | install=wpsoffice-fonts.install 18 | 19 | #PKGEXT='.pkg.tar' ##reduce the time of compression 20 | 21 | package() { 22 | cd "${srcdir}" 23 | tar xv -C "${pkgdir}" --lzma -f data.tar.lzma ./usr/share/fonts 24 | } 25 | -------------------------------------------------------------------------------- /wpsoffice-PKGBULD/orig_PKGBUILD/wpsoffice-fonts/wpsoffice-fonts.install: -------------------------------------------------------------------------------- 1 | post_install() { 2 | echo -n "Updating font cache... " 3 | cd /usr/share/fonts/wps-office 4 | mkfontscale 5 | mkfontdir 6 | fc-cache -fs > /dev/null 7 | echo "done." 8 | } 9 | 10 | post_upgrade() { 11 | post_install $1 12 | } 13 | 14 | post_remove() { 15 | if [ -d /usr/share/fonts/wps-office ] ; then 16 | rm -rf /usr/share/fonts/wps-office 17 | fi 18 | fc-cache -fs > /dev/null 19 | } 20 | -------------------------------------------------------------------------------- /wpsoffice-PKGBULD/orig_PKGBUILD/wpsoffice-langpack/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Kingsoft Office 2 | # Maintainer: shmilee 3 | 4 | pkgbase=wpsoffice-langpack 5 | pkgname=('wpsoffice-en-US' 'wpsoffice-zh-CN') 6 | _pkgver=%PKGVER% 7 | pkgver=${_pkgver} 8 | pkgrel=1 9 | arch=('any') 10 | groups=('wpsforlinux') 11 | url='http://wps-community.org/' 12 | license=('custom:Kingsoft') 13 | depends=('wpsoffice') 14 | conflicts=('wps-office' 'kingsoft-office') 15 | provides=('wpsoffice-langpack') 16 | source=("%SRC_url%/kingsoft-office_${_pkgver}_i386.deb") 17 | sha1sums=('%SHA1SUMS%') 18 | 19 | package_wpsoffice-en-US() { 20 | pkgdesc='English (United States) language pack for Kingsoft Office(WPS Office).' 21 | 22 | cd "${srcdir}" 23 | tar xv -C "${pkgdir}" --lzma -f data.tar.lzma ./opt/kingsoft/wps-office/office6/mui/en_US/{en_US.png,lang.conf} 24 | } 25 | 26 | package_wpsoffice-zh-CN() { 27 | pkgdesc='Chinese (simplified) language pack for Kingsoft Office(WPS Office).' 28 | 29 | cd "${srcdir}" 30 | tar xv -C "${pkgdir}" --lzma -f data.tar.lzma ./opt/kingsoft/wps-office/office6/mui/zh_CN --exclude=opt/kingsoft/wps-office/office6/mui/zh_CN/templates 31 | } 32 | -------------------------------------------------------------------------------- /wpsoffice-PKGBULD/orig_PKGBUILD/wpsoffice-templates/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Kingsoft Office 2 | # Maintainer: shmilee 3 | 4 | pkgbase=wpsoffice-templates 5 | pkgname=('wpsoffice-templates-en-US' 'wpsoffice-templates-zh-CN') 6 | _pkgver=%PKGVER% 7 | pkgver=${_pkgver} 8 | pkgrel=1 9 | arch=('any') 10 | groups=('wpsforlinux') 11 | url='http://wps-community.org/' 12 | license=('custom:Kingsoft') 13 | conflicts=('wps-office' 'kingsoft-office') 14 | provides=('wpsoffice-templates') 15 | source=("%SRC_url%/kingsoft-office_${_pkgver}_i386.deb") 16 | sha1sums=('%SHA1SUMS%') 17 | 18 | package_wpsoffice-templates-en-US() { 19 | pkgdesc='English (United States) templates for Kingsoft Office(WPS Office).' 20 | depends=('wpsoffice-en-US') 21 | 22 | cd "${srcdir}" 23 | tar xv -C "${pkgdir}" --lzma -f data.tar.lzma ./opt/kingsoft/wps-office/office6/mui/en_US 24 | rm "${pkgdir}"/opt/kingsoft/wps-office/office6/mui/en_US/{en_US.png,lang.conf} 25 | } 26 | 27 | package_wpsoffice-templates-zh-CN() { 28 | pkgdesc='Chinese (simplified) templates for Kingsoft Office(WPS Office).' 29 | depends=('wpsoffice-zh-CN') 30 | 31 | cd "${srcdir}" 32 | tar xv -C "${pkgdir}" --lzma -f data.tar.lzma ./opt/kingsoft/wps-office/office6/mui/zh_CN/templates 33 | } 34 | -------------------------------------------------------------------------------- /wpsoffice-PKGBULD/orig_PKGBUILD/wpsoffice/wps-office.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WPS文字 文档 5 | WPS文字 文档 6 | 7 | 8 | 9 | 10 | 11 | WPS文字 模板 12 | 13 | 14 | 15 | 16 | WPS演示 演示文稿 17 | 18 | 19 | 20 | 21 | WPS演示 模板 22 | 23 | 24 | 25 | 26 | WPS表格 工作簿 27 | 28 | 29 | 30 | 31 | WPS表格 模板 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /wpsoffice-PKGBULD/orig_PKGBUILD/wpsoffice/wpsoffice.install: -------------------------------------------------------------------------------- 1 | icon_mime_hello() { 2 | xdg-icon-resource forceupdate --theme hicolor 3 | update-desktop-database -q 4 | update-mime-database usr/share/mime > /dev/null 2>&1 5 | } 6 | 7 | post_install() { 8 | icon_mime_hello $1 9 | if [ ! -d /usr/share/fonts/wps-office ] ; then 10 | echo "==> Make sure you have installed some ttf fonts." 11 | fi 12 | echo "==> Do not forget to install one language pack for wpsoffice." 13 | } 14 | 15 | post_upgrade() { 16 | post_install $1 17 | } 18 | 19 | post_remove() { 20 | icon_mime_hello $1 21 | } 22 | -------------------------------------------------------------------------------- /wpsoffice-i18n/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: shmilee 2 | 3 | lang=(de fr fr-ca ja-jp zh-cn zh-tw) 4 | _prefix="wps-office-mui" 5 | _srcurl="http://kdl.cc.ksosoft.com/wps-community/download/a15/${_prefix}" 6 | _pkgver=9.1.0.4751~a15 7 | 8 | pkgbase=wpsoffice-i18n 9 | pkgname=('wpsoffice-de' 10 | 'wpsoffice-fr' 11 | 'wpsoffice-fr-ca' 12 | 'wpsoffice-ja-jp' 13 | 'wpsoffice-zh-cn' 14 | 'wpsoffice-zh-tw') 15 | pkgver=${_pkgver} 16 | pkgrel=1 17 | arch=('any') 18 | groups=('wpsforlinux') 19 | url='http://wps-community.org/' 20 | license=('custom:Kingsoft') 21 | depends=('wpsoffice') 22 | conflicts=('wps-office' 'kingsoft-office') 23 | provides=('wpsoffice-langpack') 24 | source=("${_srcurl}-de_${_pkgver}_all.deb" 25 | "${_srcurl}-fr_${_pkgver}_all.deb" 26 | "${_srcurl}-fr-ca_${_pkgver}_all.deb" 27 | "${_srcurl}-ja-jp_${_pkgver}_all.deb" 28 | "${_srcurl}-zh-cn_${_pkgver}_all.deb" 29 | "${_srcurl}-zh-tw_${_pkgver}_all.deb") 30 | sha1sums=('bcf82427f31141868c5d390352e175f4cfc797cf' 31 | '894928a69ab46ce94932fa302aa9392b98eb0553' 32 | '2ebfef6b9d2e7db79302cf84f6f185f6be1c7716' 33 | '29c58a2d7ed5b4b73b876a88f0ef2b7a67527bba' 34 | 'e1bf24a301c4b735f572b704a8c67ade35dfc650' 35 | '422916c88d7968f9d1d247db72749af89d5f2aa9') 36 | noextract=(${source[@]##*/}) 37 | 38 | build(){ 39 | cd "${srcdir}" 40 | for _lang in ${lang[@]}; do 41 | [ -d $_lang ]&&rm -r $_lang 42 | mkdir $_lang 43 | bsdtar -xf ${_prefix}-${_lang}_${_pkgver}_all.deb 44 | mv control.tar.gz data.tar.xz debian-binary $_lang/ 45 | done 46 | } 47 | 48 | package_wpsoffice-de() { 49 | pkgdesc='German language pack for WPS Office.' 50 | 51 | cd "${srcdir}" 52 | tar xv -C "${pkgdir}" -f de/data.tar.xz 53 | } 54 | 55 | package_wpsoffice-fr() { 56 | pkgdesc='French language pack for WPS Office.' 57 | 58 | cd "${srcdir}" 59 | tar xv -C "${pkgdir}" -f fr/data.tar.xz 60 | } 61 | 62 | package_wpsoffice-fr-ca() { 63 | pkgdesc='French(Canada) language pack for WPS Office.' 64 | 65 | cd "${srcdir}" 66 | tar xv -C "${pkgdir}" -f fr-ca/data.tar.xz 67 | } 68 | 69 | package_wpsoffice-ja-jp() { 70 | pkgdesc='Japanese language pack for WPS Office.' 71 | 72 | cd "${srcdir}" 73 | tar xv -C "${pkgdir}" -f ja-jp/data.tar.xz 74 | } 75 | 76 | package_wpsoffice-zh-cn() { 77 | pkgdesc='Chinese (simplified) language pack for WPS Office.' 78 | 79 | cd "${srcdir}" 80 | tar xv -C "${pkgdir}" -f zh-cn/data.tar.xz 81 | } 82 | package_wpsoffice-zh-tw() { 83 | pkgdesc='Chinese (traditional) language pack for WPS Office.' 84 | 85 | cd "${srcdir}" 86 | tar xv -C "${pkgdir}" -f zh-tw/data.tar.xz 87 | } 88 | -------------------------------------------------------------------------------- /xdpi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2022 shmilee 5 | 6 | import subprocess 7 | import shlex 8 | import re 9 | 10 | # monitors number N 11 | NPAT = re.compile(r'Monitors:\s*(?P\d+?)') 12 | # monitors WxH(resolution), wxh(physical), X+Y(resolution) 13 | # eg: 3840/1220x2160/690+1366+0 14 | WHwhXY = r'(?P\d+?)/(?P\d+?)x(?P\d+?)/(?P\d+?)\+(?P\d+?)\+(?P\d+?)' 15 | # monitors i(index), p(primary), n1(name), n2(name) 16 | MPAT = re.compile( 17 | r'\s*(?P\d+?):\s*(\+){0,1}(?P

\*){0,1}(?P\w+)\s*' + WHwhXY + r'\s*(?P\w+)$') 18 | 19 | 20 | class Monitors(object): 21 | ''' 22 | List monitor's infor. 23 | ''' 24 | 25 | def __init__(self, xrandr=None): 26 | self.xrandr = xrandr or "xrandr" 27 | self.cmd = shlex.split(self.xrandr + " --listmonitors") 28 | self.info = self.parse(self.output) 29 | 30 | def update(self): 31 | self.info = self.parse(self.output) 32 | 33 | @property 34 | def output(self): 35 | return subprocess.check_output(self.cmd).decode("utf-8") 36 | 37 | def parse(self, output): 38 | ''' 39 | output like this: 40 | Monitors: 2 41 | 0: +*eDP1 1366/310x768/170+0+0 eDP1 42 | 1: +HDMI1 3840/1220x2160/690+1366+0 HDMI1 43 | ''' 44 | res = {} 45 | outputs = output.split('\n') 46 | m = re.match(NPAT, outputs[0]) 47 | if m: 48 | N = int(m.groupdict()['N']) 49 | res['N'] = N 50 | else: 51 | N = 0 52 | res['highW>1920'] = [] 53 | res['lowDPI<96'] = [] 54 | for line in outputs[1:N+1]: 55 | m = re.match(MPAT, line) 56 | if m: 57 | gd = m.groupdict() 58 | NAME = 'm' + gd['i'] 59 | if gd['p']: 60 | res['primary'] = NAME 61 | W = int(gd['W']) 62 | if W > 1920: 63 | res['highW>1920'].append((NAME, round(W/1920, 2))) 64 | H = int(gd['H']) 65 | w = int(gd['w']) 66 | h = int(gd['h']) 67 | dpix = round(W/(w/10/2.54), 2) 68 | dpiy = round(H/(h/10/2.54), 2) 69 | DPI = round((W**2+H**2)**0.5/((w**2+h**2)**0.5/10/2.54), 2) 70 | if DPI < 96: 71 | res['lowDPI<96'].append((NAME, round(96/DPI, 2))) 72 | res[NAME] = dict( 73 | index=int(gd['i']), 74 | name1=gd['n1'], 75 | name2=gd['n2'], 76 | W=W, H=H, 77 | w=w, h=h, 78 | X=int(gd['X']), 79 | Y=int(gd['Y']), 80 | dpix=dpix, dpiy=dpiy, DPI=DPI, 81 | ) 82 | return res 83 | 84 | 85 | # TODO: https://blog.summercat.com/configuring-mixed-dpi-monitors-with-xrandr.html 86 | if __name__ == '__main__': 87 | import pprint 88 | M = Monitors() 89 | pprint.pprint(M.parse(M.output)) 90 | -------------------------------------------------------------------------------- /you-get/iqiyi.md: -------------------------------------------------------------------------------- 1 | 1 None tvid 2 | =========== 3 | 4 | error: 5 | ```shell 6 | File "/usr/lib/python3.10/site-packages/you_get/extractors/iqiyi.py", line 139, in prepare 7 | info_u = 'http://pcw-api.iqiyi.com/video/video/playervideoinfo?tvid=' + tvid 8 | TypeError: can only concatenate str (not "NoneType") to str 9 | ``` 10 | 11 | debug: 12 | ```python 13 | from you_get.common import r1, get_html, matchall 14 | 15 | html = get_html('https://www.iqiyi.com/v_19rrnojxs8.html') 16 | # "tvid":355406500 "vid":"f7b856423aa11ffb68590d516d028074" 17 | matchall(html,[r'(.{10}355406500.{10})']) 18 | matchall(html,[r'(.{10}f7b856423aa11ffb68590d516d028074.{10})']) 19 | ``` 20 | 21 | fix: 22 | ```python 23 | tvid = r1(r'#curid=(.+)_', self.url) or \ 24 | r1(r'tvid=([^&]+)', self.url) or \ 25 | r1(r'data-player-tvid="([^"]+)"', html) or r1(r'tv(?:i|I)d=(.+?)\&', html) or r1(r'param\[\'tvid\'\]\s*=\s*"(.+?)"', html) or \ 26 | r1(r'"tvid"\s*:\s*(\d+?),', html) 27 | videoid = r1(r'#curid=.+_(.*)$', self.url) or \ 28 | r1(r'vid=([^&]+)', self.url) or \ 29 | r1(r'data-player-videoid="([^"]+)"', html) or r1(r'vid=(.+?)\&', html) or r1(r'param\[\'vid\'\]\s*=\s*"(.+?)"', html) or \ 30 | r1(r'"vid"\s*:\s*"(.+?)",', html) or r1(r'vid="(.+?)";', html) 31 | ``` 32 | 33 | 34 | 2 cookie headers, HTTP Error 400: Bad Request 35 | ============================================= 36 | 37 | error: 38 | ``` 39 | you-get -c ~/.mozilla/firefox/xxx/cookies.sqlite https://www.iqiyi.com/v_t93ogo9gbc.html --debug 40 | 41 | [DEBUG] get_content: http://pcw-api.iqiyi.com/video/video/playervideoinfo?tvid=3091246365554100 42 | [DEBUG] HTTP Error with code400 43 | ........... 44 | File "/usr/lib/python3.10/site-packages/you_get/extractors/iqiyi.py", line 142, in prepare 45 | json_res = get_content(info_u) 46 | File "/usr/lib/python3.10/site-packages/you_get/common.py", line 474, in get_content 47 | response = urlopen_with_retry(req) 48 | .......... 49 | File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default 50 | raise HTTPError(req.full_url, code, msg, hdrs, fp) 51 | urllib.error.HTTPError: HTTP Error 400: Bad Request 52 | ``` 53 | 54 | debug: 55 | ``` 56 | for cookie in list(cookies): 57 | cookie_strings.append(cookie.name + '=' + cookie.value) 58 | cookie_headers = {'Cookie': '; '.join(cookie_strings)} 59 | req.headers.update(cookie_headers) 60 | ``` 61 | 62 | fix: 63 | ``` 64 | TODO 65 | ``` 66 | -------------------------------------------------------------------------------- /儿童动画/make-list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2020 shmilee 5 | 6 | import urllib.parse 7 | 8 | video_dir = ( 9 | #'巴巴爸爸.Barbapapa' 10 | #'巴塔木流行儿歌' 11 | #'巴塔木童谣' 12 | #'巴塔木ABC' 13 | #'超级宝贝JOJO' 14 | '海底小纵队' 15 | #'小猪佩奇' 16 | ) 17 | vlc_list = 'shmilee.m3u8' 18 | 19 | 20 | def decode(s): 21 | return urllib.parse.unquote(s, encoding='utf-8', errors='replace') 22 | 23 | with open('./%s/%s' % (video_dir, vlc_list), 'r') as fin: 24 | new_lines = [ 25 | s if s.startswith('#EXT') else '%s/%s' % (video_dir, decode(s)) 26 | for s in fin.readlines() 27 | ] 28 | with open('./%s.m3u8' % video_dir,'w') as out: 29 | for l in new_lines: 30 | out.write(l) 31 | -------------------------------------------------------------------------------- /儿童动画/小猪佩奇.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/小猪佩奇.tar.gz -------------------------------------------------------------------------------- /儿童动画/巴塔木ABC.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/巴塔木ABC.tar.gz -------------------------------------------------------------------------------- /儿童动画/巴塔木流行儿歌.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/巴塔木流行儿歌.tar.gz -------------------------------------------------------------------------------- /儿童动画/巴塔木童谣.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/巴塔木童谣.tar.gz -------------------------------------------------------------------------------- /儿童动画/汪汪队立大功/src/2021: -------------------------------------------------------------------------------- 1 | https://www.olevod.com/index.php/vod/play/id/31566/sid/1/nid/1.html 2 | 3 | URL='https://europe.olemovienews.com/hlstimeofffmp4/20211117/ekiGwgui/mp4/ekiGwgui.mp4/index-v1-a1.m3u8' 4 | 5 | 6 | mpv $URL 7 | 8 | [ffmpeg] https: HTTP error 502 Cannot find server. 9 | [ffmpeg/demuxer] hls: Failed to open an initialization section in playlist 0 10 | 11 | [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: could not find corresponding trex (id 1) 12 | [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: could not find corresponding track id 0 13 | [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: trun track id unknown, no tfhd was found 14 | 15 | ffmpeg -i $URL out.mp4 16 | 17 | [https @ 0x55920b3ab6c0] HTTP error 502 Cannot find server. 18 | [hls @ 0x55920afe1940] Failed to open an initialization section in playlist 0 19 | 20 | 21 | FIX: 22 | 23 | m3u8 EXT-X-MAP ffmpeg 24 | 25 | ffmpeg Range header download m3u8 seekable 26 | 27 | """ 28 | mpv --demuxer-lavf-o-append=http_seekable=0 $URL 29 | ffmpeg -http_seekable 0 -i $URL out.mp4 30 | """ 31 | -------------------------------------------------------------------------------- /儿童动画/海底小纵队/21799: -------------------------------------------------------------------------------- 1 | https://vip1.lz-cdn1.com/20230814/21799_1dcc557b/2000k/hls/mixed.m3u8 2 | -------------------------------------------------------------------------------- /儿童动画/海底小纵队/2211: -------------------------------------------------------------------------------- 1 | https://vip.lz-cdn10.com/20220812/2211_e34412e7/1200k/hls/index.m3u8 2 | -------------------------------------------------------------------------------- /儿童动画/海底小纵队/5416: -------------------------------------------------------------------------------- 1 | https://vip.lz-cdn1.com/20220512/5416_5bc7d68a/1200k/hls/index.m3u8 2 | https://vip1.lz-cdn1.com/20220512/5416_5bc7d68a/1200k/hls/mixed.m3u8 3 | -------------------------------------------------------------------------------- /儿童动画/海底小纵队/src/read_1_6.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | src=${1:-"第1季.html.gz"} 4 | season=${src%.*} 5 | cmd="you-get %s -O 海底小纵队-${season}-%s" # rm .mp4? 6 | 7 | n=1 8 | zcat $src | sed -n "/href=.*html/p" | while read line; do 9 | url=$(echo $line | sed "s|.*href=\"\(https://.*.html\)\".*title=.*|\1|g") 10 | if [[ x$url == x ]]; then 11 | echo "-----------> $line No url <----------" 12 | continue 13 | fi 14 | echo "==> 第$n集 url: $url" 15 | title=$(echo $line | sed "s|.*\" title=\"\(.*\)\" dt-eid=.*|\1|g") 16 | if [[ x$title == x ]]; then 17 | title="第$n集" 18 | echo "-----------> 第$n集 title: 出错 <----------" 19 | else 20 | if [[ $n -ge 10 ]]; then 21 | sn=$n 22 | else 23 | sn="0$n" 24 | fi 25 | # 5-6-特别 26 | if echo $title | grep "第$sn话" >/dev/null; then 27 | title=$(echo $title | sed -e "s/第$sn话//" -e 's/^[ ]*//') 28 | elif echo $title | grep "海底小纵队特别篇" >/dev/null; then 29 | title=$(echo $title | sed -e "s/海底小纵队特别篇$n://") 30 | fi 31 | if [[ x$title == x"海底小纵队第五季" ]]; then 32 | title="第$n集" 33 | else 34 | title="第$n集-$title" 35 | fi 36 | echo "==> 第$n集 title: $title" 37 | fi 38 | n=$((n+1)) 39 | torun="$(printf "$cmd\n" "$url" "$title")" 40 | echo $torun 41 | $torun 42 | #break 43 | done 44 | -------------------------------------------------------------------------------- /儿童动画/海底小纵队/src/特别篇.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/特别篇.html.gz -------------------------------------------------------------------------------- /儿童动画/海底小纵队/src/第1季.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第1季.html.gz -------------------------------------------------------------------------------- /儿童动画/海底小纵队/src/第2季.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第2季.html.gz -------------------------------------------------------------------------------- /儿童动画/海底小纵队/src/第3季.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第3季.html.gz -------------------------------------------------------------------------------- /儿童动画/海底小纵队/src/第4季.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第4季.html.gz -------------------------------------------------------------------------------- /儿童动画/海底小纵队/src/第5季.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第5季.html.gz -------------------------------------------------------------------------------- /儿童动画/海底小纵队/src/第6季.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第6季.html.gz -------------------------------------------------------------------------------- /儿童动画/超级宝贝JOJO.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/超级宝贝JOJO.tar.gz -------------------------------------------------------------------------------- /儿童动画/迷你小洞/read_1_3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | src=${1:-"迷你小洞-第一季.gz"} 4 | season=${src%.*} 5 | cmd="you-get %s -O ${season}-%s.mp4" 6 | ##m3u8="${season}.m3u8" 7 | ##echo "#EXTM3U" > $m3u8 8 | youmpvlist="${season}.txt" 9 | echo -n > $youmpvlist 10 | 11 | n=1 12 | zcat $src | sed 's||\n|g' | sed -n "/href=.*html/p" | while read line; do 13 | url=$(echo $line | sed "s|.*href=\"\(//.*.html\)\".*title=.*|\1|g") 14 | if [[ x$url == x ]]; then 15 | echo "-----------> $line No url <----------" 16 | continue 17 | fi 18 | url="https:$url" 19 | echo "==> 第$n集 url: $url" 20 | title=$(echo $line | sed "s|.*\" title=\"\(.*\)\" class=\"album.*|\1|g") 21 | if [[ x$title == x ]]; then 22 | title="第$n集" 23 | echo "-----------> 第$n集 title: 出错 <----------" 24 | fi 25 | ##echo "#EXTINF:$n, $title" >> $m3u8 26 | ##echo "$url" >> $m3u8 27 | echo "$url" >> $youmpvlist 28 | n=$((n+1)) 29 | torun="$(printf "$cmd\n" "$url" "$title")" 30 | echo $torun 31 | #$torun 32 | #break 33 | done 34 | -------------------------------------------------------------------------------- /儿童动画/迷你小洞/you-mpv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2023 shmilee 3 | 4 | cat $1 | while read url; do 5 | echo $url 6 | you-get -p mpv $url 7 | done 8 | -------------------------------------------------------------------------------- /儿童动画/迷你小洞/迷你小洞-玩创造.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/迷你小洞/迷你小洞-玩创造.gz -------------------------------------------------------------------------------- /儿童动画/迷你小洞/迷你小洞-第一季.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/迷你小洞/迷你小洞-第一季.gz -------------------------------------------------------------------------------- /儿童动画/迷你小洞/迷你小洞-第三季.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/迷你小洞/迷你小洞-第三季.gz -------------------------------------------------------------------------------- /儿童动画/迷你小洞/迷你小洞-第二季.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/迷你小洞/迷你小洞-第二季.gz --------------------------------------------------------------------------------