<?php
// PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server.
// This script contains passwords. KEEP ACCESS TO THIS FILE SECURE! (place it in your home dir, not /www/)
// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********
// Info required for cPanel access
$cpuser = "username"; // Username used to login to CPanel
$cppass = "password"; // Password used to login to CPanel
$domain = "example.com"; // Domain name where CPanel is run
$skin = "x"; // Set to cPanel skin you use (script won't work if it doesn't match). Most people run the default x theme
// Info required for FTP host
$ftpuser = "ftpusername"; // Username for FTP account
$ftppass = "ftppassword"; // Password for FTP account
$ftphost = "ftp.example.com"; // Full hostname or IP address for FTP host
$ftpmode = "ftp"; // FTP mode ("ftp" for active, "passiveftp" for passive)
// Notification information
$notifyemail = "you@example.com"; // Email address to send results
// Secure or non-secure mode
$secure = 0; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP
// Set to 1 to have web page result appear in your cron log
$debug = 0;
// *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********
if ($secure) {
$url = "ssl://".$domain;
$port = 2083;
} else {
$url = $domain;
$port = 2082;
}
$socket = fsockopen($url,$port);
if (!$socket) { echo "Failed to open socket connection... Bailing out!\n"; exit; }
// Encode authentication string
$authstr = $cpuser.":".$cppass;
$pass = base64_encode($authstr);
$params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&submit=Generate Backup";
// Make POST to cPanel
fputs($socket,"POST /frontend/".$skin."/backup/dofullbackup.html?".$params." HTTP/1.0\r\n");
fputs($socket,"Host: $domain\r\n");
fputs($socket,"Authorization: Basic $pass\r\n");
fputs($socket,"Connection: Close\r\n");
fputs($socket,"\r\n");
// Grab response even if we don't do anything with it.
while (!feof($socket)) {
$response = fgets($socket,4096);
if ($debug) echo $response;
}
fclose($socket);
?>
วันอาทิตย์ที่ 8 มิถุนายน พ.ศ. 2557
Automatic cPanel backup (domain & MySQL) with cron & PHP
วันศุกร์ที่ 25 เมษายน พ.ศ. 2557
Bypass ios 7
http://maypalo.com/2013/02/17/download-tinyumbrella-shsh-blobs-ios-6-1-1/
https://sites.google.com/site/msftguy/file/ssh_rd_rev04b.jar
PuTTy
https://sites.google.com/site/msftguy/file/ssh_rd_rev04b.jar
PuTTy
Step 1: Back up your iPhone before attempting this guide and make sure to put it in airplane mode.
Step 2: Connect the iPhone to the computer and hit restore (if you have already done this and are on the “Welcome to iOS 7″ screen, you don’t need to do it again).
Step 3: Put your iPhone in to DFU mode.
- Hold the Power button for 3 seconds
- Hold the Home button without releasing the Power button for 10 seconds
- Release the Power Button but keep holding the Home button
Step 4: Download the Java utility and run it.
Step 5: Once it is completed you should see the following on your computer.
Step 6: Download PuTTy and run it.
Step 7: Put in local host as hostname and port the java utility specified.
Step 8: A window will pop up asking you for username and password:
- Username: root.
- Password: alpine.
Step 9: Right after that run mount.sh in the terminal, then type in the following commands
cd mnt1/Applications.rm -R Setup.app
If that does not work, type set and hit the tab button, it should auto complete.
Step 10: Now delete setup.app.
Step 11: Hold the power and home button to reset the phone.
Step 12: When the iPhone is turned on, it will show it in recovery mode. It is fine, don’t need to panick.
Step 13: Download TinyUmbrella and run it.
Step 14: Exit from the recovery mode using TinyUmbrella.
Step 15: Your iPhone should boot up properly now.
If you have followed the steps correctly your iPhone should be hacktivated (activated) and up & running. The hacktivation method is not the proper way to activate an iPhone so you might find some problems later on while using it.
วันศุกร์ที่ 7 มีนาคม พ.ศ. 2557
XCode Set Font Size
XCode Set Font Size
[myView setFont:[UIFont systemFontOfSize:12]];
[myView setFont:[UIFont boldSystemFontOfSize:12]];
[myView setFont:[UIFont fontWithName:@"Helvetica" size:12]];
วันศุกร์ที่ 24 มกราคม พ.ศ. 2557
fix vsftp & iptables fix
setenforce 0
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
vi /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_conntrack_ftp"
vi /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_conntrack_ftp"
ขั้นตอนการติดตั้ง FTP Server บน CentOS 6 ด้วยโปรแกรม vsftpd
1. ดาวน์โหลดโปรแกรม vsftpd
1
| # yum install vsftpd |
2. Start Service vsftpd
1
| # service vsftpd start |
3. เปิดการใช้งาน vsftpd ใน Multi-user levels
1
| # chkconfig vsftpd on |
ขั้นตอนการสร้าง Account FTP ให้กับแต่ละคน (FTP แบบ Authentication Required)
1. แก้ไขไฟล์ vsftpd.conf โดยพิมพ์คำสั่ง แก้ไขค่าตามคำอธิบายด้านล่าง และทำการบันทึก
1
| # nano /etc/vsftpd/vsftpd.conf |
1.1 ascii_upload_enable=YES ลบเครื่องหมาย # ออก
1.2 ascii_download_enable=YES ลบเครื่องหมาย # ออก
1.3 ftpd_banner=Welcome to blah FTP service. ลบเครื่องหมาย # ออก
1.4 use_localtime=YES เพิ่มไว้ที่บรรทัดสุดท้าย
2. สร้าง Account ใหม่ขึ้นมาสำหรับการทดสอบ
1
2
3
4
5
6
7
| # useradd ftp1# passwd ftp1Changing password for user ostechnix.New password: BAD PASSWORD: it is based on a dictionary wordRetype new password: passwd: all authentication tokens updated successfully. |
3. Restart Service vsftpd
1
| # service vsftpd restart |
4. Update SELinux configuration เพื่อเปลี่ยน User ไปที่ $HOME directories
1
| # setsebool -P ftp_home_dir on |
วันอาทิตย์ที่ 19 มกราคม พ.ศ. 2557
Fix Mysql start & memcached
setenforce 0
killall memcached
service memcached start
service mysqld stop
mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
service mysqld start
วันจันทร์ที่ 9 ธันวาคม พ.ศ. 2556
How can I fix a locale warning from perl?
# Setting for the new UTF-8 terminal support in Lion
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Setting for the new UTF-8 terminal support in Lion LC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8
วันอาทิตย์ที่ 1 กันยายน พ.ศ. 2556
how to set cornerRadius for only top-left and top-right corner of a UIView
Here's a method - I'm sure it could be shortened.... :D
-(UIView *)roundCornersOnView:(UIView *)view onTopLeft:(BOOL)tl topRight:(BOOL)tr bottomLeft:(BOOL)bl bottomRight:(BOOL)br radius:(float)radius {
UIRectCorner corner; //holds the corner
//Determine which corner(s) should be changed
if (tl) {
corner = UIRectCornerTopLeft;
}
if (tr) {
corner = UIRectCornerTopRight;
}
if (bl) {
corner = UIRectCornerBottomLeft;
}
if (br) {
corner = UIRectCornerBottomRight;
}
if (tl && tr) { //top
corner = UIRectCornerTopRight | UIRectCornerTopLeft;
}
if (bl && br) { //bottom
corner = UIRectCornerBottomLeft | UIRectCornerBottomRight;
}
if (tl && bl) { //left
corner = UIRectCornerTopLeft | UIRectCornerBottomLeft;
}
if (tr && br) { //right
corner = UIRectCornerTopRight | UIRectCornerBottomRight;
}
if (tl & tr & bl & br) {
corner = UIRectCornerAllCorners;
}
UIView *roundedView = view;
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:roundedView.bounds byRoundingCorners:corner cornerRadii:CGSizeMake(radius, radius)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = roundedView.bounds;
maskLayer.path = maskPath.CGPath;
roundedView.layer.mask = maskLayer;
return roundedView;
}
UIButton *openInMaps = [UIButton new];
[openInMaps setFrame:CGRectMake(15, 135, 114, 70)];
openInMaps = (UIButton *)[self roundCornersOnView:openInMaps onTopLeft:NO topRight:NO bottomLeft:YES bottomRight:NO radius:5.0];
สมัครสมาชิก:
บทความ (Atom)