Skip to content

Instantly share code, notes, and snippets.

View dz1984's full-sized avatar

Donald Zhan dz1984

View GitHub Profile
@dz1984
dz1984 / aNobii.php
Created August 9, 2013 07:52
簡介aNobii的API Methods
define('KEY','your_key');
define('SECRET','your_secret');
define('SIG',md5(KEY.SECRET));
define('PARAM','api_key='.KEY.'&api_sig='.SIG);
define('SHELF_API','http://api.anobii.com/shelf/getSimpleShelf?');
define('ITEM_API','http://api.anobii.com/item/getInfo?');
define('AUTHOR_API','http://api.anobii.com/contributor/getInfo?');
//取得書籍的作者
function getAuthor($authorid,$itemid){
@dz1984
dz1984 / makePHP.sh
Created August 9, 2013 07:56
會抓資料夾已經產生多少Code file,再新增一個套用Template格式的空白Code file。
#!/bin/bash
# Create more PHP source file on batch processing.
usage="makePHP.sh number\n\tnumber - set up quantity files.";
#echo "Argument lenght is $#";
if [ $# -gt 1 ] || [ $# -eq 0 ]; then
# Display help message.
echo -e $usage;
@dz1984
dz1984 / CreatePHPLinks.sh
Created August 9, 2013 07:57
產生index.html網頁,將資料夾下所有的Code File全部建立結連結,可以快速在各程式間移動。
@dz1984
dz1984 / bashrc
Last active April 29, 2022 20:52
Ubuntu Setting.
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@dz1984
dz1984 / nginx
Last active December 24, 2015 04:09
Init.d script for nginx on Cent OS. This is what is distributed with the Nginx RPM from EPEL.
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@dz1984
dz1984 / goPHPConfig.sh
Last active December 24, 2015 04:09
Configure the modules.
./configure \
--build=x86_64-redhat-linux-gnu \
--host=x86_64-redhat-linux-gnu \
--target=x86_64-redhat-linux-gnu \
--program-prefix= \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
@dz1984
dz1984 / goNginxConfig.sh
Created September 29, 2013 13:14
Configure Nginx modules.
./configure \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_geoip_module
@dz1984
dz1984 / Stack.go
Created October 13, 2013 15:28
Implement the Stack and Queue class through "container/list" package. golang version: 1.2
package main
import (
"container/list"
"fmt"
"sync"
)
// Define Stack class
type Stack struct {
@dz1984
dz1984 / LS_Memo.md
Last active December 31, 2015 05:59
學習寫LiveScript的起手式,可以從Version History看到慢慢增加練習的過程。

Learn to LiveScript Memo

Install

Install LiveScript to Global Env.

npm install -g LiveScript
#!/usr/bin/env python
import matplotlib.mlab as mlab
from matplotlib.pyplot import figure, show
import numpy as np
x = np.arange(0.0, 2, 0.01)
y1 = np.sin(2*np.pi*x)
y2 = 1.2*np.sin(4*np.pi*x)
fig = figure()