Skip to content

Instantly share code, notes, and snippets.

var fs = require('fs');
var file = __dirname + '/test.json';
fs.readFile(file, 'utf8', function (err, data) {
if (err) {
console.log('Error: ' + err);
return;
}
data = JSON.parse(data);
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
error_page 404 /404.html
index index.html;

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
package paintserver
import (
"net/http"
"code.google.com/p/go.net/websocket"
"image/color"
"image"
"image/png"
)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

var mongoose = require('mongoose');
var http = require('http');
var JSONStream = require('JSONStream');
var PersonSchema = new mongoose.Schema({
name: String,
num: Number
});
mongoose.connect("mongodb://localhost:27017");

Welcome!

If you have any suggestions, please leave a comment and mention me ( @dideler ) so I get a notification.
Pull requests aren't possible with gists (yet), so comments are more useful than forking this to make changes.

Don't forget to star this gist!

TODO
  • Organize resources into sections
  • More detailed sections (perhaps sections & subsections)

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000