Skip to content

Instantly share code, notes, and snippets.

>>> sys.version
'2.7.3 (default, Aug 1 2012, 05:14:39) \n[GCC 4.6.3]'
>>> sqlalchemy.__version__
'0.8.1'
>>> from sqlalchemy import create_engine
>>> engine = create_engine('postgresql://usr:psswd/db', convert_unicode=True, implicit_returning=True)
>>> conn = engine.connect()
>>>
>>> rv = conn.execute('select * from engine')
>>> [el for el in rv]
# in tmux err: E16: Invalid range
nmap <S-Left> :tabprev<CR>
nmap <S-Right> :tabnext<CR>
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/settings', {
templateUrl: 'static/tmpl/settings.html',
controller: 'SettingsCtrl'
});
$routeProvider.when('/daily/:service/:group/:component/:date/cluster', {
templateUrl: 'static/tmpl/daily_cluster.html',
controller: 'DailyClusterCtrl'
});
$routeProvider.otherwise({redirectTo: '/view2'});
<div class="span9" ng-controller="AggrHostCtrl">
<h3>Hosts</h3>
<table ng-table="cluster_hosts" class="table table-bordered table-striped">
<tr ng-repeat="slice in hosts_tbl">
<td title="Name" sortable="name">{{slice.name}}</td>
<td title="HTTP_num" sortable="http_num">{{slice.http_num}}</td>
<td title="HTTP_percentage" sortable="http_percentage">{{slice.http_percentage}}</td>
<td title="X-Script_num" sortable="xscript_num">{{slice.xscript_num}}</td>
<td title="X-Script %" sortable="xscript_percentage">{{slice.xscript_percentage}}</td>
<td title="Peak_rps" sortable="peak_rps">{{slice.peak_rps}}</td>
(function( app ) {
'use strict';
app.Router.map(function() {
this.route("settings");
this.route("services");
//this.route("daily");
//this.route("dailyCluster", { path: "/daily-cluster" });
this.resource('daily', { path: '/daily' }, function() {
this.route('cluster');
>>> from datetime import datetime
>>> s = '[07/Jun/2013:04:48:36 +0400]'
>>> datetime.strptime(s, '[%d/%b/%Y:%H:%M:%S %z]')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_strptime.py", line 317, in _strptime
(bad_directive, format))
ValueError: 'z' is a bad directive in format '[%d/%b/%Y:%H:%M:%S %z]'
celery worker
-------------- celery@testload01g v3.0.15 (Chiastic Slide)
---- **** -----
--- * *** * -- [Configuration]
-- * - **** --- . broker: redis://127.0.0.1:6379/2
- ** ---------- . app: default:0x19ae0d0 (.default.Loader)
- ** ---------- . concurrency: 8 (processes)
- ** ---------- . events: OFF (enable -E to monitor this worker)
- ** ----------
$ celery worker
-------------- celery@testload01g v3.0.15 (Chiastic Slide)
---- **** -----
--- * *** * -- [Configuration]
-- * - **** --- . broker: redis://127.0.0.1:6379/2
- ** ---------- . app: default:0x2f260d0 (.default.Loader)
- ** ---------- . concurrency: 8 (processes)
- ** ---------- . events: OFF (enable -E to monitor this worker)
- ** ----------
@celery.task
def layer0(msg):
print 'Layer 0; msg:{}'.format(msg)
return msg
@celery.task
def layer1(msg):
print 'Layer 1; msg:{}'.format(msg)
return msg
$ celery worker
-------------- celery@testload01g v3.0.15 (Chiastic Slide)
---- **** -----
--- * *** * -- [Configuration]
-- * - **** --- . broker: redis://127.0.0.1:6379/2
- ** ---------- . app: default:0x18290d0 (.default.Loader)
- ** ---------- . concurrency: 8 (processes)
- ** ---------- . events: OFF (enable -E to monitor this worker)
- ** ----------