Skip to content

Instantly share code, notes, and snippets.

@atez
atez / node-md5.js
Last active November 8, 2024 13:57
node.js大文件MD5值计算
var fs = require('fs');
var crypto = require('crypto');
var path = '/target/file.data';
var start = new Date().getTime();
var md5sum = crypto.createHash('md5');
var stream = fs.createReadStream(path);
stream.on('data', function(chunk) {
md5sum.update(chunk);
});
@atez
atez / node-random.js
Created July 11, 2016 09:02
node.js随机数
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {float} a random floating point number
*/
function getRandom(min, max) {
return Math.random() * (max - min) + min;
}
@atez
atez / genymotionwithplay.txt
Created July 13, 2016 11:06 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
set number
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
Bundle 'gmarik/vundle'
"my Bundle here:
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)) {
@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));
@atez
atez / git-stash.md
Created November 27, 2017 06:43
git stash用法

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

  • git stash

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

  • git stash save "message..."

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

#!/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 / 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:
@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"" %%*"