Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🚀
:-o

oldj oldj

👨‍🚀
:-o
View GitHub Profile
@oldj
oldj / big_file_download.py
Last active Aug 29, 2015
在Django中提供大内容(或大文件)下载
View big_file_download.py
def bigFileView(request):
u"""在Django中提供大内容(或大文件)下载
@see http://oldj.net/article/django-big-file-response/
"""
# do something...
def readFile(fn, buf_size=262144):
f = open(fn, "rb")
while True:
c = f.read(buf_size)
View text_to_image.py
# -*- coding: utf-8 -*-
#
# Author: oldj
# Email: oldj.wu@gmail.com
# Blog: http://oldj.net
#
import os
import re
import StringIO
@oldj
oldj / gbk.js
Created Jan 6, 2015
GBK转码
View gbk.js
/**//**//**//**//**//**//*
** ==================================================================================================
** 类名:J.gbk
** 版本:1.0
** 功能:URLEncode,URLDecode
** 示例:
---------------------------------------------------------------------------------------------------
用法:参见组件地址
@oldj
oldj / get_ip_address.py
Created Jan 6, 2015
取得IP地址及主机名
View get_ip_address.py
import socket
name = socket.gethostname()
ip_addr = socket.gethostbyname(name)
print name
print ip_addr