This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: supervisord | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from redis import Redis | |
import simplejson | |
class Resque(object): | |
"""Dirt simple Resque client in Python. Can be used to create jobs.""" | |
redis_server = 'localhost:6379' | |
def __init__(self): | |
host, port = self.redis_server.split(':') | |
self.redis = Redis(host=host, port=int(port)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an auto-generated Django model module. | |
# You'll have to do the following manually to clean this up: | |
# * Rearrange models' order | |
# * Make sure each model has one field with primary_key=True | |
# Feel free to rename the models, but don't rename db_table values or field names. | |
# | |
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]' | |
# into your database. | |
from django.db import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* jQuery TextChange Plugin | |
* http://www.zurb.com/playground/jquery-text-change-custom-event | |
* | |
* Copyright 2010, ZURB | |
* Released under the MIT License | |
*/ | |
(function ($) { | |
$.event.special.textchange = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install git | |
brew update | |
brew install readline | |
brew link readline | |
brew install python | |
brew install postgres | |
brew install tmux | |
brew install pip | |
brew install nginx | |
brew install libevent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
<<-COMMENTS | |
This is the Homebrew formula for Python. | |
Versions | |
-------- | |
This formula is currently tracking version 2.6.x. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
log = logging.getLogger(__name__) | |
from datetime import timedelta | |
from flask.helpers import _endpoint_from_view_func | |
from flask import request, g, abort | |
import os | |
import hmac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> a = Object.new | |
=> #<Object:0x7ff7a6ff6388> | |
irb(main):002:0> a.object_id #获取对象ID | |
=> 70350817702340 | |
irb(main):003:0> a.class #获取对象类型 | |
=> Object | |
irb(main):004:0> Integer.superclass #获取父类 | |
=> Numeric | |
irb(main):006:0> Numeric.superclass #... | |
=> Object |
OlderNewer