Friday, November 30, 2018

How to setup your VMWare Fusion to use static IP addresses on Mac OSX

1. Set a Static IP for your virtual machine system.
sudo vim /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf

After where it says End of “DO NOT MODIFY SECTION” enter the following lines:
host Windows8x64 {
    hardware ethernet 00:0C:29:B6:22:3E;
    fixed-address 172.16.106.128;
}

2. Change NAT configure file.
sudo vi /Library/Preferences/VMware\ Fusion/vmnet8/nat.conf

Add your configure, for example:
[incomingtcp]
# Use these with care — anyone can enter into your VM through these…
# The format and example are as follows:
#8080 = 172.16.3.128:80
80 = 172.16.106.128:80

3. Restart network service of VMware Fusion.
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start


Reference: https://medium.com/@tuweizhong/how-to-setup-port-forward-at-vmware-fusion-8-for-os-x-742ad6ca1344

Saturday, February 3, 2018

Nginx - Reverse Proxy

Proxy server

server {
    listen       80;
    server_name  proxy.com;

    location / {
        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;
        proxy_pass https://destination.com;
    }
}

Load balancing

http {
    upstream myapp1 {
        server srv1.example.com;
        server srv2.example.com;
        server srv3.example.com;
    }

    server {
        listen 80;

        location / {
            proxy_pass http://myapp1;
        }
    }
}

Sunday, August 21, 2016

Sniffer Package on MacOS

sniff package
$ sudo tcpdump -i en0 -s 0 -B 524288 -w ~/Desktop/local.pcap


parse package
$ tcpdump -s 0 -n -e -XX -vvv -r ~/Desktop/local.pcap

Wednesday, May 11, 2016

GIT create new branch

If you like the method in the link you've posted, have a look at Git Flow.

It's a set of scripts he created for that workflow.

But to answer your question:
$ git checkout -b myFeature dev
Creates MyFeature branch off dev. Do your work and then
$ git commit -am "Your message"
Now merge your changes to dev without a fast-forward
$ git checkout dev
$ git merge --no-ff myFeature

Now push changes to the server
$ git push origin dev
$ git push origin myFeature
Refs http://stackoverflow.com/questions/4470523/git-create-a-branch-from-another-branch

Thursday, December 11, 2014

SSH

$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
Enter file in which to save the key (/home/you/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Embedding password into key file
$ openssl rsa < id_rsa > id_rsa_withpass
Enter pass phrase:************
writing RSA key

useradd tai
passwd -u -f tai
usermod -g wheel tai
mkdir /home/tai/.ssh
mv authorized_keys /home/tai/.ssh/
chown tai:tai /home/tai/.ssh
chown tai:tai /home/tai/.ssh/authorized_keys
chmod 700 /home/tai/.ssh
chmod 600 /home/tai/.ssh/authorized_keys
sudo visudo

Tuesday, September 30, 2014

Virtualhost for Apache 2.4

VirtualHost *:80>
        DocumentRoot /your_path
        ServerName domain.local.com
        # ErrorLog /var/log/apache2/error.log
        <Directory /your_path>
                Options All +Indexes +FollowSymLinks
                 AllowOverride All
                 Order allow,deny
                 Allow from all
                 Require local
        </Directory>
</VirtualHost>

Sunday, July 13, 2014

Install Apache + PHP + Mysql

Update your respository before installing these
$ sudo apt-get update

Install Apache
$ sudo apt-get install apache2

Install PHP
$ sudo apt-get install php5

Install Apache
$ sudo apt-get install mysql-server

Install phpmyadmin
$ sudo apt-get install phpmyadmin