Skip to content

Instantly share code, notes, and snippets.

Avatar

Lix Zhou pansila

View GitHub Profile
@pansila
pansila / cnn_10_maker.py
Last active May 22, 2021
Download srt and video file from CNN offical website for subs2srs to make Anki cards.
View cnn_10_maker.py
import os
import sys
import argparse
import requests
import shutil
from bs4 import BeautifulSoup
from urllib.parse import urlparse
from vtt_to_srt import vtt_to_srt
OUTPUT_DIR = 'output'
@pansila
pansila / format_srt.py
Last active Jun 30, 2020
格式化并合并多个子句到一个整句。需要安装python3,运行方式:`python format_srt.py your_srt_file.srt`
View format_srt.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
OUT_FILE = 'output.srt'
def run(srt_file):
LineList = []
timestamp_line = False
with open(srt_file, 'r',encoding="utf-8") as srtfile:
@pansila
pansila / cull_cpplint_violation.py
Created May 8, 2019
cull the interested cpplint violations from the complete report
View cull_cpplint_violation.py
#!/usr/bin/python
import sys, os
from sys import argv
from unidiff import PatchSet
import subprocess
def parse_log_line(line):
"""
parse a line from the cpplint results with --output=vs7
@pansila
pansila / suzhou_bus.py
Created May 8, 2019
query bus status of city Suzhou
View suzhou_bus.py
import requests
import time
import math
def query_traffic(line):
payload = {'Guid': '24fce9ce-f441-45c5-99e1-bc6b40661f1e',
'city_id': '320500',
'deviceId': 'd049666ff7e010318f0cdc2c75d95ff0',
'sign': '539f272911d2bb23117ea6211cce1bb5',
'client_id': '320500',
@pansila
pansila / BingWallpaper.py
Last active May 6, 2019
Another Bing Wallpaper python script, works on Windows 10, You can run it manually or automatically by Task Scheduler of Windows, adding the appropriate triggers, like "At log on", "At startup", "On workstation unlock", etc.
View BingWallpaper.py
#-*- coding: UTF-8 -*-
import os
import sys
import time
import urllib.request
import urllib.error
import ctypes
import logging
import socket
import argparse
@pansila
pansila / my_configs.vim
Created Apr 15, 2019
my VIM config file
View my_configs.vim
scriptencoding utf-8
set tabstop=4 " 设置制表符(tab键)的宽度
set softtabstop=4 " 设置软制表符的宽度
set shiftwidth=4 " (自动) 缩进使用的8个空格
set cindent " 使用 C/C++ 语言的自动缩进方式
set cinoptions={0,1s,t0,p2s,(03s,=.5s,>1s,=1s,:1s "设置C/C++语言的具体缩进方式
" set backspace=2 " 设置退格键可用
set undofile " Persistent undo even through restart
set undodir=$HOME/.vim/undo
@pansila
pansila / onmp.sh
Last active May 2, 2021
onmp.sh (openwrt nginx mysql php)
View onmp.sh
#!/bin/sh
# @Author: xzhih
# @Date: 2017-07-29 06:10:54
# @Last Modified by: xzhih
# @Last Modified time: 2018-10-08 13:49:26
# 软件包列表
# remove sed as it's already part of busybox
# replace nginx-extras with nginx as nginx-extras can't be found as of openwrt 18.06.02
pkglist="wget unzip grep tar ca-certificates coreutils-whoami php7 php7-cgi php7-cli php7-fastcgi php7-fpm php7-mod-mysqli php7-mod-pdo php7-mod-pdo-mysql nginx mariadb-server mariadb-server-extra mariadb-client mariadb-client-extra"
@pansila
pansila / xilinx-xc6v.cfg
Created Jan 28, 2019
bitfile download configuration for openocd
View xilinx-xc6v.cfg
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME xc6v
}
set XC6_CFG_IN 0x05
set XC6_JSHUTDOWN 0x0d
set XC6_JPROGRAM 0x0b
set XC6_JSTART 0x0c
@pansila
pansila / README.md
Last active Dec 14, 2018
An enhanced patch to enable support of markdown for robotframework
View README.md
@pansila
pansila / c-macro-comment.py
Created Sep 11, 2018
Add comments to mark the start and stop position of C macro directives, including ifdef, else, endif, etc., to make them more legible
View c-macro-comment.py
#!/bin/python
import sys, os
import argparse
class macro_directive(object):
def __init__(self, name, comment):
self.name = name[1:] if name[0] == "#" else name
self.comment = comment
self.path = True