How to decrypt a private key and prepare SSL certificate for IIS installation

Once you have got necessary files.

Encrypted private key and certification file you need to do the following

Decrypt the private key

openssl rsa -in example.encrypted.key -out example.key

Enter passphrase for example.encrypted.key:

Add encrypted key to certificate and create a new certificate with a key already in it to install in IIS

openssl pkcs12 -inkey example.key -in example.crt -export -out example.pfx

You need to provide a password to it.

Once done on Windows Server use run command ->  mmc ->Snap in ->Certificate and Import the certificate or just double click on the certification and add to personal folder under Local Machine.

Many Thanks

Raf

How to add unknown mime types to IIS

Sometimes you may need an extention without knowing the correct mime-type or just may not exist yet or may not be defined.

You can use the following

.yourExtension application/octet-stream

This basically tells to download the file without try to opening by any software.

Some people saying that this comply with RFC and some not.

https://tools.ietf.org/html/rfc2046#section-4.5.1

The recommended action for an implementation that receives an
“application/octet-stream” entity is to simply offer to put the data
in a file, with any Content-Transfer-Encoding undone, or perhaps to
use it as input to a user-specified process.

It is expected that many other subtypes of “application” will be
defined in the future. MIME implementations must at a minimum treat
any unrecognized subtypes as being equivalent to “application/octet-
stream”.

You decide.

I have also see people adding application/unknown for mime type but I would still recommend putting octet-stream as at least it is defined in the RFC otherwise you can also put applicatoion/I_dont_know and it would be the same as ‘unknown’ in my opinion.

Other resources:

MIME Types in IIS – https://msdn.microsoft.com/en-us/library/bb742440.aspx

Many Thanks

Raf

 

Finding binary gap highest number in php

This is just for training purpose

// you can write to stdout for debugging purposes, e.g. // print “this is a debug message\n”; function solution($n){

if(is_int($n) AND $n < 2147483647){ // write your code in PHP7.0

$binaryString = decbin($n);

$gap = 0;

$max = 0;

$lenght = strlen($binaryString);

$bin = str_split($binaryString);

for($x=0; $x < $lenght; $x++){

// if 1 then reset gap as it starts again

if($bin[$x] == 1){

if($gap > $max){

$max = $gap;

}

$gap=0;

}else{

$gap++; // increase the gap

}

}

return $max;

}else{

return 0;

}

}

How to setup sendmail to relay outgoing emails

If you don’t use postfix and just sendmail to sendmail may want to relay your emails to your relay server.

Navigate to /etc/mail/sendmail.mc

then add define(`SMART_HOST’, `relay.exmple.com’)dnl

sudo service sendmail restart

You can then check your logs on /var/log/mail.err to see if it’s all working.

How to fix Iphone stuck in headphones mode – set of fixes.

have to say it’s amazing how many different fixes can fix this problem!!! Apple go back to work!

List of things that I have already tried:

  1. Replaced the headphone/charging port.
  2. Replaced ear speaker
  3. Reset the iPhone. Press and hold Sleep/Wake button and Home button together until Apple logo appears.
  4. Factory Full Reset and setup as new iphone
  5. Play a song (lengthy duration) and allow iPhone to completely lock.Now insert iPhone compatible headset jack.Unlock iPhone. Stop audio and unplug jack.
  6. Plug in headset when phone is locked.Hold down power button. It will bring “slide to power off” bar.Now remove the headphones.

    Press the “cancel” button at the bottom of the screen.

    Now check the sound.

  7. Signing up for Beta and Updating to the latest software.
  8. Turned off/flicked keyboard clicks in Sounds option.
  9. Checked for  LCI Liquid Contact Indicator https://support.apple.com/en-us/HT204104 ( All good)
  10. Cleanup headphone jack before replacing the board (there are little metal balls which can get stuck)
  11. Go to Sound and Try to play some ringtones (you can hear ringtones but it did not switched back)
  12. Turning on “Airplane” mode then adjusting the volume up and down.
  13. set an alarm, let that go off, and the headphone mode turned off!
  14. Play with the ringtones in the settings keep flipping the mute switch and volume keys. And rebooting the phone it worked for me
  15. plugged the apple headphones in and out it
  16. 5/10 minutes of hairdryer on the cold setting
  17. Restore Phone using DFU method and Itunes
  18. Clean logic board connector which connect headphones/thunderbird using 99 isoprop
  19. plugged in my headphones, opened my Control Center, and then pulled them out
  20. Try to use Isopropyl alhocal to clean the speaker/microphone Thunderbird connector.