有照後鏡視野的自行車眼鏡
https://youtube.com/clip/Ugkx-HedLrLf9BMf_ao2UPkhtwRK7Xchuzx-?si=GPsNCj1qGP3RoKvb
有照後鏡視野的自行車眼鏡
https://youtube.com/clip/Ugkx-HedLrLf9BMf_ao2UPkhtwRK7Xchuzx-?si=GPsNCj1qGP3RoKvb
安裝套件
編輯設定
測試
打開防火牆
設定router的虛擬server
在CentOS 7上安装Squid代理服务器非常简单。你可以使用Yum包管理器来安装Squid。以下是具体的步骤:
要配置Squid代理服务器以仅允许特定IP地址来使用,你可以编辑Squid的配置文件并添加适当的ACL(Access Control List)和http_access规则。以下是如何配置Squid以仅允许特定IP地址使用的示例:
打开Squid的配置文件/etc/squid/squid.conf
:
bashsudo nano /etc/squid/squid.conf
在配置文件中找到并编辑http_access
部分。通常,这部分包括一系列http_access allow
和http_access deny
规则。
在http_access
规则之前,添加一个新的ACL规则以定义你要允许的IP地址。例如,要允许IP地址为192.168.1.100
的主机,可以添加以下行:
cssacl allow_ip src 192.168.1.100
在http_access
规则中,添加一条规则以允许特定ACL。例如,要允许allow_ip
ACL,可以添加以下行:
http_access allow allow_ip
这将允许ACL allow_ip
中列出的IP地址访问代理服务器。
在其他http_access
规则之后,确保添加http_access deny all
,以拒绝所有未明确允许的请求。
csshttp_access deny all
保存配置文件并退出文本编辑器。
重新加载Squid以应用更改:
sudo systemctl reload squid
现在,Squid代理服务器将仅允许192.168.1.100
(或你添加的其他IP地址)的主机来使用。确保按照需要添加和配置更多的ACL和http_access
规则,以满足你的具体访问控制需求。
同步口譯app的開發過程
iPhone
即時語音辨識用內建的就很強
private let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "zh-TW"))!
// private let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "ja-JP"))!
// private let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US"))!
// private let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "th-TH"))!
// private let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "vi-VN"))!
// private let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "ko-KR"))!
private var recognitionRequest: SFSpeechAudioBufferRecognitionRequest?
private var recognitionTask: SFSpeechRecognitionTask?
private let audioEngine = AVAudioEngine()
speechRecognizer.delegate = self
// Asynchronously make the authorization request.
SFSpeechRecognizer.requestAuthorization
可以參考xcode中的範例 SpokenWord
然後,翻譯的部分,我先嚐試用 google mlkit的翻譯,但翻譯品質很差,我打算改用google 雲端付費的api來試試,每月有50萬字的免費額度
google mlkit translate的作法
要先引用套件
pod 'GoogleMLKit/Translate', '4.0.0'
然後使用的方法是
var mytr: Translator?
let options = TranslatorOptions(sourceLanguage: .chinese, targetLanguage: .japanese)
mytr = Translator.translator(options: options)
let conditions = ModelDownloadConditions(
allowsCellularAccess: false,
allowsBackgroundDownloading: true
)
mytr?.downloadModelIfNeeded(with: conditions) { error in
guard error == nil else { return }
print("model ok")
// Model downloaded successfully. Okay to start translating.
}
self.mytr?.translate(self.tv_talk.text) { translatedText, error in
guard error == nil, let translatedText = translatedText else { return }
self.tv_my.text=translatedText
}
同樣也有範例參考 TranslateExample
使用OpenAI chatGPT技術, 根據公司公開重大訊息的內容做出解讀,主要是看這訊息對公司股東的影響,進而會不會影響到股價
用python寫一支可以取得5秒加權指數歷史資料的程式
import requests
import pandas as pd
import os
# 這個函數用來判斷要不要跳過某一行
def skip_rows(row):
return row.startswith("說明:") or row.startswith("民國")
def download_taiex_csv(date):
print(date+"下載轉換中")
url = f'https://www.twse.com.tw/exchangeReport/MI_5MINS_INDEX?response=csv&date={date}&type=csv'
response = requests.get(url)
tmpfilename = f'tmp{date}.csv'
with open(tmpfilename, 'w') as f:
f.write(response.text)
try:
df = pd.read_csv(tmpfilename, skiprows=1)
except ValueError:
print(f'No data available for {date}')
else:
df = df[['時間', '發行量加權股價指數']]
df.rename(columns={'發行量加權股價指數': '加權指數'}, inplace=True)
df['時間'] = df['時間'].apply(lambda x: x.replace('=', '').replace('"', ''))
df['時間'] = pd.to_datetime(df['時間'], errors='coerce')
df['時間'] = df['時間'].dt.strftime('%H:%M:%S')
df['加權指數'] = df['加權指數'].str.replace(',', '').astype(float)
df = df.dropna(subset=['時間'])
print(df.head())
# 儲存為CSV檔案
df.to_csv('taiex_%s.csv' % date, index=False)
os.remove(tmpfilename)
# 主程式
start_date = '20230329'
end_date = '20230401'
for date in pd.date_range(start_date, end_date):
download_taiex_csv(date.strftime('%Y%m%d'))
快速幫android studio app的畫面佈局,增加多國語言
可以參考這一篇說明
https://thumbb13555.pixnet.net/blog/post/333199480-supportdifferentlanguages
android上架後,下載的app icon為何變成內建小綠人,解決方法
不知道從哪個版本開始,android studio 把app icon 區分debug/release
據說是有助於開發人員識別
解決方法就是在res , 新建 image asset時
選好圖片的下一步,左上角會有選項顯示debug
這時去把這選項改為main就好了
Soup your photo 's privacy policy
Soup uses cameras and photo albums, which are only for the user's own operation and use, and will not do any collection and sharing, nor upload to the Internet.
Soup has tandem mobile ads using Google's admob
有可能是app沒有用到特別權限,所以xcode 未幫你註冊套件識別碼
這時只需要在xcode project -> target-> signing&Capabilities
隨意先新增一項,等xcode幫你註冊完成,再把這項刪掉就可以了
將chatGPT及Google Vision API應用在天地股票投資機器人(line)
主要是把圖片內的文字轉出來,再請openai,幫我做標題