Skip to content

Instantly share code, notes, and snippets.

// Index:
r.table("heroes").indexCreate("idEquipment", function(doc) {
return doc("equipment").map(function(equipment) {
return [doc("id"), equipment]
})
}, {multi: true}).run(conn, callback)
// Query
r.table("heroes").getAll([1, "boots"], {index: "idEquipment"}).run(conn, callback)

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

# MAC manipulators
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`'
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE'
from django.db import models
from django.utils.decorators import wraps
from django.core.exceptions import ValidationError
def constraint(func):
@wraps(func)
def inner(*args, **kwargs):
func._is_constraint = True
return func(*args, **kwargs)
return inner