2018年5月5日 星期六

aborted: Could not create SSL/TLS secure channel.....

從PowerShell下載東西時,無法順利下載

錯誤訊息如下:

aborted: Could not create SSL/TLS secure channel.....

以下指令有解掉此問題
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

(New-Object System.Net.WebClient).DownloadFile("欲下載的連結", "欲存放的路徑")


2018年4月29日 星期日

PCMAN自動登入

筆記一下自動登入PTT的操作


登入站台後選擇修改目前連線的設定值


當連線收到"請輸入代碼",設定自動回覆帳號 (^M表示鍵入Enter)


當連線收到"請輸入您的密碼",設定自動回覆密碼 (下方用密碼保護自動回覆的文字內容可選可不選)


有時候重複登入會卡在確認是否刪除其他重複連線,這邊自動回覆Y/n都可以



請按任意鍵繼續,這邊如果不想看之前登入的IP,想直接跳過就自動回覆Enter(^M)



2018年2月10日 星期六

Chocolatey套件管理 開發機測試機快速建置

做為一個要開發又要兼顧設備的可憐攻城屍,趕案子同時又要幫其他人設置機器的情景是三天兩頭都會碰到的事情,僅開設VM還好處理,有做過快照以及範本映像檔五分鐘內就可以馬上起一台測試機環境出來。不過若是個人電腦就很麻煩,為確保開發環境乾淨,整台重灌是最保險的方式(老舊的開發環境常有legacy package殘留),流動率越高重灌次數也就越頻繁,確保重灌用的快照不必常常重裝software,找了以下這個工具。


需求

  • Windows 7+ / Windows Server 2003+
  • PowerShell v2+
  • .NET Framework 4+ (如果沒有的話,安裝Chocolatey時會自動安裝)

安裝 Chocolatey

安裝步驟

    1. 以系統管理員開啟CMD或PowerShell
    2. 複製下面的指令
    3. 貼上指令至命令視窗,並按下Enter執行
    4. 等指令執行完畢
    5. 沒出現任何錯誤就表示安裝完畢了

Install with cmd.exe

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Install with PowerShell.exe

With PowerShell, there is an additional step. You must ensure Get-ExecutionPolicy is not Restricted. We suggest using Bypass to bypass the policy to get things installed or AllSigned for quite a bit more security.
  • Run Get-ExecutionPolicy. If it returns Restricted, then run Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass -Scope Process.
  • Now run the following command:  (copy command text)
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Additional considerations

NOTE: Please inspect https://chocolatey.org/install.ps1 prior to running any of these scripts to ensure safety. We already know it's safe, but you should verify the security and contents of any script from the internet you are not familiar with. All of these scripts download a remote PowerShell script and execute it on your machine.We take security very seriously. Learn more.
  只要執行下列指令,建議第一次安裝都先執行看看
  choco upgrade chocolatey

移除 Chocolatey

  See uninstall.

安裝範例

  choco install docker
  choco install ruby --version 1.8.7.37402
  choco uninstall nodejs.install --all-versions

移除範例

  choco uninstall docker notepadplusplus googlechrome

顯示本機安裝過的套件

  choco list --local-only

查詢較舊的案件

  • 後面帶-s就會以該url來檢查套件版本

  choco outdated
  choco outdated -s https://somewhere/out/there
  choco outdated -s "'https://somewhere/protected'" -u user -p pass



2018年1月24日 星期三

很簡單,但是每次都忘記

姓名的英文

  • Last Name
  • First Name

Chrome瀏覽器

  • 叫出app列表

Windows

  • Windows 以系統管理員身分執行CMD
  • Win+R然後Ctrl+Shift+Enter
  • Windows 8/10完整關機
  • 按住Shift再點擊關機

資料庫

  • ORDER BY
  •  ASC 代表結果會以由小往大的順序列出
  • DESC 代表結果會以由大往小的順序列出
  • 如果兩者皆沒有被寫出的話,那預設就會用 ASC

Google試算表

  • 插入列(Windows)
  • Ctrl + Alt + =
  • 插入列(Mac)
  • ⌘ + Option + =




2018年1月21日 星期日

筆記

常用指令

網路除錯
# 清除DNS快取
  ipconfig /flushdns
# tracert指令檢查網路停止點
  tracert 8.8.8.8 > C:\tracert.txt

