用sed替换一些单/双引号文本有一些困难,并且想知道这两个例子的正确方法是什么
从中更改Memached.ini文件内容
[server]
server[] = "localhost:11211"
Run Code Online (Sandbox Code Playgroud)
至
[server]
server[] = "localhost:11211"
server[] = "localhost:11212"
Run Code Online (Sandbox Code Playgroud)
并从中更改这些行的memcache.php文件内容
define('ADMIN_USERNAME','username'); // Admin Username
define('ADMIN_PASSWORD','password'); // Admin Password
$MEMCACHE_SERVERS[] = 'mymemcache-server1:11211'; // add more as an array
$MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'; // add more as an array
Run Code Online (Sandbox Code Playgroud)
至
define('ADMIN_USERNAME','myusername'); // Admin Username
define('ADMIN_PASSWORD','mypassword'); // Admin Password
$MEMCACHE_SERVERS[] = 'localhost:11211'; // add more as an array
$MEMCACHE_SERVERS[] = 'localhost:11212'; // add more as an array
Run Code Online (Sandbox Code Playgroud)
我试过这个例子
sed -i 's/'ADMIN_USERNAME','memcache'/'ADMIN_USERNAME','u'/g' /var/www/html/memcache.php
Run Code Online (Sandbox Code Playgroud)
当命令运行时,memcache.php文件根本没有改变?
我已经在http://www.gnu.org/software/parallel/man.html#example__calling_bash_functions上阅读了这个例子,但是,是否可以使用gnu parallel调用2个函数,这些函数没有传递给它们的任何变量?
例
a() {
echo "download a"
wget fileA
}
b() {
echo "download b"
wget fileB
}
Run Code Online (Sandbox Code Playgroud)
并使用parallel来调用这两个函数a&b?
目前,我正在抓取远程站点的XML feed并在我的服务器上保存本地副本以便在PHP中进行解析.
问题是如何在PHP中添加一些检查以查看feed.xml文件是否有效,如果是,请使用feed.xml.
如果错误无效(有时远程XML提供某些显示空白feed.xml),请从之前的抓取/保存中提供feed.xml的备份有效副本?
代码抓取feed.xml
<?php
/**
* Initialize the cURL session
*/
$ch = curl_init();
/**
* Set the URL of the page or file to download.
*/
curl_setopt($ch, CURLOPT_URL,
'http://domain.com/feed.xml');
/**
* Create a new file
*/
$fp = fopen('feed.xml', 'w');
/**
* Ask cURL to write the contents to a file
*/
curl_setopt($ch, CURLOPT_FILE, $fp);
/**
* Execute the cURL session
*/
curl_exec ($ch);
/**
* Close cURL session and file
*/
curl_close ($ch);
fclose($fp);
?>
Run Code Online (Sandbox Code Playgroud)
到目前为止只有这个加载它 …
我现有的 Github 存储库因 zip 和 tar.gz 文件而变得臃肿,因此我想将其迁移到启用了 Git LFS 的新存储库,该存储库与现有的 Github 存储库分开进行测试,以便现有的 Github 存储库不受影响。我遇到了一个很棒的工具,名为 bfg-repo-cleaner https://github.com/rtyley/bfg-repo-cleaner,看起来正是我需要的!
我编制了我认为需要执行的步骤,但希望有第二双眼睛来确保这些步骤是正确的。
原始现有存储库在哪里https://github.com/username/source.git,启用 Git LFS 的新目标存储库在哪里https://github.com/username/destination-lfs.git
pass=PERSONAL_ACCESS_TOKEN
ORIGINAL="https://github.com/username/source.git"
REPONAME_ORIGINAL='source.git'
NEW="https://username:"${pass}"@github.com/username/destination-lfs.git"
REPONAME_NEW='destination-lfs.git'
# setup local work space
mkdir -p /home/workgit
cd /home/workgit
# download bfg
wget -cnv http://repo1.maven.org/maven2/com/madgag/bfg/1.12.12/bfg-1.12.12.jar -O bfg.jar
alias bfg='/bin/java -jar bfg.jar'
# setup local git
git clone --mirror "$ORIGINAL" "$REPONAME_NEW"
cd $REPONAME_NEW
git count-objects -v
git remote rename origin upstream
git remote add origin $NEW
git …Run Code Online (Sandbox Code Playgroud)