function browse($url, $postData = null) {
$fields = '';
if(is_array($postData) && sizeof($postData) >= 1){
$fields = http_build_query($postData);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($fields !=='') {
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

curl_setopt($ch, CURLOPT_COOKIESESSION, true);
// Write cookie if needed .. also try: dirname(__FILE__) . '/cookie.txt';
curl_setopt($ch, CURLOPT_COOKIEJAR , '/tmp/cookie.txt');
// Read cookie if needed
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookie.txt');

$result = curl_exec($ch);

return $result;

Directory sharing between Linux and Windows

1. Sharing/serving a Linux directory to Windows
$ sudo apt-get install samba
$ sudo smbpasswd -a USERNAME
$ mkdir /home/USERNAME/sharedfolder
$ sudo vi /etc/samba/smb.conf

path = /home/USERNAME/sharedfolder
available = yes
valid users = USERNAME
read only = no
browsable = yes
public = yes
writable = yes

$ sudo restart smbd

2. Linux Accessing Windows Shared Directory
sudo mount -t cifs // -o username=YOURUSERNAME,password=YOURPASSWORD /home/userabc/sharedirectoryabc

Choosing the default network card (NIC) that should access the Internet

In the presense of multiple network adapters, it is sometimes necessary to manually specify which one is the default used for internet routing, for example. To accomplish this, you have to manually add a “metric” to each interface. Windows will automatically use the interface with a lower metric. To check and change your network adapters’ metric:

1. Open Command Prompt and type: route print – you will see a list of active routes, the last column displaying their “metric”. Lower metric routes are preferred over higher ones.

2. Open the Network Adapter Properties (Control Panel > Network and Internet > Network Connections > right-click on adapter and choose Properties)
3. Open the properties of Internet Protocol Version 4 (TCP/IPv4).
4. Click on Advanced.
5. Untick “Automatic Metric” and set the interface metric to a number.
6. Hit OK until you close the Network Adapter properties.
7. Repeat steps 2-6 for your other network adapter(s) choosing different metrics. Remember lower metrics are preferred over higher ones.

Check the new metrics in Command Prompt by typing: route print


Getting the current filename using bash

$ cat ./
fullfile=`basename $0`
filename=$(basename "$fullfile")
echo "filename:"$filename
echo "extension:"$extension
echo "justfilename:"$justfilename

$ ./