Skip to content

Instantly share code, notes, and snippets.

View lazyjerry's full-sized avatar

Lazy Jerry lazyjerry

View GitHub Profile
@lazyjerry
lazyjerry / Nginx deny 設定.sh
Last active February 16, 2022 06:08
最後更新日期 2022-02-16
# 線上測試網址:https://nginx.viraptor.info/
# 設定檔案 .git
location ~* \.(log|ini|real|cfg|env|env_sample|bak|bk|old|save|swp|svn|git|DS_Store|gitignore|disable|sample|lock|sh|bat) { deny all; }
# 設定檔案 e.g. user.ini
location ~ .*\.(log|ini|real|cfg|env|env_sample|bak|bk|old|save|swp|svn|git|DS_Store|gitignore|disable|sample|lock|sh|bat) { deny all; }
# Git 等版本控制 \ cache
location ~* \.(git|svn|cache|bin|logs|backup|tests)/.*$ { deny all; }
@lazyjerry
lazyjerry / Codeigniter 的 Nginx 配置.sh
Created September 17, 2017 04:43
目前設定只有80 port的、php 7.1
server {
listen 80;
listen [::]:80;
server_name {{Server 名稱}};
access_log {{Log 路徑}}access.log;
error_log {{Log 路徑}}error.log;
root {{Server 路徑}};
@lazyjerry
lazyjerry / PHP Timezones.php
Created September 17, 2017 04:44
時間對應
$timezones = array(
'Pacific/Midway' => "(GMT-11:00) Midway Island",
'US/Samoa' => "(GMT-11:00) Samoa",
'US/Hawaii' => "(GMT-10:00) Hawaii",
'US/Alaska' => "(GMT-09:00) Alaska",
'US/Pacific' => "(GMT-08:00) Pacific Time (US & Canada)",
'America/Tijuana' => "(GMT-08:00) Tijuana",
'US/Arizona' => "(GMT-07:00) Arizona",
'US/Mountain' => "(GMT-07:00) Mountain Time (US & Canada)",
'America/Chihuahua' => "(GMT-07:00) Chihuahua",
@lazyjerry
lazyjerry / wordpress 密碼產生 .php
Last active September 17, 2017 04:46
可攜帶的,於 wp-includes/class-phpass.php 之中
<?php
/**
* Portable PHP password hashing framework.
* @package phpass
* @since 2.5.0
* @version 0.3 / WordPress
* @link http://www.openwall.com/phpass/
*/
#
sudo yum -y update
cd /tmp
sudo curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
查詢:
php -v
通常安裝列表:
apt-get install php7.1 php7.1-cli php7.1-common libapache2-mod-php7.1 php7.1-mysql php7.1-fpm php7.1-curl php7.1-gd php7.1-bz2 php7.1-mcrypt php7.1-json php7.1-tidy php7.1-mbstring php-redis php-memcached
yum install php70w-xml php70w-soap php70w-xmlrpc php70w-mbstring php70w-json php70w-gd php70w-mcrypt php70w-redis php-memcached php70w-mbstring php70w-tidy php70w-json php70w-bz2 php70w-curl php70w-fpm php70w-mysql php70w-common php70w-cli
停用防火牆
# systemctl mask firewalld
# systemctl stop firewalld
安裝
# yum install iptables-services
啟動及設定開機執行 iptables
# systemctl enable iptables
#取得前十名 access 最多的 IP 位址
cat access_log|awk '{print $1}'|sort|uniq -c|sort -nr|head -10
#取得前十名 access 最多的網頁
cat access_log|awk '{print $11}'|sort|uniq -c|sort -nr|head -10
#取得前十名下載流量最大的 zip 檔案
cat access.log |awk '($7~/\.zip/){print $10 " " $1 " " $4 " " $7}'|sort -nr|head -10
#取得前十名 Loading 最大的頁面 (大於60秒的 php 頁面)
find -name breakfast.txt 在工作目錄下,含裡面所有目錄,尋找 breakfast.txt
find /home/whale -name "*.txt" 在/home/whale目錄下找所有副檔名為txt的檔案名稱
find -type f -name "v*" 在工作目錄下,找開頭是v的一般檔案(不是目錄,不是link...)
find -type f -size +100k 在工作目錄下,找大於100k的檔案.
find -type f -ctime +2 在工作目錄下,找48小時前(2*48)建立(create)的檔案
find -type f -ctime 2 在工作目錄下,找介於前72小時到前48小時之間建立的檔案
$special_word_arr = ["☀", "☁", "☂", "☃", "☄", "☇", "☈", "☉", "☊", "☋", "☌", "☍", "☎", "☏", "☐", "☑", "☒", "☓", "✓", "✔", "✕", "✖", "✗", "✘", "☠", "☡", "☢", "☣", "☤", "☥", "☦", "☧", "☨", "☩", "☪", "☫", "☬", "☭", "☮", "☯", "☸", "☰", "☱", "☲", "☳", "☴", "☵", "☶", "☷", "۩", "۝", "۞", "♔", "♕", "♖", "♗", "♘", "♙", "♚", "♛", "♜", "♝", "♞", "♟", "☹", "☺", "☻", "☼", "☽", "☾", "☿", "♀", "♁", "♂", "♠", "♥", "♦", "♣", "♤", "♡", "♢", "♧", "♨", "〒", "♃", "♄", "♅", "♆", "♇", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓", "✁", "✂", "✃", "✄", "✆", "✇", "✈", "✉", "✌", "✍", "✎", "✏", "✐", "✑", "✒", "✙", "✚", "✛", "✜", "✝", "✞", "✟", "✠", "✡", "✢", "✣", "✤", "✥", "✦", "✧", "★", "☆", "✩", "✪", "✫", "✬", "✭", "✮", "✯", "✰", "✱", "✲", "✳", "✴", "✵", "✶", "✷", "✸", "✹", "✺", "✻", "✼", "✽", "✾", "✿", "❀", "❁", "❂", "❃", "❄", "❅", "❆", "❇", "❈", "❉", "❊", "❋", "❍", "❏", "❐", "❑", "❒", "❖", "❘", "❙", "❚", "❛", "❜", "❝", "❞", "❡", "❢", "❣", "❤", "❥", "❦", "❧", "!", "!", "¡", "‼", "‽", "?", "?", "¿", "#", "%", "&", "*", "~"