CMD
CMD直接下載檔案
  說明:-t是重試次數1次、-T是逾時時間1秒、-O指定檔名
  wget -t 1 -T 1 -O test.zip https://github.com/download/test.zip
CMD解壓縮
  壓縮一個文件 makecab D:/test.txt D:/test.zip
  解壓一個文件 expand D:\home\test.zip

Linux

# 刪除資料夾↓
  sudo rm -r foo/
# 改名↓
  sudo mv foo foo_ori_1012
  sudo mv webpack.config.js webpack.config.js_1012
# 查詢使用port↓
  sudo lsof -i :3000 | grep LISTEN
# 移除佔用port↓
  sudo kill $(sudo lsof -t -i:3000)
# 列出所有程序↓
  ps aux
  sudo kill 16406
# 傳送資料夾↓
  pscp -r -pw password C:\ssm\locales user@127.0.0.1:/home/social/ssm
# linux傳送至windows
  #pscp root@192.168.2.8:/srv/docker/gitlab d:\gitlab
# = = = 防火牆設定(centOS 7) = = = 
# 開啟6379port --permanent為設置永久
  firewall-cmd --zone=public --add-port=6379/tcp --permanent
# 確認防火牆是否開啟
  firewall-cmd --zone=public --list-all
# 重新讀取 firewall 設定
  firewall-cmd --reload

修改網路設定 $ sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
# post-up iptables-restore < /etc/iptables.up.rules

auto eth1
iface eth1 inet static
address 192.168.2.184
netmask 255.255.255.0
# geteway 192.168.2.1

網路重啟
sudo /etc/init.d/networking restart
sudo ifdown eth0 && sudo ifup eth0
sudo ifdown eth1 && sudo ifup eth1

Linux Screen
# To create a new screen with the name foo, use
screen -S foo  # Then to reattach it, run
screen -r foo  # or use -x, as in
screen -x foo  # for "Multi display mode" (see the man page)


Windows快捷

  • Win + x  = windows選單
  • Win + r  = 執行
  • Win + CTRL + c = 灰階顯示 (win10)


2017年11月25日 星期六

Windows Subsystem for Linux 脫離Beta

Windows Subsystem for Linux脫離Beta惹

What’s new in WSL in Windows 10 Fall Creators Update

Windows 10版本更新至1709

>更新...
>更新......
>更新.........跑很久

在Windows 10更新版本後,啟用 WSL 不需要再使用開發者模式

控制台\程式集\程式和功能
>開啟或關閉Windows功能
>適用於 Linux 的 Windows 子系統


>啟用後重新啟動系統

Microsoft Store
>Ubuntu
即可直接下載啟用

打開時需要一段時間安裝

然後設置使用者帳號以及密碼

>安裝完成
>lsb_release -a 查看Ubuntu Version
Distributor ID: Ubuntu
Description:     Ubuntu 16.04.3 LTS
Release:           16.04
Codename:       xenial

接著即可直接安裝所需的開發套件,而GUI目前在WSL尚不支援

在WSL上啟用的服務並不會持續在背景執行,當Session皆關閉後即會關閉

重新開啟後,也並不會自動啟動,所以不太適合當作常駐的環境使用

而在WSL下,本機的磁碟會被掛載在/mnt目錄下

很適合Windows開發環境部署測試使用,可以直接以WSL執行所需測試的程式

減少開發環境差異所造成的一些低能問題...

至今我還是很納悶某些人開發環境的配置

之前曾參與的專案有個很莫名的配置↓↓↓

開發機環境(Windows) = 測試機環境(Windows) ≠ 正式機環境(Linux)

常常碰到上頭很臨時的要求部署上新功能

然後開發機和測試機都沒問題,一上正式機就碰釘子,而且屢試不爽

開發測試和正式機環境皆一致當然是最好

但開發機很難更換,畢竟還是會受限於公司會綁定一些軟體僅限於Windows,且內部伺服器大部分皆為Windows Server的時候,也只能照著公司的配置使用。

雖然曾提議將測試機改用Linux環境,卻得到"太麻煩"、"有必要嗎?"等回應

開發環境不先搞好出問題卻又怪東怪西#$%^&*...唉...

至少搭配WSL多少可以減少一些環境差異的變異因子,在開發時就能提早發現

(不過我的還是Windows 7 QQ,公司換新機前我應該早就已經離開了...)

搭配VS Code

