Skip to content

Instantly share code, notes, and snippets.

Pang Hootrix

  • China
Block or report user

Report or block Hootrix

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
@Hootrix
Hootrix / fast_read_the_file_in_the_zip.py
Last active Oct 14, 2019
快速读取zip压缩包内的文件 支持在线url以及本地path
View fast_read_the_file_in_the_zip.py
import requests,tempfile, zipfile,os
def read_file_for_zip(zip_url, callback=None):
"""
读取zip包内的文件
:param zip_url:zip路径/url
:param callback:读取操作的回调函数 若函数返回false 则不会读取下一个文件
:return:
"""
with tempfile.TemporaryFile('w+b') as tmpfile: # 生成临时文件
@Hootrix
Hootrix / tianfu.py
Last active Jan 7, 2020
天府市民云APP的消息RSS生成
View tianfu.py
import datetime
import time
import PyRSS2Gen
import requests, pytz
class NoOutput:
def __init__(self):
pass
def publish(self, handler):
@Hootrix
Hootrix / who_data.py
Last active Aug 17, 2019 — forked from HintikkaKimmo/who_data.py
handy way to read csv files with unknown csv dialect
View who_data.py
import csv
import pprint
# opens csv file and assingns it to an object
with open('data-text.csv') as csvfile:
# Use Sniffer to figure out csv dialect
dialect = csv.Sniffer().sniff(csvfile.read(1024))
csvfile.seek(0)
# pass the dialect to filereader to read the file
reader = csv.reader(csvfile, dialect)
@Hootrix
Hootrix / Xizi.php
Last active Aug 17, 2019
推送希子的最新微博到app通知
View Xizi.php
<?php
/**
* Created by PhpStorm.
* User: pang
* Date: 2019/3/22 0022
* Time: 1:11
*
* 使用Bark App的推送url操作
*
*
@Hootrix
Hootrix / mtr.css
Created Mar 21, 2019 — forked from ruanyf/mtr.css
mtr.css: Hong Kong MTR station colors http://metrocolor.live/index.html
View mtr.css
:root {
--heng-fa-chuen: #b51921;
--tai-koo: #b2103e;
--kowloon-bay: #c41832;
--tseung-kwan-o: #ef342a;
--wui-kai-sha: #a84d18;
--po-lam: #f68f26;
--sai-wan-ho: #faca07;
--disneyland-resort: #07594a;
--skek-kip-mei: #4ba946;
View new.js
/*
js 版本的print_r()
Return 参数是用在递归函数里的,判断是alert()还是return
blank 参数是用于输出的样式更易于查看
问题是没有像php的print_r()一样输出多维数组样式
2015年编写 未完善的
*/
function print_r(output, Return) {
function isArray(obj) {
@Hootrix
Hootrix / gist:20245a578b34814193e6b58a71ff36f4
Created Dec 19, 2018 — forked from codler/gist:3906826
Support HTTP Header Range, mp4, php.php/mp4.mp4
View gist:20245a578b34814193e6b58a71ff36f4
<?php
# Nginx don't have PATH_INFO
if (!isset($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = substr($_SERVER["ORIG_SCRIPT_FILENAME"], strlen($_SERVER["SCRIPT_FILENAME"]));
}
$request = substr($_SERVER['PATH_INFO'], 1);
$file = $request;
$fp = @fopen($file, 'rb');
View gist:bf086e3694c66d7d07a3349119dada72
//https://y.gtimg.cn/music/portal/js/common/pkg/common_b40e83e.js?max_age=31536000:formatted

formatMusic: function(e) {
                function t(e) {
                    if (!e)
                        return {};
                    if ("string" == typeof e)
                        try {
                            e = JSON.parse(e)
You can’t perform that action at this time.