Browsing articles from "February, 2013"
Feb
27
2013

SFTP on specific port and using rsa or dsa key

download (1)

sftp -oPort=2222 sftp -oIdentityFile=/path/to/private/keyfile user@123.456.789.012:/home/something Note: The -oPort=???? has to be before the user@123……

Feb
24
2013

Mac OSX – How to completely disable Dashboard

download (2)

Disable Dashboard- type or paste the following exactly into the Terminal window: defaults write com.apple.dashboard mcx-disabled -boolean YES Next, kill the currently running Dashboard by killing the Dock (the Dock will reload itself, don’t worry): killall Dock That’s it, now Dashboard is completely disabled. Hit F12 and nothing will happen. So what if you had a change of heart and want Dashboard back? Well turning it back on is just as easy. Enabling Dashboard- type or […]

Feb
18
2013

HowTo: force umount a busy device in linux

images

When you try to umount the regular way, if a device is busy you’ll get the following : dev:/# umount /dev/sda1 umount2: Device or resource busy umount: /boot: device is busy This can be solver very easy by entering this : dev:/# umount -l /dev/sda1

Feb
15
2013

Force PHP to show all errors or save them to a log for troubleshooting

Most servers are set to suppress PHP errors which can leave you guessing why something isn’t working and make troubleshooting code almost impossible. This is especially frustrating when you install a 3rd party module with errors. Luckily forcing PHP to display errors is very easy.  The most basic way to accomplish this is to just add the following 2 lines to the top of your PHP code.Copy this code… error_reporting(E_ALL); ini_set( ‘display_errors’,’1′);   You can […]

Feb
15
2013

PHP Shorthand If / Else Examples

Basic True / False Declaration $is_admin = ($user['permissions'] == ‘admin’ ? true : false); Conditional Welcome Message echo ‘Welcome ‘.($user['is_logged_in'] ? $user['first_name'] : ‘Guest’).’!’; Conditional Items Message echo ‘Your cart contains ‘.$num_items.’ item’.($num_items != 1 ? ‘s’ : ”).’.’; Conditional Error Reporting Level error_reporting($WEBSITE_IS_LIVE ? 0 : E_STRICT); Conditional Basepath echo ‘<base href=”http’.($PAGE_IS_SECURE ? ‘s’ : ”).’://mydomain.com” />’; Nested PHP Shorthand echo ‘Your score is: ‘.($score > 10 ? ($age > 10 ? ‘Average’ : […]

Feb
8
2013

How to Install and Configure Dropbox on Ubuntu Server

Dropbox is a file hosting service that offers cloud storage, file synchronization, and client software. In brief, Dropbox allows users to create a special folder on each of their computers, which Dropbox then synchronises so that it appears to be the same folder (with the same contents) regardless of the computer it is viewed on. In this tutorial, I will try to show you the steps to make dropbox features and services available on ubuntu […]

Feb
6
2013

PHP + SSH Authentication using a public key

  <?php $connection = ssh2_connect(‘shell.example.com’, 22, array(‘hostkey’=>’ssh-rsa’)); if (ssh2_auth_pubkey_file($connection, ‘username’, ‘/home/username/.ssh/id_rsa.pub’, ‘/home/username/.ssh/id_rsa’, ‘secret’)) { echo “Public Key Authentication Successful\n”; } else { die(‘Public Key Authentication Failed’); } ?>   This is a known bug in php: password protected private key cannot be used on certain combinaisons. See: https://bugs.php.net/bug.php?id=58573 ssh2_auth_pubkey_file() is broken when the public key file is protected with a password AND libssh2 is compiled with libgcrypt, which is what debian/ubuntu and probably others do. I’m working on a solution for this bug, but if you need this working rebuild libssh2 yourself with […]

Feb
6
2013

Installing PHP’s SSH2 extension on Ubuntu

    On Ubuntu 10.04 LTS, Do this (there’s no need to do any compiling anymore) 1 apt-get install libssh2-1-dev libssh2-php You can now test if PHP recognizes it’s new ssh2 extension by running: 1 php -m |grep ssh2 Don’t forget to restart Apache 1 service apache2 restart

Feb
2
2013

Proxy Server using Squid

ก่อนที่จะมาทำ Proxy Server ใช้กัน เรามารู้จักกันก่อนดีกว่าว่า Proxy Server คืออะไร Proxy Server หรือ Web Proxy Server หรือ Web Cache Server ก็คือ Server ที่ทำหน้าที่เก็บ ข้อมูลต่างๆเช่น รูปภาพ จาก Web Site ที่ users หรือผู้ใช้บริการร้องขอ ดูจากรูปภาพด้านล่างจะ เข้าใจกว่า จากรูปทื่1 users ในฝั่ง HQ ต้องการเปิด website ต้องดึงข้อมูลจาก website ตรงๆ   Download PDF : proxy_server

Feb
1
2013

PHP FTP + Passive FTP Server

// create a basic connection $ftpconn = ftp_connect($ftp_ip, $ftp_port); // login with username and password ftp_login($ftpconn, $ftp_user, $ftp_pass); // Switch into passive mode (required for servers behind firewalls / NAT devices) ftp_pasv($ftpconn,true); // Print a directory listing print_r ftp_nlist($ftpconn, “/”);




Member Area