Skip to content

Instantly share code, notes, and snippets.

View khsing's full-sized avatar
🎯
Focusing

Guixing Bai khsing

🎯
Focusing
View GitHub Profile
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Info:
Latest version: http://forums.gentoo.org/viewtopic-p-6183606.html#6183606
xeffects thread: http://forums.gentoo.org/viewtopic-t-511382.html
Alternative: https://wiki.ubuntu.com/Fonts
http://wiki.archlinux.org/index.php/XOrg_Font_Configuration
http://antigrain.com/research/font_rasterization/index.html
@khsing
khsing / parse_chinese_name.py
Created March 3, 2020 13:49
分析中文名字的姓和名
from typing import Dict
# https://zh.wikipedia.org/wiki/%E6%BC%A2%E5%A7%93%E7%BE%85%E9%A6%AC%E5%AD%97%E6%A8%99%E6%B3%A8
CHINESE_SURNAMES = [
"赵",
"钱",
"孙",
"李",
"周",
"吴",
"郑",
@khsing
khsing / parse_chinese_name.py
Created March 3, 2020 13:49
分析中文名字的姓和名
from typing import Dict
# https://zh.wikipedia.org/wiki/%E6%BC%A2%E5%A7%93%E7%BE%85%E9%A6%AC%E5%AD%97%E6%A8%99%E6%B3%A8
CHINESE_SURNAMES = [
"赵",
"钱",
"孙",
"李",
"周",
"吴",
"郑",
@khsing
khsing / geoip_data_path.diff
Created January 8, 2020 04:27
geoip_data_path.diff
diff --git a/infra/conf/router.go b/infra/conf/router.go
index b3870e45..56e71930 100644
--- a/infra/conf/router.go
+++ b/infra/conf/router.go
@@ -1,6 +1,8 @@
package conf
import (
+ "os"
+ "path/filepath"
@khsing
khsing / convertImeisv2Imei.py
Created May 8, 2017 10:40
Convert IMEI-SV to IMEI
# -*- coding: utf-8 -*-
# @Author: khsing
# @Date: 2017-05-08 17:52:55
# @Last Modified by: khsing
# @Last Modified time: 2017-05-08 18:38:08
import sys
import hashlib
def checkImeisv(imeisv):
@khsing
khsing / alt-maven-deps.py
Created March 28, 2019 08:09
add dependency for maven project
#!/usr/bin/env python
from xml.etree import ElementTree as ET
from argparse import ArgumentParser
import os
import sys
ns = "http://maven.apache.org/POM/4.0.0"
ET.register_namespace("", ns)
namespaces = {'pom' : ns}
@khsing
khsing / extract_articles.py
Created January 15, 2019 08:38
Extract articles from html which downloaded from archive.org
#!/usr/bin/env python
# coding: utf-8
import os
import sys
from datetime import datetime
from bs4 import BeautifulSoup,Tag
def find_all_html(path):
for root, dirs, files in os.walk(path):
// ==UserScript==
// @name App Store Price History
// @namespace mybeky
// @author mybeky, khsing
// @include https://itunes.apple.com/*
// @description Add price history table in App Store page
// @icon http://cl.ly/FqTY/appshopper.png
// @version 0.1.2
// @connect *
// @grant GM_xmlhttpRequest
@khsing
khsing / clean_es.py
Created December 17, 2013 08:34
using this script to clean old logstash indices in ElasticSearch
#!/usr/bin/env python
import sys
import json
import httplib
class ElasticSearch(object):
def __init__(self, host="localhost:9200"):
super(ElasticSearch, self).__init__()
if ':' in host:
@khsing
khsing / fix_phone_labels.py
Created December 11, 2013 08:40
被QQ通讯录搞花了通讯录的标签,用该脚本修复一下
#!/usr/bin/python
# coding:utf-8
import sys
from AddressBook import *
from pprint import pprint
MAPPING = {
u'工作传真': kABPhoneWorkFAXLabel,
u'住宅传真': kABPhoneHomeFAXLabel,