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
require 'formula' | |
class MzScheme < Formula | |
url 'http://download.plt-scheme.org/bundles/372/mz/mz-372-src-unix.tgz' | |
homepage 'http://plt-scheme.org/' | |
md5 'c755f4ba7191636c5eb587745e4c6a67' | |
version '4.2.5' | |
fails_with_llvm "Unsupported inline asm", :build => 2335 |
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
// | |
// This server will start a bash shell and expose it | |
// over socket.io to a browser. See ./term.html for the | |
// client side. | |
// | |
// You should probably: | |
// | |
// npm install socket.io | |
// curl -O https://github.com/LearnBoost/Socket.IO/raw/master/socket.io.min.js | |
// |
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
dylan@dmv-vmware:~$ gem install camellia | |
Fetching: camellia-2.7.0-x86-linux.gem (100%) | |
Building native extensions. This could take a while... | |
ERROR: Error installing camellia: | |
ERROR: Failed to build gem native extension. | |
/home/dylan/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb | |
Unzipping Camellia library... | |
Configuring Camellia library... | |
Compiling and installing Camellia library... |
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
> source("http://bioconductor.org/biocLite.R") | |
BiocInstaller version 1.4.3, ?biocLite for help | |
> biocLite("EBImage") | |
BioC_mirror: http://bioconductor.org | |
Using R version 2.15, BiocInstaller version 1.4.3. | |
Installing package(s) 'EBImage' | |
trying URL 'http://www.bioconductor.org/packages/2.10/bioc/src/contrib/EBImage_3.12.0.tar.gz' | |
Content type 'application/x-gzip' length 4738660 bytes (4.5 Mb) | |
opened URL | |
================================================== |
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
# based on http://www.stgraber.org/2012/07/17/easily-ssh-to-your-containers-and-vms-on-ubuntu-12-04-lts/ | |
Host *.lxc | |
User ubuntu | |
StrictHostKeyChecking no | |
UserKnownHostsFile /dev/null | |
ProxyCommand nc $(host $(echo %h | sed "s/.lxc//g") 10.0.3.1 | tail -1 | awk '{print $NF}') %p |
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 google.appengine.ext import db, ndb | |
class OldBananaStand(db.Model): | |
contains_money = db.BooleanProperty() | |
class NewBananaStand(ndb.Model): | |
contains_money = ndb.BooleanProperty() | |
old_ones = OldBananaStand.all() | |
old_ones.filter('contains_money = True') # => ok! |
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 google.appengine.ext import ndb | |
class ReferenceProperty(ndb.KeyProperty): | |
def _validate(self, value): | |
if not isinstance(value, ndb.Model): | |
raise TypeError('expected an ndb.Model, got %s' % repr(value)) | |
def _to_base_type(self, value): | |
return value.key |
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 google.appengine.ext import db, ndb | |
from google.appengine.datastore import entity_pb | |
def db_entity_to_protobuf(e): | |
return db.model_to_protobuf(e).Encode() | |
def protobuf_to_db_entity(pb): | |
# precondition: model class must be imported | |
return db.model_from_protobuf(entity_pb.EntityProto(pb)) |
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 google.appengine.ext import ndb | |
def tasklet(func): | |
"""Tasklet decorator that lets the caller specify either async or sync | |
behavior at runtime. | |
If make_sync is False (the default), the tasklet returns a future and | |
can be used in asynchronous control flow from within other tasklets | |
(like ndb.tasklet). If make_sync is True, the tasklet will wait for its | |
results and return them, allowing you to call the tasklet from synchronous |
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 https://developers.google.com/appengine/docs/python/ndb/async | |
@ndb.tasklet | |
def get_cart_async(acct): | |
cart = yield CartItem.query(CartItem.account == acct.key).fetch_async() | |
yield ndb.get_multi_async([item.inventory for item in cart]) | |
raise ndb.Return(cart) | |
@ndb.tasklet | |
def get_offers_async(acct): |