我正在使用jekyll直接在Github上的gh-pages分支上发布一个静态站点.我遇到的问题是我每次都跑
$ jekyll --no-auto /Users/khinester/Sites/tzm/
Run Code Online (Sandbox Code Playgroud)
这会覆盖.git目录,我必须重新创建:
$ git init-db
$ git add remote ..
$ git add .
$ git commit -a -m 'message'
$ git branch gh-pages && git checkout gh-pages
etc..
$ git push -f github gh-pages
Run Code Online (Sandbox Code Playgroud)
基本上我有主分支包含生成博客所需的文件和显示实际博客的gh-pages分支.
并且还要注意我必须强制推动这个.
能够版本控制更新会很高兴!
我已经阅读了https://github.com/mojombo/jekyll/wiki/Deployment,但这似乎比我现在做的更多步骤.
有没有更好的方法来做到这一点或我错过了什么.
我正在使用https://github.com/tj/n中的节点版本管理
$ node --version
v4.2.4
$ npm --version
1.3.1
Run Code Online (Sandbox Code Playgroud)
我已经删除了我的node_modules并试图运行,$npm install但我收到警告消息,如
npm WARN engine postcss@5.0.13: wanted: {"node":">=0.12"} (current: {"node":"v0.10.25","npm":"1.3.10"})
Run Code Online (Sandbox Code Playgroud)
我更新了我的packages.json以包括:
"engineStrict" : true,
"engines": {
"node": "4.2.4"
},
Run Code Online (Sandbox Code Playgroud)
任何建议非常感谢
我错过了什么
在mysql中,我有一个类似的查询:
mysql> SELECT user_id, count(user_id) as dup FROM addressbook GROUP BY user_id HAVING dup>20 ORDER BY dup;
Run Code Online (Sandbox Code Playgroud)
将返回:
+---------+------+
| user_id | dup |
+---------+------+
| 3052 | 21 |
| 996 | 23 |
| 46 | 25 |
| 2709 | 26 |
| 1756 | 28 |
| 43 | 30 |
| 224 | 30 |
| 98 | 32 |
| 289 | 35 |
| 208 | 40 |
| 888 | 43 | …Run Code Online (Sandbox Code Playgroud) 我有以下聚合查询
db.orders.aggregate(
{ "$project" :
{ _id : 0, "dateDay" :
{"$concat" : [
{"$substr" : [{"$dayOfMonth" : "$timestamp"}, 0, 2]}, "-",
{"$substr" : [{"$month" : "$timestamp"}, 0, 2]}, "-",
{"$substr" : [{"$year" : "$timestamp"}, 0, 4]}
] }
}
},
{ "$group" :
{ "_id" : "$dateDay", "Count" : { "$sum" : 1 } }
},
{ $sort : { "Count : 1 } }
);
Run Code Online (Sandbox Code Playgroud)
它返回类似:
{
"_id" : "3-9-2014",
"Count" : 81
},
{
"_id" : "14-12-2014", …Run Code Online (Sandbox Code Playgroud) 我正在尝试拆分以下ELB条目:
2018-04-16T08:09:27.203Z cae70dd2-414c-11e8-836a-354cb4985a41 https 2018-04-15T01:20:31.092381Z app/MBM-L-Publi-V9D386A91UNR/4695f2e72859f540 128.121.50.133:59367 10.0.1.14:80 0.001 0.003 0.000 200 200 934 282 "GET https://www.domain.tld:443/__utm.gif?v=1&_v=j66&a=1866784098&t=pageview&_s=1&dl=https%3A%2F%2Fwww.domain.tld%2Fnews%2Farchived%2Fresources-archived%22001-11%2F&ul=en-us&de=UTF-8&dt=Racal%20reborn%20after%20Thales%20buyout&sd=24-bit&sr=412x732&vp=404x732&je=0&cid=1296878891.1495497600&_gid=1908154735.1495497600&_r=1&z=821631926 HTTP/1.1" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 arn:aws:elasticloadbalancing:eu-west-2:123456789012:targetgroup/MBM-L-Cache-1LH0DNU489D55/167e4810f75804c3 "Root=1-5ad2a8df-021aaad5031047e7dec3f2fa" "www.domain.tld" "arn:aws:acm:eu-west-2:123456789012:certificate/1140cbb2-4d4f-44b0-a4d9-a79329c5e361" 0
Run Code Online (Sandbox Code Playgroud)
使用这个正则表达式:
const splitElbEntry = (elbLogEntry) => R.match(/\S+|"[^"]*"/g)(elbLogEntry.trim())
Run Code Online (Sandbox Code Playgroud)
但似乎没有工作https://regex101.com/r/JOlrxS/1
我喜欢在双引号中保留任何内容,例如
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Run Code Online (Sandbox Code Playgroud) 我有这个服务器块:
server {
server_name doamin.tld;
set $maintenance on;
if ($remote_addr ~ (127.0.0.1|10.1.1.10)) {
set $maintenance off;
}
if ($maintenance = on) {
return 503;
}
error_page 503 @maintenance;
location @maintenance {
root /var/www/html/global;
rewrite ^(.*)$ /holding-page.html break;
}
root html;
access_log logs/doamin.tld.access.log;
error_log logs/doamin.tld.error.log;
include ../conf/default.d/location.conf;
Run Code Online (Sandbox Code Playgroud)
}
将列表传递给$remote_addr而不是像这样编码(127.0.0.1 |等)的正确方法是什么?
我有以下代码:
package main
import (
"encoding/csv"
"fmt"
"io/ioutil"
"path"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
)
var (
// TOKEN = os.Getenv("TOKEN")
svc s3iface.S3API
)
func main() {
// Panics if there is an error in creating session
svc = s3iface.S3API(s3.New(session.Must(session.NewSession())))
lambda.Start(Handler)
}
func Handler(evt events.S3Event) error {
for _, rec := range evt.Records {
key := rec.S3.Object.Key
dir, file := path.Split(key)
// Download the file from S3
obj, err := svc.GetObject(&s3.GetObjectInput{
Bucket: aws.String(rec.S3.Bucket.Name),
Key: aws.String(key),
})
if err != …Run Code Online (Sandbox Code Playgroud) 我有以下 Makefile:
build: clean
${GOPATH}/bin/dep ensure
env GOOS=linux go build -o ./bin/status ./lib/status/main.go
elm-app build
init:
${GOPATH}/bin/dep init -v
test:
env GOOS=linux go test -v ./lib/status
strip:
strip ./bin/status
clean:
if [ -f ./bin/status ]; then
rm -f ./bin/status
fi
Run Code Online (Sandbox Code Playgroud)
但我明白了
if [ -f ./bin/status ]; then
/bin/sh: 1: Syntax error: end of file unexpected
Makefile:16: recipe for target 'clean' failed
make: *** [clean] Error 2
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
非常感谢任何建议
我继承了一个非常旧的应用程序,它是使用 ruby 1.8.7 和 postgres 构建的,我正在尝试为此创建一个 docker 映像。
从这个图像https://hub.docker.com/r/hublogix/minimal-ruby/ 我已将应用程序代码添加到图像中。
所以现在我在图像内部,我可以看到:
bash-4.3# ls
Capfile REVISION Rakefile app config config.ru db doc lib public script test tmp vendor
bash-4.3#
bash-4.3# gem install rake
Fetching: rake-12.3.1.gem (100%)
ERROR: Error installing rake:
rake requires Ruby version >= 2.0.0.
bash-4.3#
Run Code Online (Sandbox Code Playgroud)
config/environment.rb 是这样的:
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.16' unless defined? RAILS_GEM_VERSION …Run Code Online (Sandbox Code Playgroud)