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
# | |
# A quick way to setup a basic development machine with Apache Whirr in Amazon | |
# with jdk1.6, maven 2.2, git, mercurial, subversion & vim | |
# | |
# Get Apache Whirr from here: http://whirr.apache.org/ | |
# Read the Configuration Guide for more info: | |
# http://whirr.apache.org/docs/latest/configuration-guide.html |
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
# Cassandra on EC2 using Apache Whirr trunk (18 January 2012) | |
# Clone the repo from the Apache servers | |
git clone git://git.apache.org/whirr.git | |
cd whirr | |
# build binary artefacts on your machine | |
mvn clean install |
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
Hi :) | |
Here are some quick instruction on running the hbase-ec.properties recipe. | |
1. Download Whirr 0.7.0 RC0 from here. We are going to publish this as an official release soon. | |
http://people.apache.org/~asavu/whirr-0.7.0-candidate-0/whirr-0.7.0.tar.gz | |
2. Extract the archive |
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
/** | |
* Conway's Game of Life | |
* | |
* @author Andrei Savu <[email protected]> | |
*/ | |
case class Cell(row: Int, col: Int) | |
/** | |
* Unlimited universe for storing a set of cells |
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 logging | |
import riak | |
log = logging.getLogger(__name__) | |
class RiakCounter(object): | |
def __init__(self, bucket, key): | |
self.bucket = bucket | |
self.bucket.set_allow_multiples(True) | |
self.key = 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
import scala.math.{ceil,sqrt} | |
object Main { | |
def isPrime(n: Int): Boolean = | |
if (n <= 2) (n == 2) else { | |
val limit = ceil(sqrt(n)).toInt | |
def _check(i: Int): Boolean = | |
if (i > limit) true |
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
#!/usr/bin/env python | |
""" Test HTTP Server | |
This script starts a http server that will respond to HTTP requests | |
with a predefined response. | |
Usage: | |
./http_server.py --port=8080 --code=404 --content="Page not Found" |
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
# Returns a bytestring version of 's', encoded as specified in 'encoding'. | |
def smart_str(s, encoding='utf-8', errors='strict'): | |
""" | |
Returns a bytestring version of 's', encoded as specified in 'encoding'. | |
""" | |
if not isinstance(s, basestring): | |
try: | |
return str(s) | |
except UnicodeEncodeError: |
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
#---------------------------------------------------------------- | |
# | |
# my.cnf file | |
# | |
# | |
# See: | |
# | |
# http://dev.mysql.com/doc/refman/5.1/en/server-options.html | |
# http://dev.mysql.com/doc/refman/5.1/en/option-files.html |
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
# smart backup using rsync : rsync_snapshot | |
# http://www.mikerubel.org/computers/rsync_snapshots/ | |
mv backup.3 backup.tmp | |
mv backup.2 backup.3 | |
mv backup.1 backup.2 | |
mv backup.0 backup.1 | |
mv backup.tmp backup.0 | |
cp -al backup.1/. backup.0 | |
rsync -a --delete source_directory/ backup.0/ |