Skip to content

Instantly share code, notes, and snippets.

@gotnix
gotnix / agent.sls
Created January 16, 2015 06:29
zabbix/agent.sls
zabbix-agent:
pkg.purged:
- names:
- zabbix-agent
- zabbix
- zabbixzone-release
pkg.installed:
- name: zabbix22-agent
file.managed:
- name: /etc/zabbix_agentd.conf
@gotnix
gotnix / proc.sql
Last active August 29, 2015 14:07
测试 name_const 函数对 Replication 的影响
/*
问题是出现在MySQL 5.1 为Master MySQL 5.5 为Slave 的Replication 环境中,
报Bug的有很多,MySQL 5.5 之间主从复制也可能会出现。比如下面2个:
http://bugs.mysql.com/bug.php?id=34289
http://bugs.mysql.com/bug.php?id=57926
http://bugs.mysql.com/bug.php?id=69292
MySQL 参考手册:
http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html#function_cast
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_concat
@gotnix
gotnix / Property.java
Last active December 23, 2019 16:27
通过 JVM 系统属性使 Tomcat .war 包读取外部目录的配置。
/*
通过 JVM 系统属性使 Tomcat .war 包读取外部目录的配置,方便线上部署。演示命令:
java -Dapp_name.conf.dir=/var/www/config/app_name/ \
-Dapp_name.log.dir=/var/log/app_name/ \
Property
*/
// Property.java
import java.util.Properties;
@gotnix
gotnix / ftp_useradd.sh
Last active December 23, 2019 16:27
增、删、查 vsftpd 虚拟用户(基于Berkeley DB)
#!/bin/bash
#
# add Vsfptd Virtual User via Berkeley DB
#
vu_home='/data/ftp/'
#vu_home='/tmp/ftp/'
conf_dir='/etc/vsftpd/'
#conf_dir='/tmp/vsftpd/'
vu_conf="${conf_dir}vsftpd_user_conf/"
@gotnix
gotnix / tz_init.sh
Last active August 29, 2015 14:05
Bash 脚本常用自定义函数,希望以后能多多更新
#!/bin/bash
#
#set -x
#######################################
# 检查目录是否为空目录
# Globals:
# None
# Arguments:
# dir: 待检查的目录
@gotnix
gotnix / tidy_dirs.sh
Created June 6, 2014 02:29
清理过期日志
#!/bin/bash
#
# SCRIPT: tidy_dirs.sh
# AUTHOR: Terry.Zheng
# E-MAIL: jfhgmv@gmail.com
# DATE: Thu Jan 23 10:08:29 2014
# REV: 1.0.A (Valid are A, B, D, T and P)
# (for Alpha, Beta, Dev, Test and Production)
#
# PLATFORM: GNU/Linux (SPECIFY: AIX, FreeBSD, GNU/Linux, HP-UX, Solaris
@gotnix
gotnix / tmux_pre.sh
Last active February 2, 2026 11:37
tmux 准备工作环境
tmux new-session -d -n GoAgent -s back 'python /opt/goagent/local/proxy.py' \; \
new-window -d -c '~/' -n ROOT 'su -' \; \
new-window -d -c '~/' -n iRuby 'irb' \; split-window -d -c '~/' -h -p 50 -t back:3.0 \; \
new-window -d -c '/tmp/t1/' -n TEMP \; \
select-window -t back:2 \; attach
@gotnix
gotnix / test-zh.ad
Last active August 29, 2015 13:56
Test chinese support for Asciidoctor 0.1.4
= 测试 asciidoctor 对中文的支持程度
San Zhang <san.zhang@example.com>; 李四 <si.li@example.com>
:description: Test chinese support for Asciidoctor 0.1.4
:icons: font
:source-highlighter: highlightjs
:linkcss!:
:numbered:
:idprefix:
:toc: right
:experimental:
@gotnix
gotnix / bash.bashrc.local
Last active January 15, 2019 08:01
Bash Prompt, RHEL/CentOS 的路径为 /etc/profile.d/file_name.sh,openSUSE 不同。
#!/bin/bash
#
# local6.* /var/log/bash.log
#
# 历史文件的行数
readonly HISTFILESIZE=5000
# history 命令显示的行数
readonly HISTSIZE=500
# 历史命令的时间格式
@gotnix
gotnix / setenv.sh
Last active December 23, 2019 16:29
set tomcat enviroment
#!/bin/bash
# Set java options for performance and monitor.
## Use `Concurrent Mark Sweep (CMS) Collector' .
#-XX:+UseConcMarkSweepGC \
#-XX:+UseParNewGC \
#
## Use `Garbage First (G1) Garbage Collector' .
# https://dev.qq.com/topic/5747b32ece67c4495539d338 超详细G1垃圾收集器介绍
# http://blog.jobbole.com/109170/ 深入理解 Java G1 垃圾收集器