自由學習的風

幽夢影 張潮 少年讀書,如隙中窺月;中年讀書,如庭中望月;老年讀書,如臺上玩月。皆以閱歷之淺深,為所得之淺深耳。

批次地址檢查

2017年1月7日 星期六



DOS Script to Reset Windows Update Agent

2017年1月5日 星期四

from: https://gallery.technet.microsoft.com/scriptcenter/Dos-Command-Line-Batch-to-fb07b159
  1. Stops Windows Update, BITS, Application Identity, Cryptographic Services and SMS Host Agent (SCCM client) services
  2. Cleans up AU cache folder and log file
  3. Re-registers *.dll files
  4. Removes WSUS Client registration Id
  5. Reset Winsock and WinHTTP Proxy
  6. Deletes all BITS jobs
  7. Restart services
  8. Forces AU discovery
@echo off 
cls 
 
REM ================================================================================== 
REM DESCRIPTION    : This script resets all of Windows Update Agent settings. 
REM AUTHOR         : Luca Fabbri 
REM VERSION HISTORY: 2.0 - Start 
REM ================================================================================== 
 
@echo 1. Stopping Windows Update, BITS, Application Identity, Cryptographic Services and SMS Host Agent services... 
net stop wuauserv 
net stop bits 
net stop appidsvc 
net stop cryptsvc 
net stop ccmexec 
 
@echo 2. Checking if services were stopped successfully... 
sc query wuauserv | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 goto END 
 
sc query bits | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 goto END 
 
sc query appidsvc | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 sc query appidsvc | findstr /I /C:"OpenService FAILED 1060" 
if %errorlevel% NEQ 0 goto END 
 
sc query cryptsvc | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 goto END 
 
sc query ccmexec | findstr /I /C:"STOPPED" 
if %errorlevel% NEQ 0 sc query ccmexec | findstr /I /C:"OpenService FAILED 1060" 
if %errorlevel% NEQ 0 goto END 
 
@echo 3. Deleting AU cache folder and log file...  
del /f /q "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" 
del /f /s /q %SystemRoot%\SoftwareDistribution\*.*  
del /f /s /q %SystemRoot%\system32\catroot2\*.* 
del /f /q %SystemRoot%\WindowsUpdate.log  
 
REM @echo 3. Renaming AU cache folder and log file... 
REM del /f /q "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" 
REM ren %SystemRoot%\SoftwareDistribution *.bak 
REM ren %SystemRoot%\system32\catroot2 *.bak 
REM ren %SystemRoot%\WindowsUpdate.log *.bak 
 
REM sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) 
REM sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) 
 
@echo 4. Re-registering DLL files... 
cd /d %WinDir%\system32 
regsvr32.exe /s atl.dll 
regsvr32.exe /s urlmon.dll 
regsvr32.exe /s mshtml.dll 
regsvr32.exe /s shdocvw.dll 
regsvr32.exe /s browseui.dll 
regsvr32.exe /s jscript.dll 
regsvr32.exe /s vbscript.dll 
regsvr32.exe /s scrrun.dll 
regsvr32.exe /s msxml.dll 
regsvr32.exe /s msxml3.dll 
regsvr32.exe /s msxml6.dll 
regsvr32.exe /s actxprxy.dll 
regsvr32.exe /s softpub.dll 
regsvr32.exe /s wintrust.dll 
regsvr32.exe /s dssenh.dll 
regsvr32.exe /s rsaenh.dll 
regsvr32.exe /s gpkcsp.dll 
regsvr32.exe /s sccbase.dll 
regsvr32.exe /s slbcsp.dll 
regsvr32.exe /s cryptdlg.dll 
regsvr32.exe /s oleaut32.dll 
regsvr32.exe /s ole32.dll 
regsvr32.exe /s shell32.dll 
regsvr32.exe /s initpki.dll 
regsvr32.exe /s wuapi.dll 
regsvr32.exe /s wuaueng.dll 
regsvr32.exe /s wuaueng1.dll 
regsvr32.exe /s wucltui.dll 
regsvr32.exe /s wups.dll 
regsvr32.exe /s wups2.dll 
regsvr32.exe /s wuweb.dll 
regsvr32.exe /s qmgr.dll 
regsvr32.exe /s qmgrprxy.dll 
regsvr32.exe /s wucltux.dll 
regsvr32.exe /s muweb.dll 
regsvr32.exe /s wuwebv.dll 
 
@echo 5. Removing WSUS Client Id... 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f 
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f 
 
@echo 6. Resetting Winsock and WinHTTP Proxy... 
netsh winsock reset 
proxycfg.exe -d 
netsh winhttp reset proxy 
 
@echo 7. Starting SMS Host Agent, Cryptographic Services, Application Identity, BITS, Windows Update services... 
net start ccmexec 
net start cryptsvc 
net start appidsvc 
net start bits 
net start wuauserv 
 
@echo 8. Deleting all BITS jobs... 
bitsadmin.exe /reset /allusers 
 
@echo 9. Forcing AU discovery... 
wuauclt /resetauthorization /detectnow 
 
