Skip to content

Instantly share code, notes, and snippets.

View pansila's full-sized avatar

Lix Zhou pansila

View GitHub Profile
@pansila
pansila / my_configs.vim
Created April 15, 2019 07:42
my VIM config file
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 / BingWallpaper.py
Last active June 9, 2023 14:18
Yet another Bing Wallpaper updater, support super resolution. You can run it manually or automatically by Task Scheduler, adding the appropriate triggers, like "At log on", "At startup", "On workstation unlock", etc.
#-*- coding: UTF-8 -*-
import sys
import time
import urllib.request
import urllib.error
import ctypes
import logging
import argparse
import datetime
@pansila
pansila / suzhou_bus.py
Created May 8, 2019 01:28
query bus status of city Suzhou
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 / cull_cpplint_violation.py
Created May 8, 2019 01:30
cull the interested cpplint violations from the complete report
#!/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 / format_srt.py
Last active June 30, 2020 09:08
格式化并合并多个子句到一个整句。需要安装python3,运行方式:`python format_srt.py your_srt_file.srt`
#!/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 / cnn_10_maker.py
Last active May 22, 2021 08:06
Download srt and video file from CNN offical website for subs2srs to make Anki cards.
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 / huorong.json
Created February 9, 2022 13:38
一个火绒的防止流氓软件安装的规则
{
"ver":"5.0",
"tag":"hipsuser",
"data":[
{
"id":54,
"power":1,
"name":"禁垃圾软件",
"procname":"*",
"treatment":3,
@pansila
pansila / list_by_size.py
Created April 16, 2022 14:27
List all Git repository objects by size
import subprocess
from tqdm import tqdm
files = []
commitSHA1 = subprocess.check_output(['git', 'rev-list', '--all'], text=True)
for c in tqdm(commitSHA1.splitlines()):
files.extend(subprocess.check_output(['git', 'ls-tree', '-r', '--long', c], text=True).splitlines())
@pansila
pansila / update_geodb.py
Last active December 29, 2023 12:30
helper to download v2ray daily updated rules
#-*- coding: UTF-8 -*-
import os
import sys
import time
import logging
import socket
import urllib.request
import base64
import hashlib
import tempfile
@pansila
pansila / main.ahk
Created October 3, 2023 11:23
my autohotkey script
#\::{
SendMessage 0x0112, 0xF140, 0, , "Program Manager"
Sleep 1000
SendMessage 0x0112, 0xF170, 2, , "Program Manager"
}
#+p::run "shutdown.exe /r /fw /t 0" ; reboot to bios
#+r::run "explorer.exe ::{645FF040-5081-101B-9F08-00AA002F954E}" ; Recycle bin
#+s::run "explorer.exe shell:startup"