I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis
onto
the box and here's how I did it and some things to look
out for.
To install:
SRC="/opt/local/src/mongodb/LATEST/"; | |
DEST="/opt/local/bin/"; | |
for file in $(/bin/ls $SRC); | |
do | |
[[ -f $DEST$file ]] && rm $DEST$file; | |
ln -s $SRC$file $DEST$file; | |
done |
var net = require("net"); | |
var repl = require("repl"); | |
net.createServer(function(socket){ | |
var replserver = repl.start("prompt > ", socket); | |
// You must explicitly give the repl client access to variables via replserver.context variable. | |
// The following line is intended for educational purposes only. DO NOT USE in practice. | |
replserver.context = exports; // DANGER: This gives repl client access to ALL global variables of this program. | |
replserver.context.myvar = "stuff"; |
// This example shows how to use tailable cursors in MongoDB using mongoosejs | |
// IMPORTANT: The collection must be created as "capped" or this will raise err. | |
// At time of writing, there is no built-in way to create capped collection using MongooseJS. | |
var mongoose = require("mongoose"); | |
mongoose.connect(connect_string); | |
Model = mongoose.model(model_name); | |
Model.connection.find(query, {tailable:true}, function(err, cursor){ | |
if (err){ |
// This snippet is useful for debugging connection parameters in the connect_string, for checking if your remote mongodb server is up, etc. | |
var mongoose = require("mongoose"); | |
mongoose.connect(connect_string); | |
mongoose.connection.on("open", function(){ | |
console.log("connection established"); | |
}) |
<html> | |
<head> | |
<script src="/dnode.js" type="text/javascript"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
DNode({ | |
session : function (session) { | |
$('#auth :visible').slideUp(); | |
$('#user').text(session.user); | |
curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer | |
chmod +x rvm-installer | |
./rvm-installer 1.6.3 |
#!/usr/bin/python | |
import sys | |
code = """#!/usr/bin/python | |
import sys | |
code = {0}{1}{0} | |
def initial_solution(): |
#!/usr/bin/env node | |
var sys = require("sys"), | |
fs = require("fs"); | |
var indented = ""; | |
(function (json) { | |
indented = /(^[\t ]*)/.exec(json)[0] || ""; | |
try { |
#!/usr/bin/env python | |
""" | |
A script to query the Amazon Web Services usage reports programmatically. | |
Ideally this wouldn't exist, and Amazon would provide an API we can use | |
instead, but hey - that's life. | |
Basically takes your AWS account username and password, logs into the | |
website as you, and grabs the data out. Always gets the 'All Usage Types' |