Skip to content

Instantly share code, notes, and snippets.

View wayou's full-sized avatar
👁️‍🗨️
NaN

牛さん wayou

👁️‍🗨️
NaN
View GitHub Profile
@wayou
wayou / file_statistic.sh
Created October 25, 2018 07:45
pirnt file number for each extension and the total file number
# with git:
git ls-files | wc -l | awk '{$1=$1;print $1 " total"}';git ls-files| sed 's/.*\.//' | sort | uniq -c | sort -r|awk '{$1=$1;print}'
# without git
find . -type f | wc -l | awk '{$1=$1;print $1 " total"}'; find . -type f | sed 's/.*\.//' | sort | uniq -c | sort -r|awk '{$1=$1;print}'
@wayou
wayou / find_replace_in_shell.md
Last active October 26, 2018 03:05
find and replace recursively for a directory using shell

Recursively find and replace with bash by leveraging the grep and sed command.

Syntax

grep -rlG <regexp pattern> <path> | xargs sed -i '' 's/pattern/replacement/g'

How it works

@wayou
wayou / h5_video_inline.html
Last active October 15, 2023 10:07
inline play video in h5 video
<video
id="video"
width="100%"
preload="auto"
x-webkit-airplay="true"
webkit-playsinline="true"
playsinline="true"
x5-video-player-type="h5"
x5-video-player-fullscreen="true"
src="https://video.c-ctrip.com/videos/u20j0z000000mjvtd0DB6.mp4"
// ==UserScript==
// @name baidu yun 资源链接
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 自动将google搜索结果页面中百度云盘地址变成可点击的链接,如果链接附近有提取码,在点击时自动复制
// @author You
// @match https://www.google.com/search*
// @grant none
// ==/UserScript==
// ==UserScript==
// @name set video playback rate
// @namespace http://tampermonkey.net/
// @version 0.1
// @description change the playback rate of the video
// @author wayou
// @match *://pan.baidu.com/*
// @match *://www.zealer.com/*
// @grant unsafeWindow
// @grant GM_addStyle
@wayou
wayou / vim_comment_tip.md
Last active January 25, 2019 05:13
comment/uncomment batch lines of code in vim

comment

  • go to the first line you want to comment
  • control + c enter visual mode
  • navigate to the last line you want to comment
  • shift + i enter edit mode
  • type the comment symbol #,// or whatever
  • press ESC twice to exit

uncomment

@wayou
wayou / .yarnrc
Last active December 16, 2023 11:45
配置 yarn 使用国内镜像进行安装的 rc 文件,将此文件放到项目根目录使用
registry "https://registry.npm.taobao.org"
disturl "https://npm.taobao.org/dist"
nvm_nodejs_org_mirror "http://npm.taobao.org/mirrors/node"
NODEJS_ORG_MIRROR "http://npm.taobao.org/mirrors/node"
sass_binary_site "http://npm.taobao.org/mirrors/node-sass"
electron_mirror "http://npm.taobao.org/mirrors/electron/"
SQLITE3_BINARY_SITE "http://npm.taobao.org/mirrors/sqlite3"
profiler_binary_host_mirror "http://npm.taobao.org/mirrors/node-inspector/"
node_inspector_cdnurl "https://npm.taobao.org/mirrors/node-inspector"
selenium_cdnurl "http://npm.taobao.org/mirrors/selenium"
@wayou
wayou / initial_project.sh
Created March 29, 2019 09:21
quick initial node projects with license, readme, gitignore,etc
npx license mit > LICENSE && npx gitignore node && npx covgen [email protected] && yarn init -y
@wayou
wayou / .npmrc
Last active January 16, 2025 15:19
配置 npm 及相关资源访问国内镜像的 npmrc
# package-lock=false
registry="https://registry.npm.taobao.org"
disturl="https://npm.taobao.org/dist"
nvm_nodejs_org_mirror="http://npm.taobao.org/mirrors/node"
nodejs_org_mirror="http://npm.taobao.org/mirrors/node"
sass_binary_site="http://npm.taobao.org/mirrors/node-sass"
electron_mirror="http://npm.taobao.org/mirrors/electron/"
SQLITE3_BINARY_SITE="http://npm.taobao.org/mirrors/sqlite3"
profiler_binary_host_mirror="http://npm.taobao.org/mirrors/node-inspector/"
node_inspector_cdnurl="https://npm.taobao.org/mirrors/node-inspector"
@wayou
wayou / emscripten.sh
Last active June 24, 2019 10:21
using emscripten from docker instead of installing locally
emcc_image="trzeci/emscripten";
if [[ "$(docker images -q $emcc_image:latest 2> /dev/null)" == "" ]]; then
docker pull emcc_image;
fi
alias emcc="docker run --rm -v "$(pwd):/src" $emcc_image emcc";
# test
emcc -v