바로 실전에 적용할 수 있는 파이썬 웹 개발 레시피. 기초적인 파이썬 지식이 필요합니다.
앞으로 다룰 내용에서 알아둬야 할 파이썬 기능을 다시 한번 짚고 넘어갑니다. 이미 파이썬 고수라면 건너뛰셔도 좋습니다!
- 모듈
-- Make sure a presentation is opened in Keynote. If not, notify the user and stop. | |
tell application "Keynote" | |
if (front slideshow exists) = false then | |
display alert "Unable to proceed." message "Please open a presentation in Keynote." | |
return | |
end if | |
set extractBody to button returned of (display alert "Would you like to extract slide content too?" buttons {"Yes", "No"}) = "Yes" | |
-- Target the front presentation. |
export PROJECTS_HOME="$HOME/Projects" | |
function has_virtualenv__() { | |
if [[ ${PWD##$PROJECTS_HOME} != $PWD ]]; then | |
IFS="/" read -ra ADDR <<< "${PWD##$PROJECTS_HOME}" | |
venvname=${ADDR[1]} | |
cur_env=${VIRTUAL_ENV##$WORKON_HOME} | |
if [[ $venvname != "" ]] && [[ -d "$WORKON_HOME/$venvname" ]]; then | |
if [[ ${cur_env:1} != $venvname ]]; then | |
workon "$venvname" |
export PROJECTS_HOME="$HOME/Projects" | |
function has_virtualenv__() { | |
if [[ "$VIRTUAL_ENV" == "" ]]; then | |
if [[ $(dirname "`pwd`") == $PROJECTS_HOME ]]; then | |
venvname=$(basename "`pwd`") | |
if [[ -d "$WORKON_HOME/$venvname" ]]; then | |
workon "$venvname" | |
fi | |
fi |
#!/bin/bash | |
# Script for installing tmux on systems where you don't have root access. | |
# tmux will be installed in $HOME/local/bin. | |
# It's assumed that wget and a C/C++ compiler are installed. | |
# exit on error | |
set -e | |
TMUX_VERSION=1.8 |
Below are some issues we encountered during our first real deployment of gevent. It is being used on one host to communicate over ethernet (ie, using raw ethernet packets) with approximately 700 PIC32 microprocessors, and it is used for communication between all of the services we have built (approximately 15 unique services running on two hosts).
stdin
/stdout
. Not all of the issues were gevent specific (for example, when the child wasn't properly select
ing on stdout, the kernel was silently dropping data when its internal buffer filled up, even though fwrite
reported that the data had been written).gevent-0.13.7
with libevent-2.0.x
. I would like to be using gevent-1.0
, but it was causing some issues (I don't recall exactly what they were) on OS X, so we rolled back to 0.13.7.libevent-1.4.13-stable
(packages with Debian stable 6.0.4) would, under moderate limport ast | |
app = lambda name, *args: \ | |
ast.Call( | |
func=ast.Name(id=name, ctx=ast.Load(), lineno=0, col_offset=0), | |
args=list(args), keywords=[], vararg=None, | |
lineno=0, col_offset=0) | |
abs = lambda arg, body: \ |
import sys | |
from werkzeug.datastructures import ImmutableDict, MultiDict | |
from flask import request | |
from flaskext.script import Manager | |
from postfixmgmt import app, db, __version__ | |
from postfixmgmt.forms import DomainAddForm | |
manager = Manager(app) | |
#!/bin/sh | |
# | |
# ******************************************* | |
# WARNING: this does *not* handle 3-way merges properly. | |
# Anything modified on the local branch since the common base will get ignored. | |
# | |
# FOR ANYONE LANDING HERE: | |
# This script is now updated as part of the git-whistles gem. | |
# https://github.com/mezis/git-whistles | |
# ******************************************* |
/*----------------------------------------------------- | |
960 Grid System ~ Core CSS. | |
Learn more ~ http://960.gs/ | |
Licensed under GPL and MIT. | |
-------------------------------------------------------*/ | |
/* Grid Settings | |
---------------------------*/ | |
// 12-column grid |