April 2010

You are currently browsing the articles from KomKid.Net written in the month of April 2010.

Set homepage by code

วันก่อนมีรุ่นน้องที่เคารพ โทรมาหาถามว่า

พี่ เซ็ต homepage ทำยังไงอ่ะ พอดีไปเผลอกดตอบรับเซ็ต homepage ของเว็บนึงเข้า

คิดในใจ “โห โง่ว่ะ” แต่ตอบไปว่า

เข้าไปที่ Tools -> Internet option …

สวนกลับมาก่อนจะบอกจบว่า

ไม่ได้พี่ IT บล็อก

ค่อยเริ่มน่าสนใจหน่อย จะบอกให้ไปแก้จาก registry ก็คงจะโดนบล็อกอีก ก็เลยหาวิธีอื่นให้ สรุปได้ว่าใช้ code ข้างล่าง

1
2
3
4
5
6
7
8
9
10
11
12
<html>
<head>
<title>Set homepage</title>
</head>
<body>
<form name="HomepageForm">
<input type="text" name="urlbox">
<input type="button" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage(document.HomepageForm.urlbox.value);" value="Set">
</form>

</body>
</html>

upload ให้ด้วยที่ http://tools.komkid.net/homepage.html เผื่อใครจะเจอสถานการณ์แบบนี้บ้าง (ใช้ได้เฉพาะ IE เท่านั้นเด้อ)

——————————————
อันนี้แปะไว้กันลืม Registry สำหรับ IE

1
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page

Written by Komkid on April 27th, 2010 with no comments.
Read more articles on Internet and JavaScript and Programming.

Ubuntu : Install ClamAV

1.ติดตั้ง ClamAV และ Update

1
2
3
4
5
apt-get install clamav
apt-get install clamav-daemon
/etc/init.d/clamav-daemon restart  
freshclam  #update virus definitions
clamscan -r /location_of_files_or_folders

2.Schedule Scan

1
2
crontab -e
00 00 * * * clamscan -r location_of_files_or_folders

3.Log and Quarantine

1
2
mkdir /var/log/clamav/infected
nano /etc/clamav/clamscan_schedule.sh

ป้อน

1
2
3
4
5
6
7
8
9
10
#!/bin/sh
### fix log file if needed
LOG_FILE="/var/log/clamav/scan.log"
if [ ! -f "$LOG_FILE" ]; then
touch "$LOG_FILE"
chmod 644 "$LOG_FILE"
chown clamav.clamav "$LOG_FILE"
fi
 
clamscan -r /public_data --quiet --log="$LOG_FILE" --verbose --move=/var/log/clamav/infected
1
chmod +x /etc/clamav/clamscan_schedule.sh

Written by Komkid on April 26th, 2010 with no comments.
Read more articles on Software and Ubuntu.

Ubuntu : Install FreeNX

FreeNX เป็นคนละตัวกับ NXServer ของ nomachine ครับ (ของ nomachine จำกัดแค่ 2 session เอง)
1.เพิ่ม repository

1
nano /etc/apt/sources.list

เพิ่ม

1
2
deb http://ppa.launchpad.net/freenx-team/ppa/ubuntu VERSION main
deb-src http://ppa.launchpad.net/freenx-team/ppa/ubuntu VERSION main

เพิ่ม key แล้ว update

1
2
 apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2a8e3034d018a4ce
apt-get update

2.ติดตั้ง server

1
aptitude install freenx

3.ติดตั้ง client (ใช้ของ nomachine)

1
2
wget http://64.34.161.181/download/3.4.0/Linux/FE/nxserver_3.4.0-12_i386.deb
dpkg -i nxclient_3.4.0-5_i386.deb

4.กรณีต้องการเปลี่ยน SSH key

1
dpkg-reconfigure freenx-server

เลือก Create new custom keys
จะได้ key อยู่ที่ /var/lib/nxserver/home/custom_keys/client.id_dsa.key สำหรับเอาไป import เข้า nxclient
อาจ copy ไปโดยให้คำสั่ง
ที่ server

1
cp /var/lib/nxserver/home/custom_keys/client.id_dsa.key ~/

ที่ client

1
scp user@freenx-server:~/client.id_dsa.key ~/

Written by Komkid on April 26th, 2010 with no comments.
Read more articles on Admin and Networking and Software and Ubuntu.