Skip to content

Instantly share code, notes, and snippets.

View wgzhao's full-sized avatar

Steven Zhao wgzhao

  • China
View GitHub Profile
@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 / 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/
<table>
<thead>
<tr valign="top">
<th>
<p align="center">机器名</p>
</th>
<th>
<p align="center">要备份的文件</p>
</th>
<th>
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;
@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>
@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 / 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<[email protected]>'
'''
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 / 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 / rmkernl.sh
Created November 12, 2014 06:49
remove all old kernel image for Debian
sudo aptitude remove $(dpkg -l linux-image* linux-headers* |grep ^ii |grep -v `uname -r` |awk '{print $2}')
@wgzhao
wgzhao / snowflake.py
Created July 31, 2018 13:29
python implementation of twitter snowflake
#!/usr/bin/env python3
import time
from uuid import getnode as get_mac
from sqlalchemy import create_engine
import flask
"""
基于twitter的雪花算法生成不重复,且具有自增的流水号
该算法参考 https://github.com/twitter/snowflake
"""