国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Dockerized 实践 https://github.com/y0ngb1n/dockerized
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Dockerized 实践 https://github.com/y0ngb1n/dockerized
| # gem install multi_json json yajl-ruby oj benchmark-memory | |
| require 'multi_json' | |
| require 'json' | |
| require 'yajl' | |
| require 'oj' | |
| require 'benchmark' | |
| require 'benchmark-memory' | |
| hash1 = { |
| comment = "# frozen_string_literal: true\n" | |
| filemode = "r+" | |
| dirs = Dir[Rails.root.join('spec/**/*.rb').to_s] + Dir[Rails.root.join('lib/**/*.rake').to_s] + Dir[Rails.root.join('lib/**/*.rb').to_s] | |
| dirs.each do |filename| | |
| contents = File.open(filename, "r") do |f| | |
| f.read | |
| end | |
| contents = comment + contents |
In general, SSH tunneling creates a secure connection between a local computer and a remote machine through which services can be relayed (the important part). Because the connection is encrypted, SSH tunneling is useful for transmitting information that uses an unencrypted protocol, such as IMAP, VNC, or IRC (the not-so-important part).
A case where I found this to be a useful technique was when I had a remote machine running a web server but because of various reasons (e.g. security concerns) there was no public open port available (that I could use).
If such a port existed (e.g. 9876), I could simply access the web server from my favorite web browser just by providing the appropriate URL address (e.g. http://example.com:9876).
But fortunately enough, I had SSH access to that remote machine.
This is how it works:
| #!/bin/bash | |
| sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
| sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport |
| upstream myapp_puma { | |
| server unix:/tmp/myapp_puma.sock fail_timeout=0; | |
| } | |
| # for redirecting to https version of the site | |
| server { | |
| listen 80; | |
| rewrite ^(.*) https://$host$1 permanent; | |
| } | |
| class TracePoint | |
| class Middleware | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| stats = {} | |
| trace = TracePoint.new(:call) do |tp| |
| Model.new.foo |