在終端機設定加入
"terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\bash.exe",
即可直接以WSL的shell啟用,取代原先的windows powershell

其餘問題可以在 Microsoft github WSL issues 尋找或提出

2017年11月17日 星期五

Smokeping 簡單使用

SmokePing官方網站

SmokePing 是一個監測網路延遲並且呈現視覺化圖表的開源軟件 開發者為Tobi Oetiker
以下以GCP上的VM環境做安裝,OS為Debian GUN/Liunx 9.2
首先檢查更新並安裝所需工具
sudo apt-get update
sudo apt-get install smokeping
sudo apt-get install curl
至smokeping資料夾目錄底下
cd /etc/smokeping/config.d/
在此需要修改pathnames、Probes、Targets主要的三個檔案

*** pathnames ***

將sendmail註解(在此不使用通知功能)
#sendmail = /usr/sbin/sendmail


使用Fping來做檢測,可在此新增檢查執行的時間間隔或次數的設定
在此每隔300秒為一區間,做10次檢測

*** Probes ***

+ FPing
binary = /usr/bin/fping
offset = 50%
step = 300
pings = 10

+ Curl
binary = /usr/bin/curl
forks = 5
offset = 50%
step = 300

urlformat = http://$host$/
因為一些網路環境比較嚴謹會擋掉封包而ping不到,但我們又需要檢測網站是否穩定
我在這增加了Curl的參數設定,為了可以針對特定port號像是網站的80或8080去監測
urlformat這邊相關設定說明可以查看官方的範例
*** Targets ***
主要設定Smokeping要監控的主機
 probe = Curl
 menu = Top
 title = Network Latency Grapher
 remark = Welcome to this SmokePing website.
 + HTTP
 menu = http
 title = HTTP latency 
 ++ myhost1
 menu = myhost1
 title = HTTP latency for myhost1
 host = myhost1.example
 ++ myhost2
 menu = myhost2
 title = HTTP latency for myhost2
 host = myhost2.example
 ++ myhost3
 menu = myhost3
 title = HTTP latency for myhost3 (port 8080!)
 host = myhost3.example
 urlformat = http://%host%:8080/
依照需要偵測的IP或者網站去設定
如果只需要監控一般網路延遲的話可以不用用到Curl
需要偵測網站特定port號即需要使用Curl
Targets內的設定,+即為用來區別階層以及各個項目
可以同時顯示多個監控結果或是只顯示一個
像是上面例子中HTTP僅為一個分類項目,並無設置監控
在頁面中點開即可看到階層內會有三個項目myhost1~myhost3
menu 為選單上顯示名稱
title 為該監控項目標題名稱
host 要監控的主機
urlformat 要偵測的網頁網址,可自動帶入host參數,這樣之後要更動會比較方便
若不需要直接在前面加上#註解掉即可

2017年10月26日 星期四

Google Annotation Chart

2017年10月11日 星期三

在Linux純文字介面下瀏覽網頁

透過lynx在liunx文字命令底下瀏覽網頁
sudo apt-get install lynx
lynx https://lanlanlue.blogspot.tw/
選項:
- case: 在搜索字串時,區分大小寫;
- ftp: 關閉ftp功能;
- nobrowse: 關閉目錄瀏覽功能;
- noclor: 關閉色彩顯示模式;
- reload: 更新代理服務器的緩存, 只對首頁有效;
--color: 如果系統支持彩色模式, 則使用彩色模式;
--help: 顯示指令的幫助信息;
--versiom: 顯示指令的版本信息。

2017年10月4日 星期三

使用paping來檢測特定port連線 (Linux)

優點:跨平台以及比內建ping好一點的UI

由於在windows和liunx系統內,一個常用ping另一個常用telnet檢測

不過偵錯port號的時候,在windows ping後面是加冒號,liunx的telnet用空白

而且telnet比較沒辦法得知詳細的連線狀況

可以使用paping來做為偵測port號的方便工具

官方來源:https://code.google.com/archive/p/paping/
確認有安裝基本工具
apt-get update
apt-get -y install wget bash
下載最新檔案(至官網抓取符合系統版本的檔案)
wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/paping/paping_1.5.5_x86-64_linux.tar.gz
解壓縮
tar zvxf paping_1.5.5_x86-64_linux.tar.gz
加入paping命令並移至bin目錄
chmod +x paping
mv paping /bin
檢測80 port
paping lanlanlue.blogspot.tw -p 80

