First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel
Then ssh with root account, run this in termianl:
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
#the new tap method of ruby will always return itself, but lets you play with! | |
data = (1..10).to_a | |
data.tap{|x| print x}.to_a.join(', ') | |
p | |
#alias will redirect method calls to method with a different name, useful for api changing | |
class SomeClass | |
def new_method(x) | |
p "The value is #{x}" |
model = Object::const_get(ARGV[0]) | |
rows = model.find(:all) | |
# Any columns you don't want output, list here as symbols | |
# e.g. BLACKLIST = [:user_id, :workout_id] | |
BLACKLIST = [] | |
# Any columns that you'd like to rename on the output, list in this hash | |
# e.g. TRANSFORM = {:percentOfMax => :percent_of_max} | |
TRANSFORM = {} |
# 523 : ~/Projects/runfatboy2 $ rails runner ~/factories_from_db.rb Exercise 1 2 3 | |
# | |
# Factory.define :exercise_incline press do |r| | |
# r.name 'Incline Press' | |
# r.url 'http://video.google.com/googleplayer.swf?docId=-5762262560903802111&hl=en' | |
# r.verb 'Lift' | |
# r.measurement_type_id 3 | |
# r.exercise_type_id 1 | |
# r.user_id 2 | |
# r.start_weight 0.8 |
#!/usr/bin/env ruby | |
ignore_patterns = ["db/","test","log","reports","server","vendor/","Gemfile","tmp",".idea","config/",".DS_Store", ".xml", '.zip'] | |
ignore_statuses = ['!','D','?'] | |
changed_files = (`svn status`).split("\n").collect do |e| | |
p = e.split(/\s+/) | |
ignore_statuses.include?(p[0]) ? nil : p[p.size - 1] | |
end.compact |
# hopefully a temporary patch so HireFire will run on the Heroku Cedar stack | |
# NB: the worker type is hard-coded as "worker" below, this must correlate to the type in Procfile | |
# NB: ENV['APP_NAME'] must be defined (e.g. 'heroku config:add APP_NAME=myherokuappname') | |
# using ps & ps_scale instead of info & set_workers | |
class HireFire::Environment::Heroku | |
private | |
def workers(amount = nil) |
module Rubinius | |
class CompiledMethod | |
def _dump(depth) | |
Marshal.dump([@scope, Rubinius::CompiledFile::Marshal.new.marshal(self)]) | |
end | |
def self._load(string) | |
scope, dump = Marshal.load(string) | |
cm = Rubinius::CompiledFile::Marshal.new.unmarshal(dump) | |
cm.scope = scope |
Looked at the host serving my Netflix streams today and noticed something new.
No clue if money is changing hands or not, and the return path is what actually matters, but it appears that Comcast and Netflix have reached some sort of agreement regarding direct interconnection.
$ traceroute -a 198.45.63.164
traceroute to 198.45.63.164 (198.45.63.164), 64 hops max, 52 byte packets
(hops 1-2 redacted)
Prepare a server for a Rails app with MySQL (percona) + NGINX (passenger)
Deploy rails app in new server with Capistrano v3
#/bin/bash | |
#(c) Copyright 2014 Temasys Communication, Pte Ltd. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |