Wednesday, April 26, 2023

Command to check if particular server URL supports forward secrecy

 These ciphers are employed if Forward Secrecy is supported by server

 openssl s_client -connect server.com:443 -cipher "ECDHE, EECDH"

 openssl s_client -connect server.com:443 -cipher "DHE, EDH"

If the command results in a “sslv3 alert handshake failure” error, the Forward Secrecy property is not supported by the server. 

Command to check ATS configuration of URL in mac

 The below terminal command helps us get detailed ATS check on specific URL

nscurl --ats-diagnostics <URL>

Wednesday, March 22, 2023

How to configure PHP and Apache with Mac OS Monterey and above

 PHP has been removed since Monterey 

So we're going to install latest PHP using Home brew and edit the configuration files of apache web server so PHP web hosting is supported from local machine.

 - If you don't have Homebrew installed , use the below terminal command to set up home brew

     /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

 - Once the brew set up is success , feed the below command in terminal to instal latest PHP 

    brew install php

- start php using below command

   brew services start php

 - create sites directory under current user root directory using below command

     sudo mkdir ~/Sites

- open apache folder and create username.conf using below terminal command

     cd /etc/apache2/users
     sudo nano username.conf

- Feed the below text into the file and press Ctrl+o to save
    
    <Directory "/Users/username/Sites/">
      AllowOverride All
      Options Indexes MultiViews FollowSymLinks 
      Require all granted
    </Directory>

 - Now let's open httpd.conf using the below command
     
     sudo nano /etc/apache2/httpd.conf

- Uncomment the below lines from the above file

   LoadModule authz_core_module libexec/apache2/mod_authz_core.so
   LoadModule authz_host_module libexec/apache2/mod_authz_host.so
   LoadModule userdir_module libexec/apache2/mod_userdir.so
   LoadModule include_module libexec/apache2/mod_include.so
   LoadModule rewrite_module libexec/apache2/mod_rewrite.so

- Add the following lines into the same above file
   
  LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so

  <FilesMatch \.php$>
  SetHandler application/x-httpd-php
  </FilesMatch>

- Uncomment the below line 

  Include /private/etc/apache2/extra/httpd-userdir.conf

- Search for AllowOverride None in the file and replace with below text

    AllowOverride All

- Save the file by pressing Ctrl+o

- Open one more apache file using below command

    sudo nano /etc/apache2/extra/httpd-userdir.conf

