/ip firewall address-list add list=blacklist address=xxx.xxx.xxx.xxx/24
/ip firewall address-list add list=blacklist address=xxx.xxx.xxx.xxx-xxx.xxx.xxx.xxx
設定 raw:
/ip firewall raw add chain=prerouting action=drop src-address-list=blacklist

ghostyguo 發表在 痞客邦 留言(0) 人氣()

參考影片: https://www.youtube.com/watch?v=WDlZ3f2xHcc
先安裝 visual studio code:
sudo apt install code

ghostyguo 發表在 痞客邦 留言(0) 人氣()

最近東西都漲價了, 拿出以前的 Rpi3, 買了一款 Rpi3 用的觸控LCD: https://www.jmaker.com.tw/products/product194
微雪原廠連結: https://www.waveshare.net/wiki/3.5inch_RPi_LCD_(A)#.E8.AE.BE.E7.BD.AE.E6.98.BE.E7.A4.BA.E6.96.B9.E5.90.91

ghostyguo 發表在 痞客邦 留言(0) 人氣()

有個 HMI OS 的構想, 買了一片 ESP32-S2-Kaluga-1 Kit 來用, 這片是 ESP32-S2, ES_IDF 預設是 ESP32, 如果沒有設定 target, 編譯後無法上傳. 紀錄一下設定/編譯/燒錄的指令:ESP
進入 example project 目錄後 (例如 C:\Espressif\frameworks\esp-idf-v4.4.1\examples\get-started\blink) :

ghostyguo 發表在 痞客邦 留言(0) 人氣()

原本有一塊 RPI3, 最近拿起來使用, 發現 package 無法 update, 查網路得知 source 已經搬家, 所以需要更改 /etc/apt/source.list 的內容, 將 mirrordirector.raspbian.org 替換為 legacy.raspbian.org/raspbian:


deb http://legacy.raspbian.org/raspbian/ jessie main contrib non-free rpi


# deb http://.raspbian.org/raspbian/ jessie main contrib non-free rpi


# Uncomment line below then 'apt-get update' to enable 'apt-get source'


#deb-src http://legacy.raspbian.org/raspbian/ jessie main contrib non-free rpi




ghostyguo 發表在 痞客邦 留言(0) 人氣()

最近有些網路應用, 想把流量分開, 不要讓所有流量都進到同一個路由器, 由於 HiNet 只提供一個固定 IP, 只能給一個路由器使用, 如果另一個路由器用 PPPOE 取得浮動 IP, 可透過這個固定 IP 下的網站來進行轉址. 本例中, 浮動 IP 端使用樹莓派當伺服器, 使用 python3 環境, 固定 IP 端為一般 PC, 安裝 xampp (apache+php+mysql).

PC端在 htdocs 下建立一個 smartcenter 目錄, 放3個 php 檔

ghostyguo 發表在 痞客邦 留言(0) 人氣()

undefined
 記錄一下 3/23 1:06 台東規模 5.4 地震與:3/23 1:41 花蓮地震規模 6.6

ghostyguo 發表在 痞客邦 留言(0) 人氣()

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 11 08:55:28 2021

ghostyguo 發表在 痞客邦 留言(0) 人氣()

 最近預計會有一些製作網頁的需求, 學著用 bootstrap5 chart.js, 碰到一些問題, 上網搜尋解答, 解決後做個紀錄

  Html head 加入 cdn:

ghostyguo 發表在 痞客邦 留言(0) 人氣()

undefined
掃描子目錄, 自動建立連結標籤, 例如將  startbootstrap 系列的範例解開放在子目錄下:

ghostyguo 發表在 痞客邦 留言(0) 人氣()

最近讀到股市投資 "超級績效" 系列, 裡面有一段關於勝率與獲利/虧損組合的計算, 提到虧損造成的傷害具有幾何累績性, 其實獲利也是幾何累積的, 為釐清其中的比例關係, 確定作者的觀點是如何計算出來的, 因此寫了一段程式來驗證看看.



def stockgain(win_gain, lost_gain, win_count, lost_count):


    #totalcount = wincount + lostcount


    gain = 1


    for i in range(win_count):


        gain = gain * (1+win_gain)


    for i in range(lost_count):


        gain = gain * (1-lost_gain)


    return gain-1


 


print("win_gain lost_gain   win:20%   win:30%   win:40%   win:50%   win:60%    win:70%")


print("-------- ---------   -------   -------   -------   -------   -------    -------")


 


for gain in range(4, 101, 2):


    win_gain = gain/100


    lost_gain = win_gain/2


    g2 = stockgain(win_gain, lost_gain, 2, 8)*100


    g3 = stockgain(win_gain, lost_gain, 3, 7)*100


    g4 = stockgain(win_gain, lost_gain, 4, 6)*100


    g5 = stockgain(win_gain, lost_gain, 5, 5)*100


    g6 = stockgain(win_gain, lost_gain, 6, 4)*100


    g7 = stockgain(win_gain, lost_gain, 7, 3)*100


    print("{:6.2f}%  {:6.2f}%    {:7.2f}%  {:7.2f}%  {:7.2f}%  {:7.2f}%  {:7.2f}%   {:7.2f}%".format(win_gain*100, lost_gain*100, g2, g3, g4, g5, g6, g7))




ghostyguo 發表在 痞客邦 留言(0) 人氣()

去年氣象局網頁改版為響應式網頁後, 這篇爬蟲已經過期, 一直沒時間更新, 這次使用 python + selenium + beautifulsoup, 使用 webdriver之chromedriver, 讓chrome選擇UI設定後, 從網頁內容爬取資料. 程式先將每個月的彙整表拉出來, 因為新版彙整表資訊不完整, 缺少經緯度等資料, 所以須開啟每一個地震的詳細資料頁, 重新爬一次

ghostyguo 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。