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:
user app app; | |
#user nobody; | |
worker_processes 6; | |
error_log /var/log/nginx/error.log; | |
pid /var/log/nginx/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
// geo-location shim | |
// currentely only serves lat/long | |
// depends on jQuery | |
// doublecheck the ClientLocation results because it may returning null results | |
;(function(geolocation){ | |
if (geolocation) return; |
#!/usr/bin/env bash | |
# where do you want couchdb and its deps to be installed | |
COUCHDB_PREFIX="/opt/couchdb-1.0.1" | |
# Let's determine the correct arcitecture and choose the installer | |
if [ "`uname -m`" = "x86_64" ]; then | |
echo "Using 64-bit installer" | |
COUCHDB_INSTALLER_DOC_ID="26f246a0fe23d6a53d5326713308f43c" | |
COUCHDB_INSTALLER_BIN="install-couchdb-1.0.1_rel1-linux-x64.bin" |
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
; One of my recent favorite pieces of Emacs configuration. The % command was one of the things I missed the | |
; most in Emacs, until I found this little gem. I modified it from its original source by adding | |
; previous-line and next-line to the list of commands. | |
; From http://www.emacswiki.org/emacs/ParenthesisMatching#toc4 | |
(defun goto-match-paren (arg) | |
"Go to the matching parenthesis if on parenthesis AND last command is a movement command, otherwise insert %. | |
vi style of % jumping to matching brace." | |
(interactive "p") | |
(message "%s" last-command) | |
(if (not (memq last-command '( |
""" | |
Here's how to run a command from Python piping a string in to stdin and reading the | |
output back in to another string. It took me way too long to work this out. | |
""" | |
from subprocess import Popen, PIPE | |
output = Popen( | |
['java', '-jar', 'yuicompressor-2.4.2.jar', '--type=css'], | |
stdin=PIPE, stdout=PIPE |
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
<!DOCTYPE html> | |
<head> | |
<title>Snow</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> | |
<script src="snow.js" type="text/javascript"/></script> | |
</head> | |
<body onload="init();"> | |
<canvas id="bgcanvas" width="410" height="316" style="position:absolute;z-index:2"></canvas> | |
<img src="globe_layers_2.png" style="position:absolute;z-index:3"> | |
<canvas id="fgcanvas" width="410" height="316" style="position:absolute;z-index:4"></canvas> |