Skip to content

Instantly share code, notes, and snippets.

View ziyoung's full-sized avatar
🤒
I may be slow to respond.

hetech ziyoung

🤒
I may be slow to respond.
  • 上海浦东
View GitHub Profile
@ziyoung
ziyoung / build.sh
Last active April 11, 2019 06:48
构建自己的 element-ui 包
set -ex
# npm 也支持 git 仓库的,你也可以不打包
git clone --branch=dev --depth=1 https://github.com/ElemeFE/element.git
cd element && yarn
npm run dist && npm run pack
@ziyoung
ziyoung / dump-restore.md
Created April 11, 2019 09:05
mongo 数据导出以及导入

数据导出

导出本地数据最方便,指定数据库以及导出的路径即可。

mongodump --db some-database --out som-directory

导出远端数据的,指定 uri。

@ziyoung
ziyoung / delete-dangling-image.sh
Last active April 23, 2019 10:17
remove none docker image
# 下面的这个命令更简洁一些,docker image ls -f "dangling=true" -q
IMAGES=`docker images -f "dangling=true" -q`
docker rmi $IMAGES
# 更为简洁的命令
docker rmi -f $(docker images --filter "dangling=true" -q --no-trunc)
@ziyoung
ziyoung / test-load.js
Created April 28, 2019 09:30
测试 element 中的 Markdown loader
const genInlineComponentText = require('./build/md-loader/util').genInlineComponentText;
const template = '<el-input v-model="input" placeholder="请输入内容"></el-input>';
const script = `
export default {
data() {
return {
input: ''
}
@ziyoung
ziyoung / note.md
Last active April 29, 2019 10:09
数组与指针的关系

指针的介绍

  • 指针仅仅是指向计算机中的某个地址,并带有类型限定符。
  • 你可以对一个指针使用数组的语法来访问指向的东西,也可以对数组的名字做指针的算数运算。
  • 你应该每次尽可能使用数组,并且按需将指针用作提升性能的手段。

指针并不是数组

无论怎么样,你都不应该把指针和数组混为一谈。它们并不是相同的东西,即使C让你以一些相同的方法来使用它们

@ziyoung
ziyoung / send-mail.js
Created June 6, 2019 07:41
批量发送邮件
const nodemailer = require('nodemailer');
const config = require('./config.json');
const wait = () => new Promise(resolve => setTimeout(resolve, 800));
async function main() {
let transporter = nodemailer.createTransport({
host: "email.example.com",
port: 587,
secure: false, // true for 465, false for other ports
@ziyoung
ziyoung / docker-compose.yml
Last active August 22, 2019 02:31
快速搭建 elk
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
version: '3'
services:
es01:
image: elasticsearch:7.2.0
container_name: es01
environment:
- node.name=es01
- discovery.seed_hosts=es02
- cluster.initial_master_nodes=es01,es02
@ziyoung
ziyoung / docker-compose.yml
Created August 1, 2019 12:11
MySQL container
version: "3"
services:
my-db:
image: "mysql:5.7"
container_name: "my-db"
restart: always
environment:
MYSQL_ROOT_PASSWORD: 12345
volumes:
@ziyoung
ziyoung / Run.java
Created August 7, 2019 03:39
Java 中注解可以添加在方法的参数上
public class Run {
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
static @interface QueryParam {
String value();
}
public void testAnnotation(@QueryParam("action") String action) {
System.out.printf("action is %s\n", action);
}
@ziyoung
ziyoung / Makefile
Created June 26, 2020 13:53
go build flag
# go build link
PKG_NAME = github.com/ziyoung/repo
GO_LDFLAGS = -X ${PKG_NAME}/pkg.Var=123
build:
go build -ldflags "${GO_LDFLAGS}" -o file ./some-file.go