Skip to content

Instantly share code, notes, and snippets.

View xdqi's full-sized avatar

Alexander Qi xdqi

  • 10:45 (UTC +08:00)
View GitHub Profile
@xdqi
xdqi / chinesetest.cmd
Created December 22, 2013 07:57
A simple Chinese level test.
@echo off
setlocal enabledelayedexpansion
REM 加载模块
for /f "delims=[]" %%i in ('find /n "pronounceT" ti.ini') do set pt=%%i
for /f "delims=[]" %%i in ('find /n "pronounceF" ti.ini') do set pf=%%i
for /f "delims=[]" %%i in ('find /n "spellT" ti.ini') do set st=%%i
for /f "delims=[]" %%i in ('find /n "spellF" ti.ini') do set sf=%%i
for /f "delims=[]" %%i in ('find /n "idiomT" ti.ini') do set it=%%i
for /f "delims=[]" %%i in ('find /n "idiomF" ti.ini') do set if=%%i
for /f "delims=[]" %%i in ('find /n "punctuationT" ti.ini') do set bt=%%i
@xdqi
xdqi / forceinstcrext.reg
Created December 22, 2013 08:00
Force Install Chrome/Chromium Extension
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist]
"1"="ldcecbkkoecffmfljeihcmifjjdoepkn;https://adblockplus.org/devbuilds/adblockpluschrome/updates.xml"
;在 Chrome 政策中加入强制安装拓展项目
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Chromium\ExtensionInstallForcelist]
"1"="ldcecbkkoecffmfljeihcmifjjdoepkn;https://adblockplus.org/devbuilds/adblockpluschrome/updates.xml"
;在 Chromium 政策中加入强制安装拓展项目
@xdqi
xdqi / Notify.py
Created February 10, 2015 08:53
Implement minimum python-notify2 API using pync
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
# WeCase -- This file implemented Notify.
# Copyright (C) 2013, 2014, 2015 The WeCase Developers.
# License: GPL v3 or later.
from PyQt4 import QtCore
import path
@xdqi
xdqi / getktxp.py
Created April 1, 2014 05:21
Print all magnet links on a KTXP search page
#!/usr/bin/env python
# Using: getktxp.py [KTXP Search Page URL]
# TODO:
# 1. Merge it with lixian-cli
# 2. Support Multi Pages (I did not implement that because typical anime series has less than 30 episodes)
import sys
from bs4 import BeautifulSoup
import requests
import urllib
@xdqi
xdqi / voteanalytics.py
Last active March 18, 2016 20:38
An analytics of an election of chrome ba (Jan 25, 2014) in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import requests
from bs4 import BeautifulSoup
import re
# 声明变量
PAGE = 'http://wapp.baidu.com/p/2833065220'
@xdqi
xdqi / m2py-compatible.py
Created January 22, 2014 08:17
Make AES-256-CFB of pycrypto and M2Crypto compatible
from hashlib import sha256
from Crypto.Cipher import AES
from Crypto import Random
from base64 import *
import os
import M2Crypto
default_passphrase = 'test'
def kec(str_data, str_key=default_passphrase):
@xdqi
xdqi / guess_8q_name.py
Last active March 18, 2016 20:39
Guess xiaoxiao's chinese name
import itertools
l = ['li', 'lu', 'lin', 'lun', 'liu']
x = ['xi', 'xin', 'xun', 'xiu']
y = ['yi', 'yu', 'yin', 'yun']
for i in list(itertools.product(l, x, y)):
random_name = ''.join(i)
if len(random_name) == 8:
@xdqi
xdqi / delanything.cmd
Created December 22, 2013 07:59
ultimate file deleter on Windows
del "\\?\%~1" /f /s /q
rd "\\?\%~1" /s /q
@xdqi
xdqi / chromiumupdater.cmd
Created December 22, 2013 07:54
A simple update of Chromium
@echo off
::注意:Vista、Win7、Win8 请用管理员运行此程序
echo Loading...
del LAST_CHANGE /f /s /q
del install.exe /f /s /q
wget "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/LAST_CHANGE" -OLAST_CHANGE
for /f %%i in (LAST_CHANGE) do set newver=%%i
del LAST_CHANGE /f /s /q
cls
echo,
#!/usr/bin/env python
# -*- coding=utf-8 -*-
# 哔哩哔哩历史弹幕 (XML) 下载器
# 使用:downdanmu.py av314
import StringIO
import datetime
import gzip
import json
import os