Subscribe

RSS Feed (xml)

Powered By

Powered by Blogger

2016年2月18日 星期四

How to Install Squid on CentOS 7

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator. It runs on most available operating systems, including Windows and is licensed under the GNU GPL.

# Clean the yum
yum clean all

# update the existing packages
yum -y update

# install squid
yum -y install squid

# Use the following command to view information on the command
squid -h

# Use the following command to check the version number of Squid and the configuration
squid -v

# Your results should appear similar to

Squid Cache: Version 3.3.8
configure options: '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-strict-error-checking' '--exec_prefix=/usr' '--libexecdir=/usr/lib64/squid' '--localstatedir=/var' '--datadir=/usr/share/squid' '--sysconfdir=/etc/squid' '--with-logdir=$(localstatedir)/log/squid' '--with-pidfile=$(localstatedir)/run/squid.pid' '--disable-dependency-tracking' '--enable-eui' '--enable-follow-x-forwarded-for' '--enable-auth' '--enable-auth-basic=DB,LDAP,MSNT,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB,getpwnam' '--enable-auth-ntlm=smb_lm,fake' '--enable-auth-digest=file,LDAP,eDirectory' '--enable-auth-negotiate=kerberos' '--enable-external-acl-helpers=file_userip,LDAP_group,time_quota,session,unix_group,wbinfo_group' '--enable-cache-digests' '--enable-cachemgr-hostname=localhost' '--enable-delay-pools' '--enable-epoll' '--enable-icap-client' '--enable-ident-lookups' '--enable-linux-netfilter' '--enable-removal-policies=heap,lru' '--enable-snmp' '--enable-ssl' '--enable-ssl-crtd' '--enable-storeio=aufs,diskd,ufs' '--enable-wccpv2' '--enable-esi' '--enable-ecap' '--with-aio' '--with-default-user=squid' '--with-filedescriptors=16384' '--with-dl' '--with-openssl' '--with-pthreads' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fpie' 'LDFLAGS=-Wl,-z,relro -pie -Wl,-z,relro -Wl,-z,now' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fpie' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

# Configure Squid to Start on Boot
systemctl start squid

# Be sure that Squid starts at boot:
systemctl enable squid

# check the status of Squid
systemctl status squid

# To stop Squid
systemctl stop squid

2016年2月15日 星期一

Backup Windows License Key



You can backup your Windows license key through the following VBscript. Please copy the following code in source and save as *.vbs. In additional, it can export the text file with license key to your desktop for backup purpose.

Source:
Option Explicit

Dim objshell,path,DigitalID, Result
Set objshell = CreateObject("WScript.Shell")
'Set registry key path
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Registry key value
DigitalID = objshell.RegRead(Path & "DigitalProductId")
Dim ProductName,ProductID,ProductKey,ProductData
'Get ProductName, ProductID, ProductKey
ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName")
ProductID = "Product ID: " & objshell.RegRead(Path & "ProductID")
ProductKey = "Installed Key: " & ConvertToKey(DigitalID)
ProductData = ProductName  & vbNewLine & ProductID  & vbNewLine & ProductKey
'Show messbox if save to a file
If vbYes = MsgBox(ProductData  & vblf & vblf & "Save to a file?", vbYesNo + vbQuestion, "BackUp Windows Key Information") then
   Save ProductData
End If

'Convert binary to chars
Function ConvertToKey(Key)
    Const KeyOffset = 52
    Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert
    'Check if OS is Windows 8
    isWin8 = (Key(66) \ 6) And 1
    Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4)
    i = 24
    Maps = "BCDFGHJKMPQRTVWXY2346789"
    Do
        Current= 0
        j = 14
        Do
           Current = Current* 256
           Current = Key(j + KeyOffset) + Current
           Key(j + KeyOffset) = (Current \ 24)
           Current=Current Mod 24
            j = j -1
        Loop While j >= 0
        i = i -1
        KeyOutput = Mid(Maps,Current+ 1, 1) & KeyOutput
        Last = Current
    Loop While i >= 0
    keypart1 = Mid(KeyOutput, 2, Last)
    insert = "N"
    KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
    If Last = 0 Then KeyOutput = insert & KeyOutput
    ConvertToKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5) & "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & Mid(KeyOutput, 21, 5)
End Function

'Save data to a file
Function Save(Data)
    Dim fso, fName, txt,objshell,UserName
    Set objshell = CreateObject("wscript.shell")
    'Get current user name
    UserName = objshell.ExpandEnvironmentStrings("%UserName%")
    'Create a text file on desktop
    fName = "C:\Users\" & UserName & "\Desktop\WindowsKeyInfo.txt"
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set txt = fso.CreateTextFile(fName)
    txt.Writeline Data
    txt.Close
End Function

Result:

2016年2月1日 星期一

購買二手電腦或電腦配件需要注意的事項


