Skip to content

Instantly share code, notes, and snippets.

View zxhfighter's full-sized avatar
🏠
Working from home

ski zxhfighter

🏠
Working from home
View GitHub Profile
@zxhfighter
zxhfighter / tar-exclude.md
Last active April 9, 2021 06:52
using `--exclude` in tar command

Mac 下打包排除目录,--exclude 参数必须紧跟在 tar 命令后边,否则不会生效。

tar --exclude="*.pkg" --exclude=".git" --exclude="node_modules*" -cvzf weirwood-node.tar.gz weirwood-node/

tar --exclude="*.pkg" --exclude="dist" --exclude="upload-files"  --exclude="log" --exclude="upload-files-source" --exclude="sourcemap-cache" --exclude=".git" --exclude="node_modules*" -cvzf weirwood-node.tar.gz weirwood-node/

CSP

什么是 CSP

CSP 是 Content-Security-Policy 的缩写,属于 HTTP 响应头。允许网站管理员控制允许用户代理为给定页面加载的资源。除少数例外,策略主要涉及指定服务器源和脚本端点。这有助于防止跨站点脚本攻击(XSS)。

语法

Content-Security-Policy: <policy-directive>; <policy-directive>
@zxhfighter
zxhfighter / terminal-git-branch-name.md
Created August 31, 2020 06:38 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@zxhfighter
zxhfighter / git-manual.md
Created August 26, 2020 10:02
compile git
@zxhfighter
zxhfighter / mysql-e.md
Created August 13, 2020 02:35
mysql -e
#!/bin/bash
 
HOSTNAME="192.168.111.84"                                           #数据库信息
PORT="3306"
USERNAME="root"
PASSWORD=""
 
DBNAME="test_db_test"                                                       #数据库名称
TABLENAME="test_table_test"                                            #数据库中表的名称
@zxhfighter
zxhfighter / mac-ffmpeg.md
Last active March 9, 2022 03:25
mac 安装 ffmpeg

直接安装

brew install ffmpeg

如果需要安装第三方 options,可以如下操作:

1.执行

@zxhfighter
zxhfighter / proxy.md
Created June 4, 2020 08:58
正向代理和反向代理

正向代理和反向代理

TLDR; 正向代理隐藏真实客户端,反向代理隐藏真实服务端。

正向代理

正向代理服务器代理的是客户端,为客户端收发请求,使真实客户端对服务器不可见。

客户端必须设置正向代理服务器,当然前提是要知道正向代理服务器的IP地址,还有代理程序的端口。