:END 

Ubuntu 底下安裝 Visual Studio Code

2017年1月4日 星期三

sudo wget -O - https://tagplus5.github.io/vscode-ppa/ubuntu/gpg.key | sudo apt-key add -
sudo wget -O /etc/apt/sources.list.d/vscode.list https://tagplus5.github.io/vscode-ppa/ubuntu/vscode.list
sudo apt update
sudo apt install code code-insiders

[Ubuntu] 設定 scratch2 檔案關聯

2016年12月30日 星期五



資料來源:https://scratch.mit.edu/discuss/topic/187916/


1. define .sb2 file's type

sudo vi /usr/share/mime/package/***.xml

*** is new file's name. Set is as you like. ex)scratch2

write text below in the file




<?xml version=“1.0” encoding=“UTF-8”?>

<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info“>

<mime-type type=”application/x-scratch2“>

<comment></comment>

<glob pattern=”*.sb2“/>

</mime-type>

</mime-info>




2. associate .sb2 file with scratch 2 application

Find ”edu.media.mit.scratch2editor.desktop" file under directory of /usr/share/applications/ ,

and add only one line in the last line of that desktop file.

MimeType=application/x-scratch2




3. update
sudo update-desktop-databese
sudo update-mime-database

4. change sb2 file's icon
sudo cp /opt/Scratch\ 2/share/icons/ProjectIcon48.png /usr/share/icons/gnome/scalable/mimetypes/application-x-scratch2.png

(參考:http://wiki.ubuntu.com.cn/UbuntuHelp:AddingMimeTypes)

5. 更新圖示cache
sudo gtk-update-icon-cache  /usr/share/icons/gnome/ -f

4. reboot PC




[PHP] Composer 取消 SSL/TLS 連線

2016年12月19日 星期一

Composer 把安全性提高,要求 SSL/TLS 才能更新,不然就會出現錯誤訊息並中斷。


如果沒有辦法設定 SSL/TLS 連線的話,可以執行下列的指令,變更預設值讓 composer 可以先執行。
(註:正常上線環境 **建議** 不要取消 SSL/TLS 喔)


composer config -g -- disable-tls true
composer config -g -- secure-http false

Linux 軟體套件格式 - Flatpak, Appimage And Snap – How Do They Stack?

2016年12月13日 星期二

Flatpak, Appimage And Snap – How Do They Stack?

原文網址:http://news.tecmint.com/flatpak-appimage-and-snap-how-do-they-stack/



相關網址:

CSS 選擇器

2016年12月11日 星期日


CSS 1

  • 類型: p {...}、blockqote {...}
  • 後代結合器: blockquote p { ...}
  • ID: <article id="content"> ==>  #content
  • 類別: <article class="hentry"> ==> .hentry
  • 連結擬類別:a:link {...}、a:visited {...}
  • 使用者動作擬類別: a:active {...}
  • :first-line 擬元素:p:first-line {...}
  • :first-letter 擬元素: p:first-letter {...}
CSS 2.1
  • 通用:* {...}
  • 使用者動作擬類別:a:hover {...} 和 a:focus {...}
  • :lang() 擬類別: article:lang(fr) {...}
  • 結構擬類別:p:first-child {...}
  • :before 和 :after 擬元素: blockquote:before {...}, a:after {...}
  • 子代結合器: h2 > p {...}
  • 同層相鄰結合器: h2 + p {...}
  • 屬性選擇器: input [required] {...}
  • 屬性選擇器(完全等同):input [type="checkbox"] {...}
  • 匹配次字串的屬性選擇器,連字號分隔,開頭需等同於字串: input [lang |= "en"] {...}
CSS3
  • 一般同層結合器: h1 ~ pre {...}
  • 次字串屬性選擇器,以某字串開頭:a[href^="http://"] {...}
  • 次字串屬性選擇器,以某字串結束:a[href$=".pdf"] {...}
  • 次字串屬性選擇器,包含某字串:a[href*="twitter"] {...}
  • :target()擬類別:section:target {...}
  • 結構擬類別,:nth-child:tr:nth-child(even) td {...}
  • 結構擬類別,:nth-last-child:tr:nth-last-child(-n+5) td{...}
  • 結構擬類別,:last-child:ul li:last-child {...
  • 結構擬類別,:only-child:ul li:only-child {...}
  • 結構擬類別,:first-of-type:p:first-of-type {...}
  • 結構擬類別,:last-of-type:p:last-of-type {...}
  • 結構擬類別,:nth-of-type:li:nth-of-type(3n) {...}
  • 結構擬類別,:nth-last-of-type:li:nth-last-of-type(1) {...}
  • 結構擬類別,:only-of-type: article img:only-of-type {...}
  • 結構擬類別,:empty: aside:empty {...}
  • 結構擬類別,:root: :root {...}
  • 使用者介面元素狀態擬類別,:disabled, :enabled: input:disabled {...}
  • 使用者介面元素狀態擬類別,:checked: input[type="checkbox"]:checked {...}
  • 否定擬類別::not : abbr:not([title]) {...}