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:
CREATE OR REPLACE FUNCTION calculate_dialup( | |
hours real, | |
service_dialup_id int | |
) RETURNS real as $$ | |
DECLARE | |
dialup service_dialups%ROWTYPE; | |
excess_usage_charge real := 0; | |
BEGIN | |
SELECT * INTO dialup FROM service_dialups WHERE id = service_dialup_id; | |
-- ... |
class Trie | |
def initialize | |
@root = {} | |
end | |
def build(string) | |
node = @root | |
string.chars.each do |char| | |
node[char] ||= {} |
require "benchmark" | |
trie = Trie.new | |
dictionary = IO.read("/usr/share/dict/words").split("\n") | |
puts "/usr/share/dict/words has #{dictionary.size} words." | |
Benchmark.bm(15) do |benchmark| | |
benchmark.report("build (iterative)") do | |
trie = Trie.new |
PATH=/usr/local/bin:$PATH |
$ git commit | |
error: There was a problem with the editor 'vi'. | |
Please supply the message using either -m or -F option. | |
$ echo $? | |
1 | |
$ git config --global core.editor /usr/bin/vim | |
$ git commit | |
[feature/tag-search 0167ee2] Merge branch 'master' of github.com:jamesmoriarty/project-x into feature/tag-search | |
$ echo $? | |
0 |
# toggle order | |
order = ( order == "desc" ? "asc" : "desc" ) | |
# var order, _ref; | |
# | |
# order = (_ref = order === "desc") != null ? _ref : { | |
# "asc": "desc" | |
# }; |
class Account | |
attr_reader :balance | |
def initialize(balance) | |
@balance = balance | |
end | |
def receive(amount) | |
@balance += amount | |
end |
# File lib/extensions/kernel.rb, line 38 | |
def require_relative(path) | |
require File.join(File.dirname(caller[0]), path.to_str) | |
end |
# Twilio HTTP HAProxy Configuration | |
# Version: 0.1 | |
global | |
daemon | |
log 127.0.0.1 local0 info | |
maxconn 60000 | |
spread-checks 3 | |