This file contains 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
console.log('Hello, World!'); | |
var fs = require('fs'); | |
var amqp = require('amqp'); | |
var connection = amqp.createConnection({ url: 'amqp://subbydev/base64tests' }); | |
// Wait for connection to become established. | |
connection.on('ready', function () { | |
// Create a queue and bind to all messages. | |
// Use the default 'amq.topic' exchange |
This file contains 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
# coding=utf-8 | |
import cStringIO | |
import csv | |
import codecs | |
__author__ = 'shaun_stanworth' | |
class UnicodeWriter: | |
""" | |
A CSV writer which will write rows to CSV file "f", |
This file contains 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
""" | |
Get django-sekizai, django-compessor (and django-cms) playing nicely together | |
re: https://github.com/ojii/django-sekizai/issues/4 | |
using: https://github.com/jezdez/django_compressor.git | |
and: https://github.com/ojii/[email protected] | |
""" | |
from compressor.templatetags.compress import CompressorNode | |
from django.template.base import * | |
def compress(data, name): |
This file contains 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
// Example | |
// measuring performance for on-time delivery | |
var on_time_poor = 25; | |
var on_time_good = 50; | |
var ontime_markers = build_bullet_markers_higher_better(100, on_time_poor, on_time_good); | |
var on_time_percentage = 40; | |
draw_bullet_graph($('#ontime_placeholder'), 0, 100, null, on_time_percentage, ontime_markers, 0); | |
/** |
This file contains 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
Django>=1.2 | |
South | |
psycopg2 |
This file contains 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
NB: Originally courtesy of http://blog.taggesell.de/index.php?/archives/73-Managing-Amazon-EC2-SSH-login-and-protecting-your-instances.html | |
Managing Amazon EC2 - SSH login and protecting your instances | |
How to log into your freshly fired-up instances and how to secure ssh access | |
(works under Linux and Mac OS, under Windows with Cygwin) | |
First time you want to log into a newly started instance you appear to have the chicken-and-egg problem: how to log in when you do not know the root password? Luckily Amazon devised a comfortable way to circumvent this: your Key Pairs. these are not to be confused with the „Access Key IDs“ on the Access Identifier web page and they are neither the X509 certificates. These Key pairs are automatically generated the first time you log into the web console and you can only download its private part. Store it in your ~/.ssh directory. In case you missed the download or don't know where you've put it AND you don't have any instances running, just generate and download a new one. | |
This file contains 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
# re: nameko entrypoints | |
def wrapt_entrypoint(entrypoint_fn=None, provider=None): | |
""" Transform a callable into a decorator that can be used to declare | |
entrypoints. | |
The callable should indicate a EntrypointProvider class. Usages of the | |
callable will have their kwargs combined with the provider to produce a | |
DependencyFactory for the given wrapped service function. |
This file contains 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
# rpc_factory is what used to be rpc | |
@entrypoint | |
def rpc_factory(expected_exceptions=None): | |
return DependencyFactory(NovaRpcProvider, expected_exceptions) | |
def rpc(service_fn=None, expected_exceptions=None): | |
if service_fn is None: | |
return partial(rpc, expected_exceptions=expected_exceptions) |
This file contains 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 pytest | |
def track_test_fails(): | |
@pytest.mark.tryfirst | |
def pytest_runtest_makereport(item, call, __multicall__): | |
# execute all other hooks to obtain the report object | |
rep = __multicall__.execute() | |
# `when` is setup, call, teardown | |
setattr(item, "rep_" + rep.when, rep) |
This file contains 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
@asyncio.coroutine | |
def slow_method(): | |
yield from perform_a_blocking_call() | |
return 'Done' | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(slow_method()) | |
loop.close() |
OlderNewer