Skip to content

Instantly share code, notes, and snippets.

View wgzhao's full-sized avatar

wgzhao wgzhao

  • China
View GitHub Profile
@wgzhao
wgzhao / default.tex
Created August 7, 2014 05:54
convert markdown to pdf with pandoc
%compile command
%pandoc -N --template=mytemplate.tex --variable mainfont=Georgia --variable sansfont=Arial \
% --variable fontsize=12pt --variable version=1.10 --variable monofont=Sans
%readme.md --latex-engine=xelatex --toc -o example14.pdf
\documentclass[$if(fontsize)$$fontsize$,$endif$,UTF8]{$documentclass$}
\usepackage{fixltx2e} % provides \textsubscript
\usepackage{xltxtra,xunicode}
\usepackage{graphics}
\usepackage{geometry}
\geometry{centering,paperwidth=180mm,paperheight=230mm,%
@wgzhao
wgzhao / zbc_create_screen.py
Last active November 2, 2018 18:47
Create a zabbix screen by specific item or graph
#!/usr/bin/env python
# encoding:utf8
__Author__ = 'zhaoweiguo<wgzhao@gmail.com>'
'''
create zabbix screen,specified graph name,rows x cols
script will get all hosts whose include graph name ,then write screens and screens_items table
Usage: $0 -s <screen name> -g <graph name> [ -c <cols> ] [-d ] [ -t ]
'''
from optparse import OptionParser
@wgzhao
wgzhao / rpm_build_env.txt
Created September 15, 2013 03:30
rpm build variables
%define _prefix /opt/app/{APPNAME}
%define _exec_prefix %{_prefix}
%define _bindir %{_exec_prefix}/bin
%define _sbindir %{_exec_prefix}/sbin
%define _libexecdir %{_exec_prefix}/libexec
%define _datadir %{_prefix}/share
%define _sysconfdir %{_prefix}/etc
%define _sharedstatedir %{_prefix}/com
%define _localstatedir %{_prefix}/var
%define _lib lib
@wgzhao
wgzhao / online_python_editor
Created September 15, 2013 03:29
online python editor
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/python");</script>
server {
listen 8880;
server_name gollum;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://localhost:9090;
access_log /var/log/nginx/gollum.access.log;
<table>
<thead>
<tr valign="top">
<th>
<p align="center">机器名</p>
</th>
<th>
<p align="center">要备份的文件</p>
</th>
<th>
@wgzhao
wgzhao / amrecover.sh
Created January 4, 2013 02:35
amanda recovery shell
amrecover> listdisk
200- List of disk for host cp3.domain.com
201- /opt/www/sites
200 List of disk for host cp3.domain.com
amrecover> setdisk /opt/www/sites
200 Disk set to /opt/www/sites.
amrecover> ls
2009-04-13-17-49-11 newltf/
2009-04-13-17-49-11 lawburn/
2009-04-13-17-49-11 hnnoritz/
@wgzhao
wgzhao / amanda-client.conf
Created January 4, 2013 02:34
sample Amanda client configuration file.
#
# amanda.conf - sample Amanda client configuration file.
#
# This file normally goes in /etc/amanda/amanda-client.conf.
#
conf "FileBackup" # your config name
index_server "cp1.domain.com" # your amindexd server
tape_server "cp1.domain.com" # your amidxtaped server
@wgzhao
wgzhao / slot_status
Created January 4, 2013 02:33
amand tape slot status
amtape FileBackup show
amtape: scanning all 25 slots in tape-changer rack:
slot 5: time 20090413030002 label FileBackup-05
slot 6: time X label FileBackup-06
slot 7: time X label FileBackup-07
slot 8: time X label FileBackup-08
slot 9: time X label FileBackup-09
slot 10: time X label FileBackup-10
slot 11: time X label FileBackup-11
slot 12: time X label FileBackup-12
@wgzhao
wgzhao / makelabel.sh
Created January 4, 2013 02:32
create amand backup server device label
-su-3.2$ for (( i=1;$i < =9;i++)); do amlable FileBackup FileBackup-0$i slot $i;done
labeling tape in slot 1 (file://yourpath/FileBackup/slots):
Reading label...
Found an empty tape.
Writing label FileBackup-01..
Checking label...
Success!
labeling tape in slot 2 (file://yourpath/FileBackup/slots):
Reading label...
Found an empty tape.