Saturday, April 5, 2014

how to convert mp4 into mp3 with ffmpeg

$ ffmpeg -i เพลง\ Cookie\ Run.mp4 -f mp3 -ab 192000 -vn cookierun.mp3

Friday, April 4, 2014

Monday, March 31, 2014

lenovo g500s - LAN driver issue

22:04 <p...> apt-get install linux-headers-$(uname -r)
22:04 <p...> แล้วโหลดนี้มา
http://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.13.2/backports-3.13.2-1.tar.xz
22:05 <p...> make defconfig-alx
22:05 <p...> make
22:05 <p...> make install
22:05 <p...> modprobe alx ไม่ก็ restart ครับ

Sunday, March 30, 2014

resize image

for file in *.png
do
  convert -quality 20 $file ${file%%png}jpg
done;

Thursday, March 6, 2014

เว็บต่างๆไม่ใช้ subdomain แต่ตั้ง domain name ใหม่เยอะๆแทน จิบ้าตาย

กว่าเราจะเชื่อใจโดเมนเนมอย่าง uob.co.th หรือ krungsri.com ก็ใช้เวลาเนิ่นนาน ฉับพลัน เขาก็มีโดเมนเพิ่มเติมของเขา uobcyberbanking.com เอย krungsrionline.com เอย และ อื่นๆอีกมากมาย ทั้งหลายเว็บไซต์ทั้งธนาคาร ห้างร้าน ต่างๆ ทำไมเขาไม่ใช้ subdomain แทนหนอ บริษัทเดียวกันแท้ๆ ต้องมานั่งลุ้นเอง ว่าใช่เว็บของบริษัทปลายทางที่ต้องการจะเข้าจริงหรือเปล่า ด้วยการหาข้อมูลเพิ่มเติิมบ่อยไป จิบ้าตาย

Monday, March 3, 2014

บัตรเครดิต เลขหน้าบัตร 16 หลักต่างหากที่สำคัญ และ อันตรายที่สุด

อยากจะถือโอกาสนี้ที่เพิ่งได้ทดลองรูดบัตรเครดิตไปแจ้งให้เพื่อนๆทราบเพื่อเป็นประโยชน์แก่ทุกท่าน "บัตรเครดิต เลขด้านหลังสามหลักไม่ได้สำคัญที่ สุด เลขด้านหน้าสำคัญกว่าอีก ไม่ใช่ไปเข้าใจผิด หรือ โดนคนไม่รู้ให้ข้อมูลผิด หรือ โดนหลอก ว่าไม่เป็นไรค่ะ ส่งแค่หน้าบัตรมาก็พอ หักเงินไม่ได้ แบบนี้คือผิดหมด" เพิ่งแจ้งให้เพื่อนๆทราบอีกคร้งวันนี้เพราะได้ข้อมูลมาใหม่จากการทดลองด้วยตนเอง ก่อนหน้านี้ไม่ได้บอกเกรงเป็นข้อมูลเก่า คือ เมื่อประมาณ 8 ปีก่อนผมพัฒนาโปรแกรมที่ต้องมีการ หักเงินจากบัตรเครดิตโดยใช้ api ของ ธนาคารแห่งหนึ่งในแคนาดา ทำให้ได้ทราบว่า แค่เลขหน้าบัตร 16 หลักอย่างเดียว ไม่ต้องกรอกข้อมูลอื่นใดก็หักเงินได้แล้ว โดยข้อมูลอื่นๆนั้นเป็น optional ทางเว็บไซต์จะเลือกตรวจอะไรเพิ่ม เติมก็ได้เช่น เลขสามหลักด้านหลังบัตร, วันออกบัตร, วันหมดอายุบัตร, ชื่อแซ่, ที่อยู่ และ อื่นๆ แต่ไม่จำเป็นต้องตรวจ ... แค่เพียงเว็บส่วนใหญ่เลือกที่จะตรวจหลายอย่าง แต่ก็มีอีกหลายเว็บที่ไม่ตรวจ ผ่านมา 8 ปี ล่าสุดลองรูดบัตรเครดิตกับเว็บไซต์ในญี่ปุ่น ก็พบผลลัพธ์เช่นเดียวกัน จึงขอยืนยันมา ณ ที่นี้ อย่าให้ข้อมูลเลขบัตร 16 หลัก กับใครโดยเข้าใจผิดคิดว่าเขาหักเงินไม่ได้นะครับ นี่ส่งผลให้ระบบจองโรงแรมที่ชอบให้สแกนหน้าบัตรเครดิตแล้วส่งอีเมล์แบบไม่เข้ารหัสไปให้เอย, พวกรายงานการใช้บัตรเครดิตของบางธนาคารเช่น ktc ที่ส่งจดหมายกระดาษมาทางบ้านพร้อมระบุเลขบัตรครบ 16 หลักให้เป๊ะๆบนหัวรายงานเลยมาให้ ทุกเดือนเอย... พวกนีี้ อันตรายหมดนะครับ ทางที่ดีเลิกใช้เสียดีกว่า ไปใช้ธนาคารอื่น ลดความเสี่ยง ส่วนโรงแรมก็ใช้โทรศัพท์บอกเลข ครึ่งนึง อีกครึ่งอีเมล์เอา ไรงี้ ตามความเหมาะสมนะครับ จะทำอะไรก็แล้วแต่ จะไม่เพิ่มความปลอดภัยก็ตามสะดวก เพียงผมอยากให้ทุกคนได้รับรู้ ได้มีสติ แม้จะยังคงทำเหมือนเดิมคือส่งไปทางอีเมล์แบบไม่เข้ารหัสเพราะโรงแรมใช้ encrypted email ไม่เป็น หรือ ใช้ธนาคารเดิม แต่ก็อยากให้มีสติรับรู้ว่ามันเอาเงินเราได้เลยนะ ไม่ใช่ไม่รู้ ครัช

Wednesday, February 26, 2014

TXT_DB error number 2

TXT_DB error number 2 when generating openvpn client certificates

You may have followed the openvpn quick start instructions either from the online tutorial or using the README file in easy-rsa where it asks you to go through these steps:

[edit vars with your site-specific info]
source ./vars
./clean-all
./build-dh
./pkitool --initca
./pkitool --server myserver
./pkitool client1
 and then you get
failed to update database TXT_DB error number 2
at the last step. I did and a web search mostly turned up suggestions to run ./clean-all again. But this article was the key. It's about openssl, but openvpn's easy-rsa is just a front-end to openssl. The important observation is that every certificate must have a unique CN in the database. In the file vars, this is controlled by KEY_CN. You left the settings read in from vars unchanged between generating the server cert and the client cert. You could edit vars before generating the client certificate and re-source vars, or you could do this before generating each client key.
KEY_CN=someuniqueclientcn ./pkitool client1
and you will stop getting that TXT_DB error.


I'm a bit surprised that the documentation for openvpn hasn't been updated to make this clear.


NB: It is also affected by the setting unique_subject = yes in the file keys/index.txt.attr, but I prefer not to go against the default setting.


http://blog.kenyap.com.au/2012/07/txtdb-error-number-2-when-generating.html

Tuesday, February 25, 2014

how to install canon mp287 scanner driver in debian linux

  • install MP280series_scanner_driver.tar.gz from canon's official website
  • sane-find-scanner
  • /lib/udev/rules.d/60-libsane.ruled
    add
    ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="1746", ENV{libsane_matched}="yes"
  • run scangearmp