:quit
:qa
exit
exit!
quit
.quit
process.exit()
\q
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# CTE support in Active Record was added to Ruby on Rails 7.1 | |
# https://blog.appsignal.com/2023/02/15/whats-new-in-rails-7-1.html# | |
# | |
# The example below produces an equivalent query to the SQL version below. | |
# | |
# Rails app: https://github.com/andyatkinson/rideshare | |
# | |
irb(main):395* Driver.with(drivers_recent_completed_trip: Driver.select('users.id AS driver_id').joins(trips: :trip_request). | |
irb(main):396* where.not(trips: {completed_at: nil}). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table t (id serial, created_at timestamptz) partition by range (created_at); | |
create table t_202309 partition of t for values from ('2023-09-01') TO ('2023-10-01'); | |
create table t_202310 partition of t for values from ('2023-10-01') TO ('2023-11-01'); | |
postgres@[local]:5432 testing# \d t | |
Partitioned table "public.t" | |
Column | Type | Collation | Nullable | Default | |
------------+--------------------------+-----------+----------+------------------------------- | |
id | integer | | not null | nextval('t_id_seq'::regclass) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prereq: auto_explain added to shared_preload_libraries | |
# Compute the Query Identifier | |
compute_query_id = on | |
# Logging duration | |
log_duration = on | |
# Logging Query Identifier (%Q) | |
log_line_prefix = 'pid=%p query_id=%Q: ' |
I hereby claim:
- I am andyatkinson on github.
- I am andatki (https://keybase.io/andatki) on keybase.
- I have a public key whose fingerprint is 2BC1 EF01 7DEA 0698 523F 8A3C A6D9 3792 EFC7 54EE
To claim this, I am signing this object:
issues xfter a restart where postgres is running, but not with launchctl, not sure why stop manually:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
restart with launchctl:
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example config from a nginx + unicorn + capistrano deploy to a VPS | |
# "app" is deployed to /var/www/app | |
# replace "app" with the app name | |
# The rule of thumb is to use 1 worker per processor core available,. | |
# however since we'll be hosting many apps on this server,. | |
# we need to take a less aggressive approach | |
worker_processes 2 | |
# We deploy with capistrano, so "current" links to root dir of current release |
On Mavericks, my laptop had issues on my home wi-fi, an old WRT54G Linksys router.
Troubleshooting:
- http://osxdaily.com/2012/08/02/fix-os-x-mountain-lion-wireless-connection-problems/
- https://discussions.apple.com/thread/5512591?start=15&tstart=0
- https://discussions.apple.com/thread/4113552?start=210&tstart=0
Tips:
- change DNS servers to google DNS 8.8.8.8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exists?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |