Skip to content

Instantly share code, notes, and snippets.

View node's full-sized avatar
🎨
Focus on open source & platform !

Chris (Gentle) Y杨 node

🎨
Focus on open source & platform !
View GitHub Profile
@node
node / Chrome 模拟 手机浏览器做测试
Created December 9, 2011 08:19
Chrome 模拟 手机浏览器做测试
内容来自 http://blog.s135.com/chrome_phone/
谷歌Chrome浏览器,可以很方便地用来当3G手机模拟器。在Windows的【开始】-->【运行】中输入以下命令,启动谷歌浏览器,即可模拟相应手机的浏览器去访问3G手机网页:
  谷歌Android:
chrome.exe --user-agent="Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
  苹果iPhone:
chrome.exe --user-agent="Mozilla/5.0 (iPad; U; CPU OS 3_2_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B500 Safari/531.21.10"
@node
node / linux tips & hacks
Last active December 28, 2016 09:56
utility
- 下载整站
> wget -r -p -np -k http://xxoo.com
注释: -r 递归, -p 下载网页关联的其他资源,-np 不搜索上层目录, -k 绝对链接转为相对链接
其他参数:
  ◆-b:后台下载,Wget默认的是把文件下载到当前目录。
  ◆-O:将文件下载到指定的目录中。
  ◆-P:保存文件之前先创建指定名称的目录。
  ◆-t:尝试连接次数,当Wget无法与服务器建立连接时,尝试连接多少次。
  ◆-c:断点续传,如果下载中断,那么连接恢复时会从上次断点开始下载。
@node
node / twisted-helloworld.txt
Created November 24, 2011 07:02
Getting start with twisted
1 Visit http://twistedmatrix.com to learn twisted
2 Visit http://twistedmatrix.com/trac/wiki/Downloads to download twisted and zope.interface (required on windows)
3 Setup twisted and zope.interface( need setuptoools/easy_isntall, download by http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11.win32-py2.6.exe#md5=1509752c3c2e64b5d0f9589aafe053dc)
4 Run example code from twisted website:
- Easy Custom Servers and Clients
@node
node / google-404.html
Created November 24, 2011 06:20
use image BASE64 in css
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAADVCAMAAAAfHvCaAAAAGFBMVEVYn%2BH%2F%2F%2F%2Bex%2B3U5vd7s%2Bfq8%2Fs0itq72PMLUPvtAAASvklEQVR4AbXBC0JqCQxEwT5Jd7L%2FHc8FdR4g%2BEGtEr8u%2FBHxu7otdzd%2FQPyqlmRp1Pw%2B8aukDfRa1fw28ZtWy4sa89vEb7LCi0zx28RvqgkvouW3id%2FU8pbtWmv5beJXRWNrRmp%2BnfhlHXZm%2BQPi95Vk%2FoD4fZbMHxC%2FryTzB8Tva435A%2BL3rcb8AfH7VjJ%2FQPy%2BHYk%2FIH5facwfEL8iaZcrnKyn%2BAPi57K2VL2WF1hJ%2FAHxQ2tJrg6HteXVjPkD4ge6V3J1%2BF97zhx%2BnXhWb8nacKXlnYPErxNPyfqw4ZYKVuUZdfhd4hmxunY73NICgfWMOvwm8ZQ1pMvlDZdaCic98kjV4beIp8ScpLvsSvhflzqQmqVLB281v0E8pc2bdNne8EayNTPNSbt02PBj4intcKltb%2FNibY%2BLf9aSO%2FyMeMo6XMva3g0vwrWsxvyMeEoc3knZ2g53ZaXa8DzxlHa4J23Jae5aycXTxFPa4WRdXAtdsivckZXG4TniKWtOSlre6y7LG651Wxq5OzxDPGUVIKNwX6ekCv%2B0ddglVPMM8ZQ10FJ4LGVvOEuXRl7OqnmGeEor4Ck%2BtnI1ZEvjDa%2FcPEM
@node
node / python-snippets.py
Created November 24, 2011 06:18
Python snippets - Python代码片段
## 通过URL下载图片
import urllib2
open('/tmp/google-logo.gif','wb').write(urllib2.urlopen('http://www.google.com/images/logo_sm.gif').read())
## python profile : cProfile
python -m cProfile xxx.py
python -m timeit xxx.py | python -m timeit -s "code here"
@node
node / 陌生人之间 — 伊蕾
Created April 21, 2011 10:12
文艺程序猿
陌生人之间 — 伊蕾
陌生人,谁能测出你我之间的距离?
这距离或者像欧洲和太平洋,
这距离或者只是不可再分的一层微薄的空间,
也许只需擦亮一根火柴,
两个陌生的世界就可以互相看见,
也许面对面一分钟,
然后就可以跨进那个并不存在的门坎,