Skip to content

Instantly share code, notes, and snippets.

View lxneng's full-sized avatar
🎯
Focusing

Eric Luo lxneng

🎯
Focusing
View GitHub Profile
:w sudo su tee %
ssh user@host 'mkdir ~/.ssh;echo '`cat ~/.ssh/id_dsa.pub`' >> ~/.ssh/authorized_keys'
def require_login(func):
def require_login_wrapper(self):
self.user = users.get_current_user()
if self.user is None:
self.redirect(users.create_login_url(self.request.path_info +
'?' + self.request.query_string))
return
func(self)
return require_login_wrapper
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
../bin/python setup.py deploy
bin/paster create -t pyramid_routesalchemy pyramid001
@lxneng
lxneng / gist:780859
Created January 15, 2011 11:47
倒计时
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>倒计时</title>
<script type="text/javascript">
// Default settings: 5 minutes, warning at 1 minute
var count = 5 * 60;
var warning = 60;
function $(id){ return document.getElementById(id)}
## {{{ http://code.activestate.com/recipes/440627/ (r1)
'''code_module.py
The purpose of this module
is to provide functions
for the coding of strings.
This is a level 1 module.'''
#==================================
在genshi中的表达式中需要用html转义字符&gt; &lt;表示大于和小于符号
例如
<br py:if="len(items) &lt; 4" class="clear" />
@lxneng
lxneng / gist:743034
Created December 16, 2010 04:32
brew install python2.6
require 'formula'
<<-COMMENTS
Versions
--------
This formula is currently tracking version 2.6.x.
Python 3.x is available as a separate formula:
brew install python3