This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import zipfile | |
def unzip_files(dir_path): | |
"""解压指定目录下的所有 .livp 文件""" | |
files = os.listdir(dir_path) | |
for file_name in files: | |
if file_name.endswith('.livp'): | |
file_path = os.path.join(dir_path, file_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile 使用北京时间 | |
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone | |
# or | |
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
RUN echo 'Asia/Shanghai' >/etc/timezone | |
# 1、CentOS6、Ubuntu16 | |
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
# 2、CentOS7、RHEL7、Scientific Linux 7、Oracle Linux 7 最好的方法是使用timedatectl命令 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from xml.dom.minidom import parse | |
import xml.dom.minidom | |
import os | |
import datetime | |
def parse_xml(inputFile): | |
domtree = xml.dom.minidom.parse(inputFile) | |
root = domtree.documentElement | |
blog_elements = root.getElementsByTagName("blog") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 导出douban.fm的红星歌曲到网易云音乐 | |
// 具体使用方法见 https://www.zhihu.com/question/34521014/answer/177048898 | |
var a = "\n<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n<List ListName=\"豆瓣红心\">\n"; | |
for(var i in $$(".songlist-song .top")) { | |
a = a | |
+ "<File><FileName>" | |
+ $$(".songlist-song .top")[i].querySelector(".titles p span .artist-name").innerText.replace("&","&") | |
+ "-" | |
+ $$(".songlist-song .top")[i].querySelector(".titles h3 .link").innerText.replace("&","&") | |
+ "</FileName></File>\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding=utf-8 -*- | |
# 修改了原gist里space tab混乱的情况 | |
import feedparser | |
import re | |
import collections | |
import math | |
def info_entropy(words): | |
result = 0 | |
total = sum([val for _, val in words.iteritems()]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
12306 Auto Query => A javascript snippet to help you book tickets online. | |
Copyright (C) 2011 Jingqin Lynn | |
Includes jQuery | |
Copyright 2011, John Resig | |
Dual licensed under the MIT or GPL Version 2 licenses. | |
http://jquery.org/license | |
Includes Sizzle.js |