This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#============================================================================== | |
#TITLE: mysql_backup.sh | |
#DESCRIPTION: script for automating the daily mysql backups on development computer | |
#AUTHOR: tleish | |
#DATE: 2013-12-20 | |
#VERSION: 0.4 | |
#USAGE: ./mysql_backup.sh | |
#CRON: | |
# example cron for daily db backup @ 9:15 am |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 禁用第二層以上目錄的 php 檔案 | |
location ~* /(.*)([^/]+)/(.*)\.php$ { | |
deny all; | |
} | |
# 禁用 index.php 以外的 php 檔案 | |
location ~ ^/(?!index\.php).*\.php$ { | |
deny all; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ^~ /downloads/ { | |
add_header Content-Disposition attachment; | |
add_header Content-Type application/octet-stream; | |
sendfile on; # 开启高效文件传输模式 | |
autoindex on; # 开启目录文件列表 | |
autoindex_exact_size on; # 显示出文件的确切大小,单位是bytes | |
autoindex_localtime on; # 显示的文件时间为文件的服务器时间 | |
charset utf-8,gbk; # 避免中文乱码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<phpdocumentor | |
configVersion="3" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="https://www.phpdoc.org"> | |
<!-- 文件標題 --> | |
<title>API 文件</title> | |
<paths> | |
<!-- 文件和快取路徑,以該檔案位置為基準 --> | |
<output>docs/Document</output> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"country_code":{"US":"美國","CA":"加拿大","UK":"英國","AF":"阿富汗","AR":"阿根廷","AT":"奧地利","AU":"澳大利亞","BH":"巴林","BD":"孟加拉","BE":"比利時","BT":"不丹","BO":"玻利維亞","BR":"巴西","KH":"柬埔寨","CM":"喀麥隆","CN":"中國","AI":"安圭拉","AG":"安地瓜","AW":"阿魯巴","BM":"百慕達","DO":"多明尼加","GD":"格瑞那達","LC":"聖盧西亞","CO":"哥倫比亞","SG":"新加坡","CG":"剛果共和國","CH":"瑞士","DE":"德國","DK":"丹麥","EG":"埃及","ES":"西班牙","SV":"薩爾瓦多","FI":"芬蘭","FJ":"斐濟","FR":"法國","GE":"喬治亞","GH":"迦納","GR":"希臘","GT":"瓜地馬拉","GY":"蓋亞那","HT":"海地","HN":"宏都拉斯","HK":"香港","IN":"印度","IS":"冰島","ID":"印尼","IQ":"伊拉克","IE":"愛爾蘭","IT":"義大利","JM":"牙買加","JO":"約旦","KZ":"哈薩克","KE":"肯亞","JP":"日本","KP":"韓國","KW":"科威特","LU":"盧森堡","MO":"澳門","MK":"馬其頓","MG":"馬達加斯加","ML":"馬來西亞","MV":"馬爾地夫","MX":"墨西哥","MA":"摩洛哥","NO":"挪威","NR":"諾魯","NZ":"紐西蘭","NI":"尼加拉瓜","NG":"奈及利亞","PK":"巴基斯坦","PA":"巴拿馬","PG":"巴布亞紐幾內亞","PT":"葡萄牙","PY":"巴拉圭","RO":"羅馬尼亞","RU":"俄羅斯","RW":"盧旺達","SA":"沙烏地阿拉伯","SY":"敘利亞","SC":"塞席爾","LK":"斯里蘭卡","SD":"蘇丹","SE":"瑞典","TL":"泰國","TW":"台灣","TO":"湯加群島","TR":"土耳其","UG":"烏干達","UA":"烏克蘭","AE":"阿拉伯聯合大公國","UY":"烏拉圭","UZ" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// bcadd — 两个任意精度数字的加法计算 | |
// bccomp — 比较两个任意精度的数字 | |
// bcdiv — 两个任意精度的数字除法计算 | |
// bcmod — 任意精度数字取模 | |
// bcmul — 两个任意精度数字乘法计算 | |
// bcpow — 任意精度数字的乘方 | |
// bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus | |
// bcscale — 设置/获取所有 bc math 函数的默认小数点保留位数 | |
// bcsqrt — 任意精度数字的二次方根 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 放在 server 區塊中,也可以獨立一個檔案讀取 | |
## ref: https://www.howtoforge.com/nginx-how-to-block-exploits-sql-injections-file-injections-spam-user-agents-etc | |
## Block SQL injections | |
set $block_sql_injections 0; | |
if ($query_string ~ "union.*select.*\(") { | |
set $block_sql_injections 1; | |
} | |
if ($query_string ~ "union.*all.*select.*") { | |
set $block_sql_injections 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 根目錄,作為放置統一 git 上層目錄 | |
F_PATH=放一個路徑; | |
# 行程 ID 檔案路徑 | |
PID_FILE=$F_PATH/deploy.pid; | |
# 檢查行程 ID 檔案是否存在 | |
if [ -f $PID_FILE ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set $limit_bots 0; | |
if ($http_user_agent ~ ^$|FCKFK|no-store|WordPress\/) | |
{ | |
set $limit_bots 1; | |
} | |
if ($http_accept ~ ms-powerpoint) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function resize($newWidth, $targetFile, $originalFile) { | |
$info = getimagesize($originalFile); | |
$mime = $info['mime']; | |
switch ($mime) { | |
case 'image/jpeg': | |
$image_create_func = 'imagecreatefromjpeg'; | |
$image_save_func = 'imagejpeg'; |
NewerOlder