Custom GCode for Slic3r and Octoprint

So my printing setup is a little weird, my cooling fan header is swapped with the parts cooling fan. I am too lazy to swap them out so I decided to swap them in software the best I could within my Slic3r settings below. This GCode may or may not work for you, use at your own risk.

Slic3r:

Start G-Code:

These settings are found under printer > custom gcode

M106 S255 ;sets hotend fan to 100%
M92 E96 ;sets my extruder stepping to correct value

Before Layer change G-Code:

{if [layer_num] >= 2} M106 P2 S255 ;fixes the part fan issue

OctoPrint:

Before print job starts:

M106 S255 ;sets hotend fan to 100%
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
G28 ;Home all axes (max endstops)
M92 E96 ;sets my extruder stepping to correct value
G1 Z15.0 F9000 ;move the platform down 15mm
M501; Loads settings
M117 Printing...

After print job completes:

M104 S0 ;extruder heater off
M140 S0 ;heated bed heater off (if you have it)
G91 ;relative positioning
G1 E-1 F300  ;retract the filament a bit before lifting the nozzle
M84 ;steppers off
G28 ;Home all axes (max endstops)
M84 ;steppers off
M106 P2 S0 ; set fan speed to 0
G4 P300000 ; wait 5 minutes
M106 S0 ; set fan speed to 0
M107 ; turn off fan

After print job is cancelled:

M84 ; disable motors
G28 ; Home all axes

After connection to printer is established:

M106 S255 ;auto turn hotend fan on after connection to octoprint