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
/* | |
* | |
* cc twilight.c -lgl_s -lm -o twilight | |
* | |
* Copyright (c) 1991, 1992 Silicon Graphics, Inc. | |
* | |
* Permission to use, copy, modify, distribute, and sell this software and | |
* its documentation for any purpose is hereby granted without fee, provided | |
* that the name of Silicon Graphics may not be used in any advertising or | |
* publicity relating to the software without the specific, prior written |
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
#include <iostream> | |
#include "math.h" | |
template<int n> class Field {}; | |
template<typename B, typename T> | |
class Member : public B { | |
public: | |
Member(T initial) { value_ = initial; } | |
T value() { return value_; } |
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 code that illustrates how un-intuitive it is to assert that the __str__() method of a MagicMock | |
instance was called. I'm not even sure how to git this test code to work correctly. | |
""" | |
import mock | |
from mock import call | |
def main(): |
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
from twisted.trial import unittest | |
from twisted.internet.defer import Deferred | |
class TestRudimentary(unittest.TestCase): | |
# This test case succeeds, but hangs at the end of the invocation when running through nosetests. | |
# How can this be fixed? | |
def test_rudimentary(self): | |
def done(_ignored): |
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
class SignalModel(models.Model): | |
"""A Model mixin class that lets you put your signal handler methods back into your Model class.""" | |
@classmethod | |
def _sig_pre_delete(cls, instance, *args, **kwargs): | |
"""dispatch the pre_delete method to a regular instance method. """ | |
return instance.sig_pre_delete(*args, **kwargs) | |
@classmethod | |
def _sig_post_delete(cls, instance, *args, **kwargs): |
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
$ dd if=/dev/zero of=./small.ext4 bs=1000000 count=100 | |
$ dd if=/dev/zero of=./medium bs=1000000 count=50 | |
$ mkfs.ext4 ./small.ext4 | |
$ sudo mkdir /mnt/tmp | |
$ sudo mount -o loop ./small.ext4 /mnt/tmp | |
$ sudo chmod a+rxw /mnt/tmp | |
$ sftp localhost | |
sftp> put medium /mnt/tmp/a | |
sftp> put medium /mnt/tmp/b | |
sftp> put medium /mnt/tmp/b |
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
txtund=$(tput sgr 0 1) # Underline | |
txtbld=$(tput bold) # Bold | |
reset='\[\e[00m\]' | |
bold='\[\e[01m\]' | |
red='\[\e[31m\]' | |
green='\[\e[32m\]' | |
orange='\[\e[33m\]' | |
blue='\[\e[34m\]' | |
purple='\[\e[35m\]' |
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 boto | |
from kombu import BrokerConnection, Queue | |
def main(): | |
queue = Queue("steve-test-kombu") | |
with BrokerConnection('sqs://<KEY_ID>@<ACCESS_KEY>:80/') as connection: | |
connection.connect() |
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
(env)slacy@slacy-sunfire:~/src/pvn2$ pip install pymongo==1.9 | |
Downloading/unpacking pymongo==1.9 | |
Running setup.py egg_info for package pymongo | |
Installing collected packages: pymongo | |
Running setup.py install for pymongo | |
Successfully installed pymongo | |
Cleaning up... | |
(env)slacy@slacy-sunfire:~/src/pvn2$ python -c "import pymongo; print pymongo.version" | |
1.10 |
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 datetime | |
import time | |
import random | |
import logging | |
from minimongo.model import Model, MongoCollection | |
from pyramid.interfaces import ISession | |
from zope.interface import implements | |
from pyramid.response import Response |
NewerOlder