鍍金池/ 問(wèn)答/ Linux問(wèn)答
陌離殤 回答

記事本不認(rèn)\n只認(rèn)\r\n,要嘛你換編輯器查看,要嘛你改程序把換行都換成\r\n,和bat沒(méi)關(guān)系

朕略萌 回答
  1. 密碼不對(duì)(如果用密碼的話)
  2. 公鑰不對(duì)(如果用公鑰的話)
  3. 禁止 root 密碼登陸
  4. 禁止 root 遠(yuǎn)程登陸

等等,以上這些情況都可能造成無(wú)法登錄

哚蕾咪 回答

方案1, 用post-update勾子

使用下面的post-update文件:
將您的.git目錄復(fù)制到 web 服務(wù)器上
在本地副本中, 修改.git/config 文件并將 web 服務(wù)器添加為遠(yuǎn)程:

[remote "production"]
url = username@webserver:/var/www/html/.git

在服務(wù)器上, 用下面的文件替換.git/hooks/post-update

添加對(duì)文件的執(zhí)行訪問(wèn)權(quán)限 (再次, 在服務(wù)器上):

chmod +x .git/hooks/post-update

現(xiàn)在, 只需在本地推送到您的 web 服務(wù)器, 它應(yīng)該自動(dòng)更新工作副本:

git push production
#!/bin/sh
#
# This hook does two things:
#
#  1. update the "info" files that allow the list of references to be
#     queries over dumb transports such as http
#
#  2. if this repository looks like it is a non-bare repository, and
#     the checked-out branch is pushed to, then update the working copy.
#     This makes "push" function somewhat similarly to darcs and bzr.
#
# To enable this hook, make this file executable by "chmod +x post-update". 
git-update-server-info 
is_bare=$(git-config --get --bool core.bare) 
if [ -z "$is_bare" ]
then
      # for compatibility's sake, guess
      git_dir_full=$(cd $GIT_DIR; pwd)
      case $git_dir_full in */.git) is_bare=false;; *) is_bare=true;; esac
fi 
update_wc() {
      ref=$1
      echo "Push to checked out branch $ref" >&2
      if [ ! -f $GIT_DIR/logs/HEAD ]
      then
             echo "E:push to non-bare repository requires a HEAD reflog" >&2
             exit 1
      fi
      if (cd $GIT_WORK_TREE; git-diff-files -q --exit-code >/dev/null)
      then
             wc_dirty=0
      else
             echo "W:unstaged changes found in working copy" >&2
             wc_dirty=1
             desc="working copy"
      fi
      if git diff-index --cached HEAD@{1} >/dev/null
      then
             index_dirty=0
      else
             echo "W:uncommitted, staged changes found" >&2
             index_dirty=1
             if [ -n "$desc" ]
             then
                   desc="$desc and index"
             else
                   desc="index"
             fi
      fi
      if [ "$wc_dirty" -ne 0 -o "$index_dirty" -ne 0 ]
      then
             new=$(git rev-parse HEAD)
             echo "W:stashing dirty $desc - see git-stash(1)" >&2
             ( trap 'echo trapped $$; git symbolic-ref HEAD "'"$ref"'"' 2 3 13 15 ERR EXIT
             git-update-ref --no-deref HEAD HEAD@{1}
             cd $GIT_WORK_TREE
             git stash save "dirty $desc before update to $new";
             git-symbolic-ref HEAD "$ref"
             )
      fi 
      # eye candy - show the WC updates :)
      echo "Updating working copy" >&2
      (cd $GIT_WORK_TREE
      git-diff-index -R --name-status HEAD >&2
      git-reset --hard HEAD)
} 
if [ "$is_bare" = "false" ]
then
      active_branch=`git-symbolic-ref HEAD`
      export GIT_DIR=$(cd $GIT_DIR; pwd)
      GIT_WORK_TREE=${GIT_WORK_TREE-..}
      for ref
      do
             if [ "$ref" = "$active_branch" ]
             then
                   update_wc $ref
             fi
      done
fi

方案2,用rsync

git ls-files -z | rsync --files-from - --copy-links -av0 . user@server.com:/var/www/project

原文參考:
https://stackoverflow.com/a/3...

葬愛(ài) 回答

linux服務(wù)器的mysql如果在服務(wù)器可以連接通常,并確保你的3306端口已經(jīng)對(duì)外開(kāi)放的情況下,需要給數(shù)據(jù)庫(kù)的user表添加一個(gè)遠(yuǎn)程連接的用戶,其Host字段必須為%。這里給你一個(gè)操作的文章CentOS 下 mysql 數(shù)據(jù)庫(kù)無(wú)法訪問(wèn)的處理方式

