Skip to content

Instantly share code, notes, and snippets.

View lxneng's full-sized avatar
🎯
Focusing

Eric Luo lxneng

🎯
Focusing
View GitHub Profile
@lxneng
lxneng / gist:1046300
Created June 25, 2011 08:44 — forked from makenosound/gist:1046087
bare bones method for grabbing and updating a users latest tweet (with no error handling whatsoever)
$.ajax({
url: 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=someonesplendid',
dataType: 'jsonp',
success: function(data) {
var tweet = data[0].text;
tweet = tweet.replace(/(http\:\/\/[A-Za-z0-9\.\/_]+)/g, '<a href="$1">$1</a>');
tweet = tweet.replace(/@([a-zA-Z0-9_]+)/g, '<a href="http://twitter.com/$1">@$1</a>');
$('#tweet').html(tweet);
}
});
@lxneng
lxneng / yupoo_backup.rb
Created June 8, 2011 07:02 — forked from huacnlee/yupoo_backup.rb
Yupoo 图片备份工具
# coding: UTF-8
#
# Yupoo 照片备份工具
# 此工具不需要API,直接就能备份你的照片信息,下载后以图片 + 一个文本文件的方式存放
# 备份包括内容:
# 原图,标题,说明,Tag,当然有 Exif 信息
#
# Jason Lee <[email protected]>
# http://huacnlee.com
# 2011-01-28
@lxneng
lxneng / fabfile.py
Created June 7, 2011 08:01 — forked from onyxfish/fabfile.py
Chicago Tribune News Applications fabric deployment script
from fabric.api import *
"""
Base configuration
"""
env.project_name = '$(project)'
env.database_password = '$(db_password)'
env.site_media_prefix = "site_media"
env.admin_media_prefix = "admin_media"
env.newsapps_media_prefix = "na_media"
@lxneng
lxneng / vim.rb
Created May 13, 2011 09:27 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.189'
def features; %w(tiny small normal big huge) end
@lxneng
lxneng / Gemfile
Created April 23, 2011 00:05 — forked from rmoriz/Gemfile
UUID primary keys in Rails 3
# Gemfile
gem 'uuidtools'
# 2010-10-02 14h00
# Update created field in user_prefs table
def migrate(db):
with db.select('user_id, created', from_='users'):
all_users = db.fetchall()
for user in all_users:
with db.update('user_prefs') as obj:
obj.created = user['created']
db.where('user_id = %s', user['user_id'])
require 'formula'
<<-COMMENTS
This is the Homebrew formula for Python.
Versions
--------
This formula is currently tracking version 2.6.x.
import httplib, urlparse, socket
def http_get_headers_and_truncated_body(
url, max_redirects=5, body_length=2048, timeout=5,
allowed_content_types = ('text/html',), num_redirects_followed=0,
redirect_chain = None
):
redirect_chain = redirect_chain or []
# Returns {'ok':True,'headers':{},'redirected':False,'url':'','body': '',
# 'max_redirects_reached': False, 'num_redirects_followed': 0,
@lxneng
lxneng / sqlgrowler.rb
Created July 16, 2010 15:32 — forked from gstark/sqlgrowler.rb
let-your-sql-growl-in-rails-3
#http://hasmanyquestions.wordpress.com/2010/01/17/let-your-sql-growl-in-rails-3/
module SQLGrowler
class Subscriber < ActiveRecord::Railties::Subscriber
def sql(event)
super
g('%s (%.1fms) %s' % [event.payload[:name], event.duration, event.payload[:sql].squeeze(' ')])
end
end
def self.enable

Deploying Django on HostMonster Shared Hosting

I haven't fully tested this yet, so I may have forgotten a step (or two) but this should be fairly accurate.

  1. Set up SSH access on the host.
  2. Add your SSH to ~/.ssh/authorized_keys on the host.
  3. SSH in to the server.
  4. Set up Git.

wget http://kernel.org/pub/software/scm/git/git-1.7.0.6.tar.gz