Skip to content

Instantly share code, notes, and snippets.

@Glutexo
Created April 1, 2019 09:52
Show Gist options
  • Select an option

  • Save Glutexo/1fe30248c8edd75763f5a9d4eed1db22 to your computer and use it in GitHub Desktop.

Select an option

Save Glutexo/1fe30248c8edd75763f5a9d4eed1db22 to your computer and use it in GitHub Desktop.
Open PgAdmin 4
#!/usr/bin/env ruby
=begin
PgAdmin 4 runs on a random port. Once you close its browser window, there
is no way to get back to it. But it stores its address in a hidden file.
This script finds the file and opens the address inside in a default
browser.
=end
path = File::expand_path('~')
filename = Dir.new(path).entries.find do |item|
item.match?(/^\.pgAdmin4\.\d+\.addr$/)
end
addr = File.read(filename).chomp
exec('open', addr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment