Skip to content

Instantly share code, notes, and snippets.

View lazyjerry's full-sized avatar

Lazy Jerry lazyjerry

View GitHub Profile
<style>
* {
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
background: #0A0D26;
@lazyjerry
lazyjerry / JS 改變網址.txt
Created August 6, 2020 15:59
執行window.history.pushState
參考:http://frontenddev.org/article/html-5-pushstate-popstate-operating-history-no-refresh-to-change-the-current-url.html
// 當前的url為:http://qianduanblog.com/index.html
var json={time:new Date().getTime()};
// @狀態對象:記錄歷史記錄點的額外對象,可以為空
// @頁面標題:目前所有瀏覽器都不支持
// @可選的url:瀏覽器不會檢查url是否存在,只改變url,url必須同域,不能跨域
window.history.pushState(json,"","http://qianduanblog.com/post-1.html");</pre>
執行了pushState方法後,頁面的url地址為http://qianduanblog.com/post-1.html。
<script>
/**/
(function($){
var url1 = /(^|&lt;|\s)(www\..+?\..+?)(\s|&gt;|$)/g,
url2 = /(^|&lt;|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|&gt;|$)/g,
linkifyThis = function () {
var childNodes = this.childNodes,
i = childNodes.length;
while(i--)
private function random_string($length = 5, $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
if (!is_int($length) || $length < 0) {
return false;
}
$characters_length = strlen($characters) - 1;
$string = '';
for ($i = 0; $i < $length; $i++) {
$string .= $characters[mt_rand(0, $characters_length)];
}
@lazyjerry
lazyjerry / Nginx 防護設定 nginx config
Last active August 6, 2020 15:56
設定防止注入、檔案防護的機制。放在 nginx 的 server block 中
## 放在 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;
# 可能會有圖片 不能上傳的行為,參考: https://stackoverflow.com/questions/31610175/permission-on-files-created-by-nginx
# 複製行為,使用 --recursive 複製資料夾
#aws s3 cp /var/www/syi.news/upload/data/attachment/forum/threadcover/ s3://media.powpost.com/forum/threadcover/ --recursive
------------ 正文開始 ------
#!/bin/bash
#
# Push2 S3
$jp_last_names = ['佐藤', '鈴木', '高橋', '田中', '渡辺', '伊藤', '山本', '中村', '小林', '齋藤', '', '加藤', '吉田', '山田', '佐々木', '山口', '松本', '井上', '木村', '林', '清水', '山崎', '中島', '池田', '阿部', '(德川譜代)', '(徳川譜代)', '橋本', '山下', '森', '石川', '前田', '小川', '藤田', '岡田', '後藤', '長谷川', '石井', '村上', '近藤', '坂本', '遠藤', '青木', '藤井', '西村', '福田', '太田', '三浦', '藤原', '岡本', '松田', '中川', '中野', '原田', '小野', '田村', '竹內', '金子', '和田', '中山', '石田', '上田', '森田', '小島', '柴田', '原', '宮崎', '宫崎', '酒井', '工藤', '橫山', '横山', '宮本', '宫本', '內田', '内田', '高木', '安藤', '島田', '谷口', '大野', '高田', '丸山', '今井', '河野', '藤本', '村田', '武田', '上野', '杉山', '增田', '増田', '小山', '大塚', '平野', '菅原', '久保', '松井', '千葉', '岩崎', '櫻井', '桜井', '木下', '野口', '松尾', '菊地', '野村', '新井', '渡部', '佐野', '杉本', '大西', '古川', '濱田', '浜田', '市川', '小松', '高野', '水野', '吉川', '山內', '西田', '西川', '菊池', '北村', '五十嵐', '福島', '安田', '中田', '平田', '本田', '川崎', '飯田', '東', '服部', '澤田', '沢田', '久保田', '吉村', '中西', '岩田', '川口', '辻', '關', '関', '富田', '川上', '樋口', '永井', '松岡', '山中', '田口', '森本', '矢野', '秋山', '大島', '小澤', '小沢', '廣瀨', '広瀬', '土屋', '石原', '松下', '馬場', '大橋', '松浦', '吉岡', '
$special_word_arr = ["☀", "☁", "☂", "☃", "☄", "☇", "☈", "☉", "☊", "☋", "☌", "☍", "☎", "☏", "☐", "☑", "☒", "☓", "✓", "✔", "✕", "✖", "✗", "✘", "☠", "☡", "☢", "☣", "☤", "☥", "☦", "☧", "☨", "☩", "☪", "☫", "☬", "☭", "☮", "☯", "☸", "☰", "☱", "☲", "☳", "☴", "☵", "☶", "☷", "۩", "۝", "۞", "♔", "♕", "♖", "♗", "♘", "♙", "♚", "♛", "♜", "♝", "♞", "♟", "☹", "☺", "☻", "☼", "☽", "☾", "☿", "♀", "♁", "♂", "♠", "♥", "♦", "♣", "♤", "♡", "♢", "♧", "♨", "〒", "♃", "♄", "♅", "♆", "♇", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓", "✁", "✂", "✃", "✄", "✆", "✇", "✈", "✉", "✌", "✍", "✎", "✏", "✐", "✑", "✒", "✙", "✚", "✛", "✜", "✝", "✞", "✟", "✠", "✡", "✢", "✣", "✤", "✥", "✦", "✧", "★", "☆", "✩", "✪", "✫", "✬", "✭", "✮", "✯", "✰", "✱", "✲", "✳", "✴", "✵", "✶", "✷", "✸", "✹", "✺", "✻", "✼", "✽", "✾", "✿", "❀", "❁", "❂", "❃", "❄", "❅", "❆", "❇", "❈", "❉", "❊", "❋", "❍", "❏", "❐", "❑", "❒", "❖", "❘", "❙", "❚", "❛", "❜", "❝", "❞", "❡", "❢", "❣", "❤", "❥", "❦", "❧", "!", "!", "¡", "‼", "‽", "?", "?", "¿", "#", "%", "&", "*", "~"
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小時之間建立的檔案
#取得前十名 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 頁面)