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:
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.network :forwarded_port, guest: 3000, host: 3000 | |
config.vm.box = "precise" |
ls --almost-all | head --lines=-1 | xargs rm -r |
CREATE OR REPLACE FUNCTION balanced() RETURNS trigger AS $balanced$ | |
DECLARE | |
balance decimal; | |
BEGIN | |
SELECT SUM(postings.amount) INTO balance FROM postings; | |
IF balance != 0 THEN | |
RAISE EXCEPTION 'Invalid posting sum. (%)', balance; | |
END IF; |
# Twilio HTTP HAProxy Configuration | |
# Version: 0.1 | |
global | |
daemon | |
log 127.0.0.1 local0 info | |
maxconn 60000 | |
spread-checks 3 | |
namespace :deploy do | |
namespace :sidekiq do | |
desc 'Replace upstart config for sidekiq-workers' | |
task :upstart_config do | |
data = %Q{ | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
exec su - #{user} -c 'cd #{release_path}; export RAILS_ENV=#{stage}; bundle exec sidekiq -q default,1 -c 4 -pid #{release_path}/tmp/pids/sidekiq.pid >> #{release_path}/log/sidekiq.log 2>&1' |
sudo raspi-config | |
sudo reboot | |
# mount external disk | |
sudo apt-get install hfsplus hfsutils hfsprogs | |
sudo mkdir /media/usb0 | |
sudo nano /etc/fstab | |
# /dev/sda2 /media/usb0 hfsplus defaults,force,gid=pi,uid=pi,noatime 0 0 | |
sudo chown -R root:users /media/usb0/ | |
sudo chmod -R ug=rwx,o=rx /media/usb0/ |
# File lib/extensions/kernel.rb, line 38 | |
def require_relative(path) | |
require File.join(File.dirname(caller[0]), path.to_str) | |
end |
class Account | |
attr_reader :balance | |
def initialize(balance) | |
@balance = balance | |
end | |
def receive(amount) | |
@balance += amount | |
end |
# toggle order | |
order = ( order == "desc" ? "asc" : "desc" ) | |
# var order, _ref; | |
# | |
# order = (_ref = order === "desc") != null ? _ref : { | |
# "asc": "desc" | |
# }; |