結果

2017年10月1日 星期日

銀行利息試算

新臺幣:

期間:

年利率: %

        
本利和=本金*(1+月利率)^期數
本金=存戶於期初所約定一次存入之金額
月利率=年利率/12

本利和={{all}}

2017年9月29日 星期五

CCMakeFiles failed

CCMakeFiles / xmr-stak-cpu.dir / build.make: 182: recipe for target 'CMakeFiles / xmr-stak-cpu.dir / executor.cpp.o' failed
make [2]: *** [CMakeFiles / xmr-stak-cpu.dir / executor.cpp.o] Interrupt
CMakeFiles / Makefile2: 104: recipe for target 'CMakeFiles / xmr-stak-cpu.dir / all' failed
make [1]: *** [CMakeFiles / xmr-stak-cpu.dir / all] Interrupt
Makefile: 127: recipe for target 'all' failed
make: *** [all] Interrupt
use swap:
 sudo dd if=/dev/zero of=/swapfile bs=64M count=16
 sudo mkswap /swapfile
 sudo swapon /swapfile
順利編譯過後,用不到的話可以移除
rm swap:
 sudo swapoff /swapfile
 sudo rm /swapfile

2017年8月6日 星期日

Google Cloud Platform (GCP) 筆記


--申請帳戶(需信用卡資訊)

--建立一個VM

關於VM永久免費限制如下:
  • 需使用微型CPU規格,計算放置地區僅限US(台灣也有機房,有考慮之後付費使用的話可以設置在東亞地區(Taiwan)的)
  • 30GB儲存空間(一般硬碟)
  • 5GB快照儲存空間
  • 1GB流量,但是不包含往澳洲以及中國的流量
Always Free Usage Limits
  • 1 f1-micro VM instance per month (US regions, excluding Northern Virginia).
  • 30 GB of HDD persistent disk storage per month.
  • 5 GB of snapshot storage per month.
  • 1 GB egress from North America to other destinations per month (excluding Australia and China).
使用ubuntu:
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get install zip unzip 
sudo apt-get clean

GUI安裝
1
2
3
sudo apt-get update
sudo apt-get install ubuntu-desktop
只裝GUI,不裝多餘套件:
1
sudo apt-get install --no-install-recommends ubuntu-desktop
安裝MySQL(可改用Cloud SQL執行個體即可建立)
安裝Nodejs
安裝npm
設置防火牆規則 (需設置網路標籤)
MySQL
sudo apt-get -y install mysql-server
sudo mysql
sudo service mysql status 
sudo service mysql restart
mysql -u root -p
ERROR 1130: Host '*.*.*.*' is not allowed to connect to this MySQL server 

1 可能是你的帳號不允許從遠端登陸,只能在localhost。這個時候只要在localhost的那台電腦,登入mysql後,更改 "mysql" 資料庫裡的 "user" 表裡的 "host" 項,從"localhost"改稱"%"

mysql -u root -pvmwaremysql>use mysql;

mysql>update user set host = '%' where user = 'root';

mysql>select host, user from user;

2. 例如,你想myuser使用mypassword從任何主機連接到mysql伺服器的話。

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

如果你想允許使用者myuser從ip為192.168.1.2的主機連接到mysql伺服器,並使用mypassword作為密碼

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.2' IDENTIFIED BY 'newpassword' WITH GRANT OPTION;


GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.2' IDENTIFIED BY '123456' WITH GRANT OPTION;

mysql>flush privileges; 這句一定要加上。
npm相關套件:
pm2 類似forever的管理處理程序套件,可自動重啟也可設置監控

pm2 start app.js
pm2 update
pm2 stop 0
pm2 list
pm2 delete all
pm2 kill
NODE_ENV=production pm2 start app.js

nginx相關
sudo nginx -t #測試
sudo service nginx restart #伺服器重啟
cd /etc/nginx/sites-enabled
sudo vim domain1

server {
    listen 80;
    server_name *.*.*.*; #domain或IP
    access_log /var/log/nginx/domain1.access.log;
    location / {
        proxy_pass http://127.0.0.1:8080/; #server的位址
    }
}

2016年6月6日 星期一

Cannot find the file C:\Program Files (x86)\Common Files\Microsoft Shared\VSTO\10.0\VSTOInstaller.exe

