Skip to content

Instantly share code, notes, and snippets.

James u007

Block or report user

Report or block u007

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FranklinYu
FranklinYu / README.markdown
Last active Nov 9, 2019
links for old versions of Docker for Mac (inspired by docker/for-mac#1120)
View README.markdown

links for old versions of Docker for Mac

Deprecated

Docker provides download links in release note. They promised that

(we) will also include download links in release notes for future releases.

Note:

@thbar
thbar / go_build.rb
Last active Mar 4, 2017
Integration testing of a golang app with rspec and capybara-webkit.
View go_build.rb
module GoBuild
extend self
def build(file)
process = ChildProcess.build('go', 'build', file)
err = Tempfile.new('stderr-spec')
process.io.stderr = err
process.start
process.poll_for_exit(10)
err.rewind
@njakobsen
njakobsen / live_database_dump.rb
Last active Oct 12, 2019
Live stream a database dump (or any other STDOUT) using Rails 4. Why would you want this? If you have a large database dump and want to avoid storing it in memory as Rails streams it. This allows pipe the dump directly into the http response instead of storing it as a file, sending it, and then deleting it. Let me know what you think! I've teste…
View live_database_dump.rb
class DatabaseController < ApplicationController
def database_dump
database = Rails.configuration.database_configuration[Rails.env]["database"]
send_file_headers!(:type => 'application/octet-stream', :filename => "#{database}_#{Time.now.to_s(:human)}.backup")
pipe = IO.popen("pg_dump '#{database}' -F c")
stream = response.stream
while (line = pipe.gets)
stream.write line
sleep 0.0001 # HACK: Prevent server instance from sleeping forever if client disconnects during download
You can’t perform that action at this time.