Skip to content

Instantly share code, notes, and snippets.

View hiczlf's full-sized avatar
🏠
Working from home

hiczlf hiczlf

🏠
Working from home
View GitHub Profile
@dbrgn
dbrgn / queryset_generators.py
Created April 1, 2011 08:41
queryset_generator and queryset_list_generator
def queryset_generator(queryset, chunksize=1000):
"""
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in its
memory at the same time while django normally would load all rows in its
memory. Using the iterator() method only causes it to not preload all the
classes.
Note that the implementation of the generator does not support ordered query sets.
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@zmmbreeze
zmmbreeze / addChineseUnit.js
Last active December 31, 2021 02:45
为数字加上单位:万或亿
/**
* 为数字加上单位:万或亿
*
* 例如:
* 1000.01 => 1000.01
* 10000 => 1万
* 99000 => 9.9万
* 566000 => 56.6万
* 5660000 => 566万
* 44440000 => 4444万