Skip to content

Instantly share code, notes, and snippets.

View zlei1's full-sized avatar
🌴
On vacation

zlei1 zlei1

🌴
On vacation
View GitHub Profile
@zlei1
zlei1 / ruby_on_rails_deployment.md
Created July 6, 2021 06:38 — forked from zentetsukenz/ruby_on_rails_deployment.md
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

Docker

Files and Folders.

|
|\_ app
|...
|\_ docker
| |
require 'redis'
redis_connection = Redis.new(url: "redis://localhost:6379/0")
redis_connection.subscribe("messages") do |on|
on.message do |channel, msg|
puts "##{channel} - [#{msg}]"
end
end
单元测试框架 https://www.ruby-toolbox.com/categories/testing_frameworks
浏览器测试框架 https://www.ruby-toolbox.com/categories/browser_testing
js测试框架 https://www.ruby-toolbox.com/categories/javascript_testing
持续集成 https://www.ruby-toolbox.com/categories/continuous_testing
scp a_file x.x.x.x:~/
cat a_file | ssh x.x.x.x "cat - > a_file"
tar zcf - dir | ssh x.x.x.x "cat - > dir.tgz"
nc -l 8080 > dir.tgz
tar zcf - dir | nc x.x.x.x 8080
require 'socket'
host = 'localhost' # web服务器
port = 80 # 默认 HTTP 端口
path = "/data.json" # 想要获取的文件地址
# 这是个 HTTP 请求
request = "GET #{path} HTTP/1.0\r\n\r\n"
socket = TCPSocket.open(host,port) # 连接服务器
server {
listen 80;
server_name xxx;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering on;
vim ~/.gvm/scripts/install
GO_SOURCE_URL=https://github.com/golang/go
@zlei1
zlei1 / vimrc
Last active September 5, 2019 15:26
set nocompatible
filetype on
syntax on
set re=1
set ttyfast
set lazyredraw
" 设置主题
colorscheme molokai
查看物理cpu个数
cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
查看核心数量
grep 'core id' /proc/cpuinfo | sort -u | wc -l
cat /proc/cpuinfo | grep "cpu cores" | wc -l
Exception
NoMemoryError
ScriptError
LoadError
NotImplementedError
SyntaxError
SignalException
Interrupt
StandardError
ArgumentError