我正在开发一个扩展程序,它将在所有 Google 搜索 URL 上执行特定操作 - 但不会在其他网站或 Google 页面上执行。在自然语言中,匹配模式是:
'*://')'www'或'')'google''.com')和多部分国家/地区 TLD(例如'.co.uk')'/search?'许多人说“匹配所有谷歌搜索页面使用的内容,"*://*.google.com/search?*"但这显然是不正确的,因为它不会匹配 google.co.uk 等国家顶级域名 (TLD)”。
因此下面的代码根本不起作用:
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
alert('This never happens');
}, {
urls: [
"*://*.google.*/search?*",
"*://google.*/search?*",
],
types: ["main_frame"]
},
["blocking"]
);
Run Code Online (Sandbox Code Playgroud)
使用"*://*.google.com/search?*"as 匹配模式确实有效,但我担心我需要每个 Google 本地化的列表才能成为有效的策略。
给定一个包含一些文件列表的文本文件,例如
$ cat file_list.txt
/var/x/file1.txt
/var/y/file2.txt
<etc>
Run Code Online (Sandbox Code Playgroud)
如何根据某些标准对文件列表进行排序 - 例如上次访问时间或上次更改时间?
提前致谢。
我使用官方的MySQL docker镜像。这是一个极好的形象!但是我很难从实例中导出数据而没有错误。我这样运行导出:
docker run -it --link containername:mysql --rm mysql sh -c
'exec mysqldump
-h"$MYSQL_PORT_3306_TCP_ADDR"
-P"$MYSQL_PORT_3306_TCP_PORT" -uroot
-p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"
dbname'
| gz > output.sql.gz
Run Code Online (Sandbox Code Playgroud)
但是,这会导致警告:
"mysqldump: [Warning] Using a password on the command line interface can be insecure."
Run Code Online (Sandbox Code Playgroud)
作为输出文件的第一行。显然,这稍后会给用于消耗数据的任何其他MySQL进程造成问题。
有什么办法可以抑制来自mysqldump客户的警告?
我有以下代码,它从环境 (.env) 文件中读取值并将它们存储为事实:
- name: Read values from environment
shell: "source {{ env_path }}; echo $DB_PASSWORD"
register: output
args:
executable: /bin/bash
changed_when: false
- name: Store read password
set_fact:
db_password: "{{ output.stdout }}"
when:
- db_password is undefined
changed_when: false
- name: Read values from environment
shell: "source {{ env_path }}; echo $DB_USER"
register: output
args:
executable: /bin/bash
changed_when: false
- name: Store read user
set_fact:
db_user: "{{ output.stdout }}"
when:
- db_user is undefined
changed_when: false
- name: Read …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个 Dockerfile 来按照安装指南自动安装 HumHub: https: //www.humhub.org/docs/guide-admin-installation.html
但是,每当构建脚本运行 Composer 时,我都会收到以下错误:
Changed current directory to /root/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing fxp/composer-asset-plugin (v1.1.1)
Downloading: Connecting... Failed to download fxp/composer-asset-plugin from dist: Could not authenticate against github.com
Now trying to download from source
- Installing fxp/composer-asset-plugin (v1.1.1)
Cloning daca454b94539a4e6d30937dfc6b817eceb03f28
Writing lock file
Generating autoload files
Loading composer repositories with package information
Updating dependencies (including require-dev)
Failed to clone the git@github.com:jquery/jquery-dist.git repository, try …Run Code Online (Sandbox Code Playgroud) 我正在尝试像这样导入和使用 python 枕头库:
from urllib.request import urlopen
import PIL
from PIL import Image, ImageFont, ImageDraw
import re
image = Image.open(urlopen("http://randomurl.com/randomimage.jpg"))
draw = ImageDraw.Draw(image)
font = ImageFont.truetype("sans-serif.ttf", 16)
draw.text((0, 0),"This is the future liberals want",(255,255,255),font=font)
image.save('sample-out.jpg')
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下错误:
/opt/bot/app # python cli.py
Retrieving column Image ID on worksheet History
Traceback (most recent call last):
File "cli.py", line 38, in <module>
font = ImageFont.truetype("sans-serif.ttf", 16)
File "/usr/local/lib/python3.7/site-packages/PIL/ImageFont.py", line 260, in truetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/usr/local/lib/python3.7/site-packages/PIL/ImageFont.py", line 135, in __init__ …Run Code Online (Sandbox Code Playgroud) python python-imaging-library python-3.x docker alpine-linux
我正在为一个主要网站实施WCAG accessiblity报告.可以预见,其中一个反复出现的问题是表格中的标签.
到目前为止,我已经假设将表单标签与其元素相关联的正确方法是在标签的表单属性中使用input元素的名称,如下所示:
<label for="name[1]">Your name: </label>
<input type="text" name="name[1]" placeholder="Your name">
Run Code Online (Sandbox Code Playgroud)
但是,客户端使用的框架更喜欢吐出这样的代码:
<label for="user_first_name">Your name: </label>
<input type="text" name="name[1]" id="user_first_name" placeholder="Your name">
Run Code Online (Sandbox Code Playgroud)
我的逻辑基于这样的理解:并非所有表单元素都具有"ID"属性,允许它们被DOM独特地操纵(例如CSS和Javascript),但所有 POST和GET方法表单元素都具有"名称"允许将数据提交到远程服务器的属性,这是客户端浏览器表单的最常见用途.
我不想向客户提交PR,因为他们错误地理解标签标签中"for"属性的目的,这将导致他们在下一次WCAG审核时失败.
那是哪个呢?
docker ×3
alpine-linux ×1
ansible ×1
bash ×1
composer-php ×1
datetime ×1
dockerfile ×1
forms ×1
git ×1
git-clone ×1
html ×1
javascript ×1
label ×1
mysql ×1
mysqldump ×1
python ×1
python-3.x ×1
sorting ×1