Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Guixing Bai khsing

🎯
Focusing
Block or report user

Report or block khsing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@khsing
khsing / alt-maven-deps.py
Created Mar 28, 2019
add dependency for maven project
View alt-maven-deps.py
#!/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 Jan 15, 2019
Extract articles from html which downloaded from archive.org
View extract_articles.py
#!/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):
@khsing
khsing / convertImeisv2Imei.py
Created May 8, 2017
Convert IMEI-SV to IMEI
View convertImeisv2Imei.py
# -*- 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):
View app_price_history.js
// ==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 / region.sql
Last active Sep 9, 2015
中国三级县市的数据,数据来自统计局
View region.sql
# ************************************************************
# Sequel Pro SQL dump
# Version 4096
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: localhost (MySQL 5.6.26)
# Database: test
# Generation Time: 2015-09-09 07:27:55 +0000
@khsing
khsing / clean_es.py
Created Dec 17, 2013
using this script to clean old logstash indices in ElasticSearch
View clean_es.py
#!/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 Dec 11, 2013
被QQ通讯录搞花了通讯录的标签,用该脚本修复一下
View fix_phone_labels.py
#!/usr/bin/python
# coding:utf-8
import sys
from AddressBook import *
from pprint import pprint
MAPPING = {
u'工作传真': kABPhoneWorkFAXLabel,
u'住宅传真': kABPhoneHomeFAXLabel,
View ls-es-mapping.json
{
"template" : "logstash*",
"settings" : {
"index.refresh_interval" : "5s",
"analysis" : {
"analyzer" : {
"default" : {
"type" : "standard",
"stopwords" : "_none_"
}
View fix_font_in_osx10.9.sh
#!/sh/bash
cd /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/
for f in DefaultFontFallbacks.plist CTPresetFallbacks.plist;do
plutil -convert xml1 -o - $f| sed 's/STHeitiSC-Light/HiraginoSansGB-W3/g' | sudo plutil -convert binary1 -o $f -
plutil -convert xml1 -o - $f| sed 's/STHeitiSC-Medium/HiraginoSansGB-W6/g' | sudo plutil -convert binary1 -o $f -
done
sudo atsutil databases -remove
View jenkins-build.sh
target=/var/www/html/deploy/package/wordpress-$WP_VERSION.tgz
md5file=$target.md5
tar zcvf $target wordpress-$WP_VERSION
md5sum $target | cut -d\ -f 1 > $md5file
echo $WP_VERSION > /var/www/html/deploy/lastver
You can’t perform that action at this time.