In your command-line run the following commands:
brew doctor
brew update
class PdfMerger | |
def merge(pdf_paths, destination) | |
first_pdf_path = pdf_paths.delete_at(0) | |
Prawn::Document.generate(destination, :template => first_pdf_path) do |pdf| | |
pdf_paths.each do |pdf_path| | |
pdf.go_to_page(pdf.page_count) |
# Here's a contrived example of a LEFT JOIN using ARel. This is an example of | |
# the mechanics, not a real-world use case. | |
# NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord | |
# extension that works for any named association. That's what I really wanted! | |
# Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446 | |
# == DEFINITIONS | |
# - A Taxi is a car for hire. A taxi has_many :passengers. | |
# - A Passenger records one person riding in one taxi one time. It belongs_to :taxi. |
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
In your command-line run the following commands:
brew doctor
brew update
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
#!/bin/bash | |
# | |
# copy this into /etc/profile.d/instance-name-tag.sh | |
# | |
# you will need: | |
# - curl, jq, and aws cli installed | |
# - an IAM role that gives the EC2 instance access to describe tags | |
# |
Base commands:
Creating a new container
docker run [-d (runs in background] [-p <host-system-port>:<container-port>] <image:tag>
* Creates a new container from an image
* If you run it 4 times, it will create 4 containers
Options:
--name Give the container a name, otherwise it will pick a default name.
module WAKUtils | |
def self.reload(require_regex) | |
$".grep(/#{require_regex}/).each {|e| $".delete(e) && require(e) } | |
end | |
end |