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 / 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 / re-simple.sh
Created December 30, 2011 02:24
shell regular expression sample
bash$ cat textfile
This is line 1, of which there is only one instance.
This is the only instance of line 2.
This is line 3, another line.
This is line 4.
bash$ grep 'the' textfile
This is line 1, of which there is only one instance.
This is the only instance of line 2.
This is line 3, another line.
@wgzhao
wgzhao / ctrl-h.sh
Created December 30, 2011 03:05
Special Characters with shell
#!/bin/bash
# Embedding Ctl-H in a string.
a="^H^H" # Two Ctl-H's -- backspaces
# ctl-V ctl-H, using vi/vim
echo "abcdef" # abcdef
echo
echo -n "abcdef$a " # abcd f
# Space at end ^ ^ Backspaces twice.
echo
@wgzhao
wgzhao / datediff.sql
Created August 15, 2012 06:51
create simple date diff function ,can return the number of years/months/days between two date
--
create or replace function datediff(m text,d1 date,d2 date) returns int as $$
declare
d1_year int;
d1_month int;
d2_year int;
d2_month int;
day int;
@wgzhao
wgzhao / books_grid.xml
Last active December 10, 2015 10:09
图书馆图书信息,xml格式保存
<?xml version='1.0' encoding='utf-8' ?>
<?xml-stylesheet type='text/xsl' href='grid.xsl' ?>
<all_books>
<book>
<分类号>TN01</分类号>
<书名>模拟电子技术</书名>
<作者>胡宴如主编</作者>
<版次></版次>
<出版社>高等教育出版社</出版社>
<出版时间>2000.8</出版时间>
@wgzhao
wgzhao / grid.xsl
Created December 31, 2012 11:22
解析books_grid.xml文件,并带分页功能
<?xml version="1.0" encoding="utf-8" ?>
<!--
/**********************************************
图书管理系统 v1.0
作者: 赵卫国
联系方式: mlsx@cie.xtu.edu.cn http:/www.xplore.cn
完成时间: 2004年4月
************************************************/
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
@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 / amandaclient
Created January 4, 2013 02:30
The Amanda backup client should be enabled for systems which will be backed up by an Amanda backup server.
# default: on
#
# description: The Amanda backup client should be enabled for systems
# which will be backed up by an Amanda backup server.
service amanda
{
disable = no
flags = IPv6
socket_type = stream
@wgzhao
wgzhao / amandserver
Created January 4, 2013 02:27
Amanda services configuration
# default: on
#
# description: Amanda services for Amanda server and client.
#
service amanda
{
disable = no
# flags = IPv6
socket_type = stream