As configured in my dotfiles.
start new:
tmux
start new with session name:
As configured in my dotfiles.
start new:
tmux
start new with session name:
Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.
These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.
Create a Dokku app:
Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages
and install them manually as needed.
# Note: VAT identification numbers for Greece use "EL", not "GR". | |
COUNTRY_CODES_EU = %w[ | |
AT BE BG CY CZ DK EE FI FR DE GR HU IE IT | |
LV LT LU MT NL PL PT RO SK SI ES SE GB | |
] |
data = DATA.read | |
seeds = data[/seeds: (.+)/, 1].split.map(&:to_i) | |
maps = data.scan(/map:\n(.+?)(?:\n\n|\z)/m).map { |(x)| x.lines.map { _1.split.map(&:to_i) } } | |
locations = seeds.map { |seed| | |
maps.reduce(seed) { |input, map| | |
d, s, _r = map.find { |_d, s, r| (s..(s + r)).cover?(input) } | |
d ? d + (input - s) : input | |
} |
puts DATA.readlines.sum { |line| | |
_, winning_numbers, my_numbers = line.split(/[:|]/).map(&:split) | |
wins = (winning_numbers & my_numbers).length | |
wins.zero? ? 0 : 2**(wins - 1) | |
} | |
__END__ | |
Data goes here |
grid = DATA.readlines.map(&:chomp) | |
max_line = grid.length - 1 | |
max_col = grid.first.length - 1 | |
sum = 0 | |
grid.each_with_index do |line, i| | |
tokens = line.scan(/(\D*)(\d+)/).flatten | |
offset = 0 | |
tokens.each.with_index do |token, j| |
CONSTRAINTS = { red: 12, green: 13, blue: 14 } | |
puts DATA.readlines.sum { |line| | |
game, rounds = line.match(/Game (\d+): (.+)/).captures | |
rounds = rounds.split("; ").map { _1.scan(/(\d+) (\w+)/) } | |
next 0 unless rounds.all? { |round| round.all? { |count, color| count.to_i <= CONSTRAINTS[color.to_sym] } } | |
game.to_i | |
} |
# The no-frills take. | |
words = %w[ one two three four five six seven eight nine ] | |
hash = words.flat_map.with_index(1) { |word, index| [ [ word, index ], [ index.to_s, index ] ] }.to_h | |
puts DATA.readlines.sum { |line| | |
_, first_digit = hash.min_by { |string, _| line.index(string) || 999 } | |
_, last_digit = hash.max_by { |string, _| line.rindex(string) || -1 } | |
first_digit * 10 + last_digit |