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
| Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) | |
| [GCC 4.0.1 (Apple Inc. build 5465)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> import sys | |
| >>> sys.exit() | |
| $ |
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
| Jan 16 12:05:06 beardy upsmon[16391]: UPS smartups@localhost on battery | |
| Jan 16 12:05:56 beardy upsmon[16391]: UPS smartups@localhost on line power | |
| Jan 16 14:02:27 beardy upsmon[8713]: UPS SmartUPS@localhost on battery | |
| Jan 16 14:02:52 beardy upsmon[8713]: UPS SmartUPS@localhost on line power | |
| Jan 16 14:18:49 beardy upsmon[8713]: UPS SmartUPS@localhost on battery | |
| Jan 16 14:18:54 beardy upsmon[8713]: UPS SmartUPS@localhost on line power | |
| Jan 16 14:21:14 beardy upsmon[8713]: UPS SmartUPS@localhost on battery | |
| Jan 16 14:21:24 beardy upsmon[8713]: UPS SmartUPS@localhost on line power | |
| Jan 16 14:55:53 beardy upsmon[8713]: UPS SmartUPS@localhost on battery | |
| Jan 16 14:55:58 beardy upsmon[8713]: UPS SmartUPS@localhost on line power |
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
| Helps a bit with verifying things are being cached properly and retrieved from cache by requests. | |
| sub vcl_deliver { | |
| if (obj.hits > 0) { | |
| set resp.http.X-Cache = "HIT"; | |
| set resp.http.X-Cache-Hits = obj.hits; | |
| } else { | |
| set resp.http.X-Cache = "MISS"; | |
| } |
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
| def hello(**kwargs): | |
| print ','.join(kwargs) |
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 datetime | |
| from collections import deque | |
| from functools import wraps | |
| from django.core.cache import cache | |
| def timed_task(f): | |
| @wraps(f) | |
| def wrapper(*args, **kwargs): | |
| """Simple decorator to cache previous 10 execution times |
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
| if request.method == "POST": | |
| email_form = SendAnEmail(request.POST, prefix='emailform') | |
| if email_form.is_valid(): | |
| connection = DjangoBrokerConnection() | |
| publisher = Publisher(connection=connection, | |
| exchange="sendemail", | |
| routing_key="sendemail_emails") | |
| publisher.send(email_form.cleaned_data.get('email_address')) | |
| publisher.close() | |
| connection.close() |
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 struct | |
| from Crypto.Cipher import AES | |
| def pkcspad(s, block_size=AES.block_size): | |
| """PKCS#5/#7 padding - return string the right length for a block cipher. | |
| # the output of pkcspad is 8 bit so use an md5 digest here in the | |
| # doctests to check output. | |
| >>> from hashlib import md5 | |
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
| (if (file-exists-p | |
| (concat (getenv "TMPDIR") "emacs" | |
| (number-to-string | |
| (user-real-uid)) "/server")) | |
| nil (server-start)) |
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
| express = require 'express' | |
| app = module.exports = express.createServer() | |
| app.configure -> | |
| app.set 'views', __dirname + '/views' | |
| app.set 'view engine', 'jade' | |
| app.use express.bodyParser() | |
| app.use express.methodOverride() | |
| app.use app.router |
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
| autoload -Uz vcs_info | |
| autoload -U colors && colors | |
| my_prompt_setup() { | |
| zstyle ':vcs_info:*' enable git | |
| zstyle ':vcs_info:git:*' check-for-changes true | |
| precmd() { | |
| vcs_info | |
| } | |
| PROMPT="%{$fg[blue]%}(%{$reset_color%}%{$fg[red]%}%m%{$reset_color%}%{$fg[yellow]%}:%{$reset_color%}%{$fg[green]%}%1d%{$reset_color%}%{$fg[blue]%})%{$reset_color%}%# " | |
| RPROMPT='${vcs_info_msg_0_}' |
OlderNewer