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)


火星一日

火星一日 💡 你知道嗎? 火星一日比地球長39分 標籤:天文, 火星, 時間 📖 真相大揭密 火星平均距太陽約2.3億公里,每687地球日繞一圈,等於1.8809地球年(1年320日18.2小時)或669.6個sol。sol是自轉日,長24小...