最近使用甚多Excel增益集及插件,安裝時碰到一個問題,使用office修復診斷都沒辦法解決

Cannot find the file  C:\Program Files (x86)\Common Files\Microsoft Shared\VSTO\10.0\VSTOInstaller.exe

後來找到這篇僅更改安裝的某個檔名即可
http://support.dataeverywhere.com/article/48-error-the-value-of-the-property-type-cannot-be-parsed

C:\Program Files (x86)\Common Files\Microsoft Shared\VSTO\10.0 
C:\Program Files\Common Files\Microsoft Shared\VSTO\10.0

找到以上兩個資料夾(依照使用的office是為32位元或64位元,若用32為原版本即從x86資料夾更改)

裡面會有一個Config檔案為 VSTOInstaller.exe

將它更換檔名,然後以工作管理員執行欲安裝的插件即可

Rename the Config File

This step involves using Windows Explorer to navigate to a directory and change a filename. If you do not feel comfortable doing so, please contact support.
Start by browsing to the following location using Windows Explorer:
 C:\Program Files (x86)\Common Files\Microsoft Shared\VSTO\10.0 
This location may not exist on your computer. Instead, try the following location in the regular Program Files directory:
 C:\Program Files\Common Files\Microsoft Shared\VSTO\10.0
In this folder will be a file named VSTOInstaller.exe.Config. Rename this file to VSTOInstaller.exe.Config.old(adding the ".old" extension), and then retry the installation of vstor_redist.exe.

Running installation as Administrator

In certain cases,  vstor_redist.exe needs to be run explicitly as an Administrator on your local machine. Right click on the vstor_redist.exe installation file and choose "Run as Administrator" rather than just double-clicking.

2016年3月5日 星期六

ENERMAX 安耐美 金緻冰核II 450W 不專業開箱

ENERMAX 安耐美 金緻冰核II 450W 不專業開箱

前個月收到手機簡訊有免費試用就報名了,不過填表單時才知道要寫開箱還真有點猶豫,因為從來沒寫過...Orz
事前小客服詢問了一些使用電腦零件規格上的問題,而且問的還蠻詳細的,我也有特別說明我從未寫過開箱文,若有需要專業的可以優先考慮別人
不過還是被選上了,看來沒有說一定得要有開箱經驗才行,這我覺得還蠻值得肯定的,有報名有機會~
廢話不多說就馬上幫大家開箱吧~

2015年10月4日 星期日

MicrosoftFixit 微軟作業系統修復故障排除

【名        稱】:MicrosoftFixit 微軟作業系統修復故障排除
【作業系統】:Windows XP / 2003 / Vista / 2008 / 7
【官方網站】:http://support.microsoft.com/fixit/zh-tw
【語言種類】:正體中文




2015年6月2日 星期二

小男孩樂團 Men Envy Children 《Everything》Official MV [1080P]




懵懵懂懂走了那麼遠

我慢慢才了解

那些體貼的瞬間

和溫柔撫慰有多珍貴

不須言語也能去感覺

無盡的眷戀

不論此刻或永遠

想要你待在我身邊



Everything

Everything

當每個今天都變成昨天

回憶都是你



Everything

Everything

這漫漫歲月 總有終點

只要看著你

只要能夠一起



It's everything

庸庸碌碌人生多無謂

我不想去了解

但是擁抱的瞬間

就已可證明擁有一切

快樂悲傷有什麼分別

都只是體驗

只要能一起面對

痛苦也可以變成甜



Everything

Everything

這慌亂世界 充滿殘缺

我們共體會



Everything

Everything

每一個畫面 每次想念

平凡而真切

普通卻最珍貴

It's everything

也許夢想太遙遠

也許現實哭紅眼

也許到最後漸漸忘記

一起守護信念

我願相信在那天

你會在我的身邊

陪我談心抱怨



Everything

Everything

當每個今天都變成昨天

回憶都是你



Everything

Everything

這漫漫歲月 總有終點

只要看著你

只要能夠一起

It's everything



就算是世界終於毀滅

終究離別

你永在我心裡

You are everything.

靠近小行星的太空郵差

靠近小行星的太空郵差 💡 你知道嗎? OSIRIS-REx從Bennu帶回太空沙 標籤:小行星, 樣本返回, OSIRIS-REx 📖 真相大揭密 NASA OSIRIS-REx 於 2020 年進入直徑約 490 米的近地小行星 Bennu...