Skip to content

Instantly share code, notes, and snippets.

🤒
I may be slow to respond.

hetech ziyoung

🤒
I may be slow to respond.
Block or report user

Report or block ziyoung

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ziyoung
ziyoung / Run.java
Created Aug 7, 2019
Java 中注解可以添加在方法的参数上
View Run.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);
}
View docker-compose.yml
version: "3"
services:
my-db:
image: "mysql:5.7"
container_name: "my-db"
restart: always
environment:
MYSQL_ROOT_PASSWORD: 12345
volumes:
@ziyoung
ziyoung / docker-compose.yml
Last active Aug 22, 2019
快速搭建 elk
View docker-compose.yml
# 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 / send-mail.js
Created Jun 6, 2019
批量发送邮件
View send-mail.js
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 / note.md
Last active Apr 29, 2019
数组与指针的关系
View note.md

指针的介绍

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

指针并不是数组

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

@ziyoung
ziyoung / test-load.js
Created Apr 28, 2019
测试 element 中的 Markdown loader
View test-load.js
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 / delete-dangling-image.sh
Last active Apr 23, 2019
remove none docker image
View delete-dangling-image.sh
# 下面的这个命令更简洁一些,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 / dump-restore.md
Created Apr 11, 2019
mongo 数据导出以及导入
View dump-restore.md

数据导出

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

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

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

@ziyoung
ziyoung / build.sh
Last active Apr 11, 2019
构建自己的 element-ui 包
View build.sh
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
You can’t perform that action at this time.