Tuesday, June 13, 2017

Bash Profile in Mac OS Sierra

Im not sure, but by default "ls" in Mac OS does not have color so you have to use "-G" option but quite hassle. The solution is to use alias just like in other flavors of *nix.


  1. Go to your home directory and crate ".bash_profile" and by default this is not present.

    sudo vi .bash_profile

  2. Add this line alias ls='ls -G' and save.
  3. Restart your terminal session.

Tuesday, May 30, 2017

Stucked Windows 10 Spotlight Fix

Is your Windows 10 lock screen stuck to the same picture? Here is the fix.


  1. Login and go to this folder

    "C:\Users\<USERNAME>\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_<somecharacters>\Settings"

     
  2. Delete all the files and redo the login. :)

Tuesday, April 11, 2017

AWS PEM to PPK but missing SSH-2 RSA

You may be wondering, in AWS documentation, the PuTTY Key Generator show SSH-2 RSA and it is missing in the newer versions.

Just select "RSA" because it is for SSH2 and the rest of the options except for one which explicitly says "SSH-1 (RSA)".

https://the.earth.li/~sgtatham/putty/0.68/htmldoc/Chapter8.html#puttygen-keytype
8.2.2 Selecting the type of key

Before generating a key pair using PuTTYgen, you need to select which type of key you need. PuTTYgen currently supports these types of key:

  • An RSA key for use with the SSH-1 protocol.
  • An RSA key for use with the SSH-2 protocol.
  • A DSA key for use with the SSH-2 protocol.
  • An ECDSA (elliptic curve DSA) key for use with the SSH-2 protocol.
  • An Ed25519 key (another elliptic curve algorithm) for use with the SSH-2 protocol. 


Hope this helps. :)

Saturday, April 8, 2017

Laravel 5.x on Ubuntu 14.04 (EC2) and PHP5.6

The following commands will install laravel on the said environment - title says :) This can be automated on when the instance gets launched.

#repository for php5.6 because the version isn't available on default
sudo add-apt-repository -y ppa:ondrej/php

sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install apache2
sudo apt-get install python-software-properties

#these php5.6 package seems to make the installation of laravel breeze
sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-gd php5.6-mysql php5.6-mbstring php5.6-xml zip unzip php5.6-zip

#option: remove and purge old PHP 5.x packages
sudo apt-get -y purge php5-common
sudo apt-get -y install libapache2-mod-php5.6

sudo apt-get -V install mysql-server-5.6

# locate the php.ini file from phpinfo.php and load needed modules

cd
sudo curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

# installing git seems not required. I'm not an expert it i manage to get it installed
# sudo apt-get install git


# for laravel 5.4.x - this wasn't required before perhaps new docs says so...
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1

# root of the website / "project1" is the name of the root of new laravel installation
cd /var/www/html/
sudo composer create-project laravel/laravel project1 --prefer-dist
sudo chgrp -R www-data /var/www/html/project1
sudo chmod -R 775 /var/www/html/project1/storage

cd /etc/apache2/sites-available

# create the project1 conf file / virtual host
sudo vi project1.conf
<VirtualHost *:80>
ServerName localhost

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/project1/public

<Directory /var/www/html/project1>
AllowOverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


sudo a2dissite 000-default.conf
sudo a2ensite project1.conf
sudo a2enmod rewrite

sudo service apache2 restart

Now, browse your Laravel installation - http://<ip_or_domain

Hope this helps!

Resources:

  • tons of website which will be added once i get the list


Tuesday, March 7, 2017

Hosting Website using Domain Outside AWS

It isn't difficult hosting a website on AWS and using your own domain. Here are the steps to accomplish this:


  1. Login to your AWS console and go to Route 53 (managed DNS).
  2. Create a Hosted Zone
    • Domain: example.com (of course, use your own domain)
    • Comment: you very descriptive words to about the domain :)
    • Select Public Hosted Zone
  3. Select the record NS type and take note of the name servers listed.
  4. Go to your domain registrar and point it to the name servers provided by AWS Route 53
  5. Click Create Record Set
  6. You may leave the Name blank as root domain, select record type A - IPv4 address
  7. Set Alias to No and put leave the TTL to 300 seconds
  8. Set the Value to the Elastic IP (EIP) of the EC2
  9. Set the Routing Policy to Simple and click Save Record Set
  10. Redo step 5 to create different type (e.g.: A, CNAME, MX, etc.)
Not included in this setup is the configuration of web server (IIS, Apache, etc.) and associating EIP on EC2

Saturday, November 5, 2016

pfSense (2.3.2-RELEASE-p1) and SquidGuard (1.14_4)

I've been spending so much time to block a custom URL which isn't part of the blacklist. Here is what needs to be done.


  1. Create your Target categories (e.g.: iflix | iflix.com) and save it. With emphasis on "save" or whatever makes the change stick!
  2. Go to Common ACL > Target Rules List and select the new category created - either allow or deny it. Denying the category for testing is easy. :)
  3. Go to General settings and click Apply the Save at the bottom of the page.
Test your new category if it gets blocked. You can also verify by going to Log > Blocked and see if the domain/URL gets blocked.

Sunday, September 11, 2016

Laravel 5.3 and Migration

After running this command

php artisan make:migration create_nerds_table --table=nerds --create

I started modifying the generated file to complete the database then ran this

php artisan migrate

and unfortunately, it was giving this error.


After comparing notes (this and another project which ran successful - still in progress), I noticed the difference in the migration file.

The "make:migration" command generated a migration file that uses "Schema::table". The command "php artisan migrate" worked after changing the said part to "Schema::create".

Hope this helps. The environment is on VMware running Ubuntu 14.04 LTS with Apache, PHP5.x, and MariaDB.