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 / 陌生人之间 — 伊蕾
Created April 21, 2011 10:12
文艺程序猿
陌生人之间 — 伊蕾
陌生人,谁能测出你我之间的距离?
这距离或者像欧洲和太平洋,
这距离或者只是不可再分的一层微薄的空间,
也许只需擦亮一根火柴,
两个陌生的世界就可以互相看见,
也许面对面一分钟,
然后就可以跨进那个并不存在的门坎,
@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 / 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 / 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 / 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 / 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 / 关于STUN-TURN-ICE 等协议及其参考实现
Last active November 19, 2015 09:37
About NAT,STUN,TURN,ICE,SIP,XMPP,RTP,TCP,UDP
STUN ======
协议 RFC5389 http://www.ietf.org/rfc/rfc5389.txt
【旧版本】RFC3489 http://www.ietf.org/rfc/rfc3489.txt
实现
Stun4j http://code.google.com/p/babbly/source/browse/trunk/lib/Stun4J.jar, a library
@node
node / python-oauth2-client-by-rauth.py
Created September 21, 2012 02:04
Python Oauth2 Client Demo
from rauth.service import OAuth2Service
import urllib2
#config
app_key='tonr'
app_secret='secret'
authorize_url='http://127.0.0.1:8080/TestSSOauth/oauth/authorize'
access_token_url='http://127.0.0.1:8080/TestSSOauth/oauth/token'
server {
listen 80;
server_name ww.centos.bz;
rewrite ^(.*) https://$server_name$1 permanent;
}
@node
node / learn git in 15 minutes
Created December 24, 2013 01:55
SCM & Tools
参考 http://blog.jobbole.com/53573/
目录:
创建一个远程的空代码库(在BitBucket上或Github上)
在本地代码库添加一个项目
在分支上开发新功能
a) 保留新功能 或者 b) 丢弃它们
也许,回到某个早先的时间点
将本地代码库推送到远程代码库