- Uncomment the below line and save it
  
    Include /private/etc/apache2/users/*.conf

- Restart the apache using below command

   sudo /usr/sbin/apachectl restart

- Check if webserver is running by opening the below url in browser

   http://localhost

- To check if PHP is supported , let's create a php file in webserver directory and try acessing it in the browser

   sudo touch /Library/WebServer/Documents/index.php
   sudo nano /Library/WebServer/Documents/index.php

and enter the below text and save it.

   <?php 
    phpinfo(); 
  ?>

- Check if PHP is supported by opening below url in browser
 
   http://localhost/index.php
 
- If PHP is not signed yet , then you might get an error. Find the exact error message using below command in terminal

 apachectl -t -D DUMP_VHOSTS 

- If you find code signing issue in the above response, then Create a CA for code signing and do code signing

- Now feed below command to sign the php using terminal 

      codesign --sign "your-authority-name" --force --keychain ~/Library/Keychains/login.keychain-db /opt/homebrew/opt/php/lib/httpd/modules/libphp.so

- Open the httpd.conf again and change the uncommented php line with below text

     LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so "your-authority-name"

- Restart the apache again with below command

    sudo /usr/sbin/apachectl restart

- Access the PHP file again through browser, you should be able to see a proper php web page now



Thursday, February 4, 2021

Reclaim your memory from mac SSD without using any third party software

I took following steps and saved over 100GB


1. Opened Devices & simulators from Xcode and removed all the unwanted simulators

2. Cleared all the unwanted simulator runtimes from the below path

    /Library/Developer/CoreSimulator/Profiles/Runtimes

3. Removed all the simulator logs from the below path

     ~/Library/Logs/CoreSimulator/

4. Removed the unwanted device support and all the device logs,derived data and user data from below path

    ~/Library/Developer/Xcode/iOS DeviceSupport

    ~/Library/Developer/Xcode/iOS Device logs

    ~/Library/Developer/Xcode/DerivedData

    ~/Library/Developer/Xcode/UserData

5. Remove the temporary files and caches from the below path

     /private/var/folders/

6. Remove the system caches from the below path

    ~/Library/Caches

FYI:

It's always good to take a back up in time machine before doing , just in case if something goes wrong.

Saturday, January 30, 2021

How to join and study a university in UK

 Documents needed

  1. Get a transcript of your marksheet
  2. Get SOP ( Statement of purpose )
  3.  Get LOR ( Letter of recommendation ) from your Indian university if applicable employer
  4. Get IELTS score


Process:

  • Look for good colleges (https://russellgroup.ac.uk/about/our-universities/) and apply with the above documents and you would get a response in weeks. 
  • If it's a positive response, they'd offer conditional offer letter 
  • With that they would ask list of other documents and initial tuition fee like 2000 pound. 
  • Once you have successfully uploaded the documents and paid the initial fees they would  offer unconditional offer letter
  • With this letter you have become student of the university and you may start the visa process.
  • For visa process you can go to VFS and this will redirect to UKVisa site.
  • You will have to pay for NHS and health insurance which will be like 40k INR I heard recently it has changed to 80k INR
  • You will have to pay visa fee which would be 30k INR.
  • Then you will get visa appointment and you will have to carry all the originals for verification and they will take biometrics and issue the visa.
  • Before that you will have to show your account with 2Million INR for financial security. 
  • If you have applied for Education loan then you will have to show loan sanction letter
  • With visa one can book flight and travel to UK and you will have to collect BRP from post office within 1 or 2 weeks.

P.S

  1. In case of education loan , you may use conditional offer letter and start applying for loan with that. 
  2. If you have decided to drop off for some reason , they you may ask for initial tuition fee refund and most universities do the refund.
  3. Always choose a college which is close to a city that offers more part time jobs.


Thursday, November 5, 2020

Unified logging in iOS

 One of most important use of unified logging is that it facilitates us to see the logs from extensions.

Using apple xcode doesn't show the logs in it from extension.

All we have to do is use the following import

    import os.log

If you want to log something use the below statement

  os_log("")

Now you can see all this logs printed in terminal. 


P.S:

It can be very useful while you are working with extensions. Because we have to attach the extension with xcode for us to actovate the breakpoint inside  extension. Till we attach lot of things can happen we may want to know that's when the unified logging comes to our rescue. 

 

Sunday, November 24, 2019

Uprading to SSD from HDD on mac book pro

Recently my mac book pro has become very slow and found out that my HDD(Hard Disk Drive) has become faulty and that's the reason it's very slow.

I went to apple store to fix it and it was little expensive over there like £230 and they can do only as is replacement for HDD with another HDD and they won't do HDD to SSD(Solid State Drive)

So I went over to third party apple repair shop and they were ready to upgrade my mac book pro with SSD but again it was little expensive like £280.   

So I decided , I would do it myself and fixed it successfully so I thought I would share what I did to do this so that it's helpful for anyone who's looking to do.

1.  Buy the right SSD for your machine. I recommend Cruical.com. Visit this site and it'll ask you to download an app and it'll tell you what are the SSD you can buy for your machine.

2. Buy a Laptop or computer repairing screw driver set. 

3. Remove the screws from lower case.

4. Remove the battery connection cable from the motherboard

5. Remove the battery using pull tab

6. Disconnect the HDD connecting cable

7. Take out the HDD and remove the retaining screws from the side of HDD

8. Attach the retaining screws to SSD 

9. Put the SSD in place of HDD

10.Attach the connecting cable on SSD then attach the battery cable with mother board

11.Put all the screws back

12. Start up your mac and press command + option + R 

13. This will bring internet recovery 

14. After recovery choose disk utility and erase the newly bought SSD with Format: APFS and Partition type: GUID

15. After erasing , choose internet recovery or restore time machine back up

Then follow the normal steps like entering the apple id to sign in once the recovery is over. That's all