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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Breif Module Description: show the number of published news every day | |
# Created on Wednesday, 11 November 2015. | |
import datetime | |
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt |
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
[QUESTION] Reloading submodules in IPython | |
[ANSWER] | |
IPython comes with some automatic reloading magic: | |
%load_ext autoreload | |
%autoreload 2 | |
It will reload all changed modules every time before executing a new line. The way this works is slightly different than dreload. Some caveats apply, type %autoreload? to see what can go wrong. |
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 -*- | |
import time | |
def timestamp_datetime(value): | |
format = '%Y-%m-%d %H:%M:%S' | |
# value为传入的值为时间戳(整形),如:1332888820 | |
value = time.localtime(value) | |
## 经过localtime转换后变成 | |
## time.struct_time(tm_year=2012, tm_mon=3, tm_mday=28, tm_hour=6, tm_min=53, tm_sec=40, tm_wday=2, tm_yday=88, tm_isdst=0) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" /> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black"> | |
<meta name="format-detection" content="telephone=no"> |
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
##### ======= | |
--prefix=/usr \ | |
--localstatedir=/var \ | |
--libexecdir=${prefix}/lib/squid3 \ | |
--datadir=${prefix}/share/squid3 \ | |
--sysconfdir=/etc/squid3 \ |
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
javascript:function iprl5(){var d=document;z=d.createElement('script');b=d.body;l=d.location;ji_url=window.location.protocol+'//jiji.io/ji?url='+encodeURIComponent(l)+'&title='+d.title;console.log(l.hostname);if(l.hostname=='twitter.com'||l.hostname=='zhihu.com'||l.hostname=='quora.com'||l.hostname=='github.com'){window.open(ji_url);}else{try{if(!b)throw(0);if(!l){alert('%E8%AF%B7%E8%BE%93%E5%85%A5%E7%BD%91%E5%9D%80%EF%BC%81');return;}d.title='(%E9%9B%86%E9%9B%86ing...) '+d.title;z.setAttribute('src',ji_url);b.appendChild(z);}catch(e){alert('%E8%AF%B7%E7%AD%89%E5%BE%85%E7%BD%91%E9%A1%B5%E5%8A%A0%E8%BD%BD%E5%AE%8C%E6%AF%95%EF%BC%81');}}}iprl5();void(0) | |
javascript:function iprl5(){var d=document;z=d.createElement('script');b=d.body;l=d.location;ji_url=window.location.protocol+'//jiji.io/ji?url='+encodeURIComponent(l);console.log(l.hostname);if(l.hostname=='twitter.com'||l.hostname=='zhihu.com'||l.hostname=='quora.com'||l.hostname=='github.com'){window.open(ji_url);}else{try{if(!b)throw(0);if(!l){alert('%E8%A |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title></title> | |
<style type="text/css"> | |
#box{position: relative; width: 200px; height: 50px; border: 1px solid #eee; margin: 50px auto 0;} | |
#bg{height: 10px; margin-top: 19px; border: 1px solid #ddd; border-radius: 5px; overflow: hidden;} | |
#bgcolor{background: #5889B2; width: 0; height: 10px; border-radius: 5px;} | |
#bt{width: 34px; height: 34px; background: url(http://bbs.blueidea.com/data/attachment/album/201505/22/192934pwywwrt8cbrfwzfh.png) no-repeat center center; border-radius: 17px; overflow: hidden; position: absolute; left: 0px; margin-left: -17px; top: 8px; cursor: pointer;} |
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
// 将图片资源显示到页面中 | |
function showImage(imageData) { | |
var reader = new FileReader(); | |
reader.onload = function(e){ | |
var img = new Image(); | |
img.src = e.target.result; | |
document.body.appendChild(img); | |
}; | |
// 读取图片文件 | |
reader.readAsDataURL(imageData); |
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 socket | |
import sys | |
import random | |
from struct import pack | |
from struct import unpack | |
ROOMID = 58879 | |
HOST, PORT = "dm.live.bilibili.com", 788 | |
data = " ".join(sys.argv[1:]) | |
_protocolversion = 1 |
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
周末没有计划或者安排就是空过。 |