Skip to content

Instantly share code, notes, and snippets.

View atez's full-sized avatar
🍉

atez

🍉
  • GuangZhou
View GitHub Profile
@atez
atez / windows-terminal.reg
Last active May 15, 2020 10:51
windows terminal添加到右键菜单
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="Windows Terminal Here"
"Icon"="%USERPROFILE%\\AppData\\Local\\Terminal\\terminal.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
@="C:\\Users\\用户名\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"
@atez
atez / git.sh
Created September 24, 2019 13:47
修改git历史记录的邮箱和用户名
#!/bin/sh
git filter-branch -f --env-filter '
OLD_NAME="oldName"
OLD_EMAIL="oldMail"
CORRECT_NAME="newName"
CORRECT_EMAIL="newMail"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]

借助git快速批量转换CRLF到LF


换行符的差异

  • windows下每行结尾为回车+换行(CR+LF),即 \r\n
  • unix和macOS下每行结尾为换行LF,即 \n
  • classic macOS(最后一个版本为1999年发布的Mac OS 9,可忽略)下为回车,即 \r

设置jetbrain系IDE

settings > Editor > Code Style > Line Separator > unix and macOS (\n)

@atez
atez / hash.reg
Created May 9, 2019 03:15
给windows右键菜单加入文件哈希校验
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\文件哈希校验]
"SubCommands"="MACTripleDES;MD5;RIPEMD160;SHA1;SHA256;SHA384;SHA512"
"MUIVerb"="文件哈希校验"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MACTripleDES]
@atez
atez / sublime_addright.inf
Created April 17, 2019 09:21
Sublime Text 3 右键
[Version]
Signature="$Windows NT$"
[DefaultInstall]
AddReg=SublimeText3
[SublimeText3]
hkcr,"*\\shell\\SublimeText3",,,"用 SublimeText3 打开"
hkcr,"*\\shell\\SublimeText3","Icon",0x20000,"%1%\sublime_text.exe, 0"
hkcr,"*\\shell\\SublimeText3\\command",,,"""%1%\sublime_text.exe"" ""%%1"" %%*"
@atez
atez / docker-compose.yml
Created April 16, 2019 09:54
gogs-drone-docker-compose
version: "2"
services:
gogs:
container_name: gogs
image: gogs/gogs
ports:
- 3000:3000
volumes:
- ./data/gogs/data:/data
environment:
#!/usr/bin/env groovy
def call(String buildResult) {
if ( buildResult == "SUCCESS" ) {
slackSend color: "good", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was successful"
}
else if( buildResult == "FAILURE" ) {
slackSend color: "danger", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was failed"
}
else if( buildResult == "UNSTABLE" ) {
@atez
atez / git-stash.md
Created November 27, 2017 06:43
git stash用法

git stash用于保存和恢复工作进度

  • git stash

    保存当前的工作进度。会分别对暂存区和工作区的状态进行保存

  • git stash save "message..."

这条命令实际上是第一条 git stash 命令的完整版

@atez
atez / js-random-pasword.js
Last active March 28, 2017 16:32
js-random-pasword
/*
*@desc randPassword 生成随机密码
*@params {Object} -option
*@params {Number} -option.len 密码长度,默认8位
*@params {Boolean} -option.special 是否包含特殊字符,默认不包含
*/
function randPassword(option) {
let arr = ['abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1234567890', '~!@#$%^&*()_+";",./?<>'];
const rand = (min, max) => {
let num = Math.floor(Math.max(min, Math.random() * max));
const fs = require('fs');
fs.watchFile('./test.txt', function (cur, pre) {
if (!pre.isFile() && cur.isFile()) {
console.log('==>file created');
}
else if (pre.isFile() && !cur.isFile()) {
console.log('==>file deleted');
}
else if (pre.isFile() && cur.isFile() && Date.parse(pre.mtime) !== Date.parse(cur.mtime)) {