文章的后半部分介紹了如何添加遠(yuǎn)程連接的方法,希望對(duì)你有所幫助!

心悲涼 回答

swap使用的計(jì)算是以free為準(zhǔn)的,不是available,假設(shè)swappiness=m

free -m (total) / 100 = A

1-10*94/100=-8.4

按說(shuō)你的swap如果足夠大的話會(huì)有8.4G 被使用。

玄鳥(niǎo) 回答

是不是你服務(wù)器不穩(wěn)定,剛好趕上蜘蛛抓取到維護(hù)頁(yè)面。

逗婦惱 回答

delete dom.style.color 應(yīng)該可以吧。

舊顏 回答

典型的 Ruby 項(xiàng)目根目錄下都會(huì)有 Gemfile 文件,這個(gè)項(xiàng)目沒(méi)有,另外檢查了下這個(gè)項(xiàng)目里的 ruby 文件,返現(xiàn)只有兩個(gè)腳本,從文件名猜測(cè)只是輔助性的腳本文件,并非重要文件,所以據(jù)此推斷這不是一個(gè)以 Ruby 為主的項(xiàng)目。

clipboard.png

筱饞貓 回答

我覺(jué)得可以利用git hook機(jī)制,先推到origin/master,然后cherry pick 到 Central/master。然后把這幾步驟寫(xiě)成一個(gè)shell腳本,簡(jiǎn)單明了

默念 回答

平均一下,每秒寫(xiě)入約22M(80 * 1000 / 3600),IO不算高。

單盤(pán)普通的SAS盤(pán),每秒順序?qū)懽钌僖灿?00多M,服務(wù)器上的硬盤(pán)陣列,RAID 5最少也是3塊盤(pán),普通的服務(wù)器就可以滿足要求。

慢半拍 回答
var script = "";
    script += "var a = 0;\n";
    script += "debugger;";
    script += "a++;";
    script += "console.log(a)";
    
var blob = new Blob([script] , {
    type: 'text/javascript'
});
var src = URL.createObjectURL(blob);
var w = new Worker(src);

加 n debugger 斷點(diǎn)調(diào)試可以不??
或者寫(xiě) 一個(gè) 函數(shù) 在 blob 內(nèi)部 一下 debugger

薄荷綠 回答

@fengdui 有一句評(píng)論說(shuō)得好,Redis操作要搬出去。

方法一:

// 把10個(gè)元素return出去讓外面的調(diào)用者去調(diào)Redis,別占用同步塊的時(shí)間
public synchronized List<Object> countPv(...) {
  ...
}

方法二:開(kāi)個(gè)線程池去異步發(fā)Redis,但是機(jī)器重啟會(huì)丟失來(lái)不及發(fā)送的數(shù)據(jù)

if (pvList.size() > 10) {
        //前10個(gè)打包成任務(wù)扔給線程池
        senderExecutor.execute(new SendTask(new ArrayList<>(pvList.subList(0,10)))); //當(dāng)場(chǎng)復(fù)制了subList
        pvList.subList(0,10).clear(); //這行要移到這里,這可能就是你丟數(shù)據(jù)的原因
}
筱饞貓 回答

$ git clone https://github.com/simuhui/li...
$ cd library
$ composer install
$ php init

上面就是步驟啊
首先下載下來(lái),如果不用命令的話,可以下載壓縮包
解壓
進(jìn)入libary
$ composer install
$ php init

笑浮塵 回答

都是選中的,你的name又是相同的,所以只能是最后一個(gè)選中了;
你需要把索引傳進(jìn)去,對(duì)指定的項(xiàng)設(shè)置選中,其他項(xiàng)取消選中

吃藕丑 回答

不是pm2 start pm2.json么?
啟動(dòng)腳本呢

不討囍 回答
最近的服務(wù)器呢?

這是偽命題吧,難道不是選最快的?自己寫(xiě)個(gè)簡(jiǎn)單的速度測(cè)試邏輯就可以了。

櫻花霓 回答

獲取本機(jī)內(nèi)網(wǎng)IP

def get_host_ip():
    with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
        s.connect(('8.8.8.8', 80))
        return s.getsockname()[0]

獲取本機(jī)外網(wǎng)IP

import requests
ip = requests.get('http://ip.cip.cc/').text
替身 回答

今天我也遇到了這個(gè)問(wèn)題,我是判斷數(shù)組的長(zhǎng)度是否大于0,因?yàn)関ue和layui的渲染速度不一樣

墨小羽 回答

或許是你版本太老了,現(xiàn)在都6.多了