首先,筆者強烈建議不要購買二手電腦、手提電腦或電腦配件,主要原因二手電腦可能問題多多或者有暗病,就算你擁有豐富的電腦硬件經驗,很多時不可能以短短半小時至一小時內發現問題,而且絕大部份二手電腦都沒有原廠保養服務,買家更可能遇上售賣二手電腦的黑店,他們可能會使用一些奸狡的銷售手法,只要買家一個不留神或經驗不足,就會落入他們的圈套,令買家投訴無門,結果貼錢買難受。

假若買家因為資金問題,決定要購買二手電腦不可,可以留意以下幾點。

1. 購買二手電腦時,最好還有原廠保養,萬一出現問題時,都可以到原廠維修,但價錢會比沒有原廠保養貴些。

2. 去一些有信譽的公司購買,他們一般都會提供7日至1個月的保養,筆者曾到位於新高登一樓DK電腦公司及地下新高登電腦有限公司購買二手硬件及手提電腦。

3.  購買任何二手產品都記緊要拿收據,收據上一定要印有公司名稱、購買日期、收據編號及公司蓋印,最好不要手寫收據,而是電腦收據。

檢查二手硬件及手提電腦要注意的地方
1.  主機底板 – 要留意主機板上的電容有沒有發脹或破裂,CPU及底板的針腳有沒有斷或彎曲,有沒有燒焦過的痕跡及水漬等等……

2.  CPU – 若買家只購買CPU,最好攜帶主機底板及記憶體即場測試,假若沒冇準備主機底板及記憶體,盡量要求商店測試,並在BIOS裡看到CPU的型號及相關資料。

3. 記憶體 – 要留意記憶體金色的渡電部份有沒有脫落的現象,另外,記憶體的顆粒分佈都會分單面或雙面,一般來說雙面記憶體對舊電腦的兼容性會比單面為好。

4. 硬碟 – 筆者絕對唔建議為慳幾百蚊而購買二手硬碟,避免損失寶貴的資料,得不償失。

5. 火牛 – 筆者亦都不建議在購買二手,除非你購買時,備有測量電壓錶來檢查輸出的電量是否穩定,另外,火牛通常都是密封的,買家不能查看火牛裡的電容是否容發脹或破裂,電線的絕緣體有沒有鬆脫或損壞等情況發生,假若使用一個有問題的火牛裝置,分分鐘可以將你的家園燒燬。

6. 手提電腦 – 購買二手手提電腦真是很多東西需要檢查
  • 外觀 – 看看外殻有幾多成新,有沒有裂痕、水漬、凹陷或花痕等等。
  • 查看硬件配置 – 進入BIOS,查看CPU、記憶體、硬盤及型號是否同標籤上的是否致。
  • 螢幕 – 開機出入Windows後看一看螢幕有沒有出現偏色或偏暗的情況發生,一般來講,螢幕使用得愈久,它的偏暗情況會愈明顯,買家測試螢幕是可以將螢幕調較到最光來作測試,另外,螢幕也會出現漏光或死點光點等情況發生,買家需要留意。最後當然睇下螢幕會唔會有花痕及白點等等......
  • 鍵盤 – 開啟電腦上的記事本輸入A-Z, 1-0及所有功能鍵包括F1-F12等等是否操作正常。
  • 週邊連接埠 – 檢查WIFI, 網絡卡連接埠、USB、喇叭、VGA輸出、Mouse Pad、耳筒、Card Reader、WebCam等等……
  • 內部散熱風扇 – 查看有沒有轉動,有沒有排出熱氣。
  • 電池- 通常手提電腦既電池都會老化,測試時將火牛電源線拔掉後,留意手提電腦的電量在短時間內會不會突然間下降了很多。
  • 日期及時間 – 關機後把電源線及電池除下後,等大約3至5分鐘後插入電源線再開機,進入BIOS,倘若BIOS裡的日期及時間不符合,證明手提電腦底板電池已經耗盡需要更換。
  • 配件 – 例如是否原裝火牛、電池、還原光碟、驅動程式光碟及視窗金匙是否齊全。
7. 組裝電腦 – 筆者在寫這份文章時,有做過網上調查,發現有商店使用二手或過保養期的硬件當作新硬件,然後組裝在電腦裡,並以機身封條受損不作保養為由,禁止使用者拆開機箱檢查機內的硬件,這裡提醒用家,首先不要給大額金錢作為訂金,第二,當向商店交收組裝電腦時,記緊要每一件硬件都要核對清楚後才貼上商店的封條,要保障大家的利益,最後亦記得收取商戶所發出的收據証明,以方便日後保養及追究責任。

總結
購買二手硬件及電腦既朋友一定打醒十二分精神,就算擁有資深電腦硬件經驗的朋友,都要很小心,只要一個唔留神很容易會跌落黑店圈套。

受騙個案
1. 組裝電腦的受騙經過
2. 買家疑誤購改裝二手電腦